std/gui/objects

Standard Library documentation

Runtime-supported GUI object classes.

Module

Name
std/gui/objects
Area
Standard Library
Source
modules/std/gui/objects.zzm

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

  • meta

    Type: Dict. Runtime/backend metadata. Current keys include backend, font_size_pixels, font_name, and font_point_size.

Classes

  • Widget

    Base 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 as click.

    Common widget methods take or return widget state values. Getters return the current value; setters return the widget so calls can be chained.

  • Window

    Top-level container with show, call, close, content, and set_content. In Phase 1, show is non-rendering and call returns the current close result.

  • VBox, HBox, Frame

    Layout containers.

  • Menu, MenuItem

    Window menu bar widgets. Menu widgets are direct Window children; MenuItem widgets are direct Menu children.

  • Label, Text, RichText, Image

    Content widgets.

  • Input, DatePicker, Checkbox, Radio, RadioGroup,

    Select, Button

    Baseline input widgets.

  • Separator, Slider, Progress

    Extended baseline controls.

  • Tabs, Tab

    Tab container and tab pages. Tabs.selected selects the active Tab.

  • ListView, TreeView

    Collection controls with selection and activation events.

  • Event

    Event object passed to handlers which accept an argument. Provides name, target, current_target, window, phase, timestamp, data, cancelled, default_prevented, stop_propagation, and prevent_default.

  • ListenerToken

    Opaque token returned by on and once, accepted by off.

  • native_file_open, native_file_save, native_directory_open,

    native_directory_save, native_alert, native_confirm, native_prompt, native_colour_picker

    Backend-native modal file and directory dialogue hooks used by std/gui/dialogue. These return selected paths or null when cancelled. native_alert, native_confirm, native_prompt, and native_colour_picker return null when unsupported so std/gui/dialogue can 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.