gui2.guisystem - ICE 0.1 API documentation

ICE 0.1 API documentation

# gui2.guisystem

The main GUI class.

class GUISystem;

  The main GUI class. Manages widgets, emits events, etc.

  this(Platform platform, VFSDir gameDir);

    Construct the GUISystem.

    Parameters:

    Platform platform | Platform to use for user input.
    VFSDir gameDir | Game data directory.

  void setGUIArea(ref const Recti area);

    Set area taken up by the root widget.

    Parameters:

    Recti area | Area used by the root widget.

  RootWidget loadWidgetTree(YAMLNode source);

    Load a widget tree connectable to a SlotWidget from YAML.

    Throws:
    GUIInitException on failure.
  @property SlotWidget rootSlot();

    Get the root SlotWidget.

  pure nothrow @property Widget focusedWidget();

    Get the currently focused widget, if any.

  @property void focusedWidget(Widget rhs);

    Set the currently focused widget.

  void render(VideoDriver video);

    Render the GUI.

  void addWidgetConstructor(string widgetYAMLName, Widget delegate(ref Node) widgetCtor);

    Add a widget constructor function.

    This can be used to add support for new widget types. The constructor function will usually just call the constructor of the widget.
    This can be only called once per widget type name - this means that constructor functions for builtin widgets (e.g. "button") can't be replaced.

    Parameters:

    string widgetYAMLName | YAML widgets with this widget type name will be constructed with given constructor function.
    Widget delegate(ref Node) widgetCtor | Constructs a widget of from a YAML node. It can throw a WidgetInitException.

  void addLayoutConstructor(string layoutYAMLName, Layout delegate(Node*) layoutCtor);

    Add a layout constructor function.

    This can be used to add support for new layout types. The constructor function will usually just call the constructor of the layout.
    This can be only called once per layout type name - this means that constructor functions for builtin layouts (e.g. "boxManual") can't be replaced.
    A widget might not specify layout parameters; in that case, the YAML node pointer passed to layoutCtor is null. The function might then e.g. default-construct the layout.

    Parameters:

    string layoutYAMLName | YAML layout managers with this "layoutManager" name will be constructed with given constructor function.
    Layout delegate(Node*) layoutCtor | Constructs a layout of from a YAML node. It can throw a LauoutInitException.

  void addStyleConstructor(string styleYAMLName, StyleManager delegate(ref Tuple!(string,Node)[]) styleCtor);

    Add a style manager constructor function.

    This can be used to add support for new style manager types. The constructor function will usually just call the constructor of the style manager.
    This can be only called once per style manager type name - this means that constructor functions for builtin style managers (e.g. "line") can't be replaced.
    The style manager constructor is passed an array of named YAML nodes, each of which represents a style. If there is no default style (unnamed, just "style"), it must be added in the constructor function.

    Parameters:

    string styleYAMLName | YAML style managers with this "styleManager" name will be constructed with given constructor function.
    StyleManager delegate(ref Tuple!(string,Node)[]) styleCtor | Constructs a style manager of from an array of name-YAMLNode pairs. It can throw a StyleInitException.

  package void updateLayout();

    Update layout of all widgets (e.g. after a new RootWidget is connected).

  package const pure nothrow @property Vector2u mousePosition();

    Get current mouse position.

struct WidgetBuilder;

  Builds widgets dynamically.

  this(GUISystem guiSystem);

    Construct a WidgetBuilder building widgets with/for specified GUISystem.

  void buildWidget(string widgetTypeName)(void delegate(ref WidgetBuilder b) buildDg);

    Build a widget.

    The widget is built by the passed delegate that recursively builds subwidgets. The topmost widget should always be a RootWidget ("root"), to get a result that can be connected to other widget (through a SlotWidget).

    Parameters:

    widgetTypeName | Name of the widget type (the same as used in YAML).
    buildDg | Builds the widget by specifying parameters like layout and style to the passed WidgetBuilder and even building subWidgets through buildWidget calls.

    Throws:
    GUIInitException on failure.
  pure nothrow @property void widgetParams(const string params);

    Set widget type specific parameters, if any (i.e. not common ones like style, etc.).

    Can only be called by build delegates passed to buildWidget().

  pure nothrow @property void name(const string name);

    Set widget name, if any.

    Can only be called by build delegates passed to buildWidget().

  pure nothrow @property void layoutManager(const string manager);

    Set layout type.

    Can only be called by build delegates passed to buildWidget().

  pure nothrow @property void layout(const string layoutParams);

    Set layout parameters.

    Can only be called by build delegates passed to buildWidget().

  pure nothrow @property void styleManager(const string styleManager);

    Set style manager type.

    Can only be called by build delegates passed to buildWidget().

  pure nothrow void style(string name, string styleParams);

    Set parameters of style with specified name.

    Can only be called by build delegates passed to buildWidget().

  pure nothrow @property Widget[] builtWidgets();

    Get all widgets built by this WidgetBuilder so far.

Copyright © Ferdinand Majerech 2011. | Page generated by AutoDDoc and Ddoc.