NAME
std/gui/objects - Runtime-supported GUI object classes.
SYNOPSIS
from std/gui/objects import Window, VBox, Button;
let w := new Window( title: "Demo" );
let b := new Button( text: "OK", id: "submit" );
w.set_content( new VBox( children: [ b ] ) );
IMPLEMENTATION SUPPORT
This module is supported by zuzu.pl, zuzu-rust, and zuzu-js on Electron. It is not supported by zuzu-js on Node or Browser.
DESCRIPTION
This runtime-supported module provides the std/gui object model. Host runtimes provide visible windows and baseline controls where GUI support is available, while retaining the same object tree and event API for tests and future backends.
EXPORTS
Variables
metaType:
Dict. Runtime/backend metadata. Current keys includebackend,font_size_pixels,font_name, andfont_point_size.
Classes
WidgetBase class for GUI objects. Supports
id,parent,children,add_child,remove_child,enabled,set_enabled,visible,set_visible,width,height,minwidth,minheight,maxwidth,maxheight,classes,add_class,remove_class,style,meta,find_by_id,on,once,off,emit, and event shortcuts such asclick.Common widget methods take or return widget state values. Getters return the current value; setters return the widget so calls can be chained.
WindowTop-level container with
show,call,close,content, andset_content. In Phase 1,showis non-rendering andcallreturns the current close result.VBox,HBox,FrameLayout containers.
Menu,MenuItemWindow menu bar widgets.
Menuwidgets are directWindowchildren;MenuItemwidgets are directMenuchildren.Label,Text,RichText,ImageContent widgets.
Input,DatePicker,Checkbox,Radio,RadioGroup,Select,ButtonBaseline input widgets.
Separator,Slider,ProgressExtended baseline controls.
Tabs,TabTab container and tab pages.
Tabs.selectedselects the activeTab.ListView,TreeViewCollection controls with selection and activation events.
EventEvent object passed to handlers which accept an argument. Provides
name,target,current_target,window,phase,timestamp,data,cancelled,default_prevented,stop_propagation, andprevent_default.ListenerTokenOpaque token returned by
onandonce, accepted byoff.native_file_open,native_file_save,native_directory_open,native_directory_save,native_alert,native_confirm,native_prompt,native_colour_pickerBackend-native modal file and directory dialogue hooks used by
std/gui/dialogue. These return selected paths ornullwhen cancelled.native_alert,native_confirm,native_prompt, andnative_colour_pickerreturnnullwhen unsupported sostd/gui/dialoguecan use its shared fallback.
COPYRIGHT AND LICENCE
std/gui/objects is copyright Toby Inkster.
It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.