std/gui

Standard Library documentation

User-facing GUI constructor helpers.

Module

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

NAME

std/gui - User-facing GUI constructor helpers.

SYNOPSIS

  from std/gui import *;

  let w := Window(
  	title: "Demo",
  	VBox(
  		Label( text: "Name:" ),
  		Input( id: "name" ),
  		Button( text: "OK", id: "submit" ),
  	),
  );

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. It is partially supported by zuzu-js in the browser: core GUI and widget lifecycle coverage passes, but filesystem-backed file and directory dialogue coverage is unsupported.

DESCRIPTION

This module provides thin constructor helpers over std/gui/objects. Host runtimes expose the shared widget, object tree, event, and window lifecycle APIs when GUI support is available. It also re-exports backend-native file and directory dialogue hooks for std/gui/dialogue.

The module exports EM, the standard UI font height in logical pixels, derived from std/gui/objects metadata.

EXPORTS

Constants

  • EM

    Type: Number. Standard UI font height in logical pixels.

  • GUI_XML_NS

    Type: String. XML namespace URI used by GUI XML serialization and parsing.

Functions

  • Window(... PairList p, Array c), VBox(... PairList p, Array c), HBox(... PairList p, Array c), Frame(... PairList p, Array c)

    Parameters: p are widget properties and c contains child widgets. Returns: widget object. Constructs window and layout widgets.

  • Label(... PairList p, Array c), Text(... PairList p, Array c), RichText(... PairList p, Array c), Image(... PairList p, Array c)

    Parameters: p are widget properties and c contains child widgets. Returns: widget object. Constructs content widgets.

  • Input(... PairList p, Array c), DatePicker(... PairList p, Array c), Checkbox(... PairList p, Array c), Radio(... PairList p, Array c), RadioGroup(... PairList p, Array c), Select(... PairList p, Array c)

    Parameters: p are widget properties and c contains child widgets. Returns: widget object. Constructs input widgets.

  • Menu(... PairList p, Array c), MenuItem(... PairList p, Array c), Button(... PairList p, Array c), Separator(... PairList p, Array c), Slider(... PairList p, Array c), Progress(... PairList p, Array c)

    Parameters: p are widget properties and c contains child widgets. Returns: widget object. Constructs command and control widgets.

  • Tabs(... PairList p, Array c), Tab(... PairList p, Array c), ListView(... PairList p, Array c), TreeView(... PairList p, Array c)

    Parameters: p are widget properties and c contains child widgets. Returns: widget object. Constructs tabular and collection widgets.

  • unbind(BindingToken token)

    Parameters: token is a binding token. Returns: null. Removes a GUI binding.

  • gui_from_xml(String xml), gui_from_xml_file(path)

    Parameters: xml is GUI XML text and path is a file path. Returns: widget object. Builds a GUI object tree from XML.

  • gui_to_xml(Widget root)

    Parameters: root is a GUI widget. Returns: String. Serializes a GUI object tree to XML.

Classes

  • BindingToken

    Represents a model/widget binding.

    • token.is_active()

      Parameters: none. Returns: Boolean. Returns true while the binding is active.

    • token.set_listener(token)

      Parameters: token is a listener token. Returns: BindingToken. Stores the listener token associated with the binding.

    • token.sync_model_to_widget(), token.sync_widget_to_model()

      Parameters: none. Returns: null. Synchronizes the bound values.

    • token.unbind()

      Parameters: none. Returns: null. Removes the binding.

COPYRIGHT AND LICENCE

std/gui 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.