elements

<factory type="grid" id="statusrow">

<!-- ... -->

  <element>
    <name>label</name>
  </element>

<!-- ... -->

</factory>


x::w::uielements element_factory{
  {
    {"label",
     []
     (const x::w::factory &factory)
     {
         factory->create_label("Label");
     }
    }
  }
};

An element with a name (a named element) invokes the named callback from the x::w::uielements parameter to generate(). This callback receives an x::w::factory parameter which gets used, presumably, to create a widget. The first member of the x::w::uielements object is map. The map's key is a std::string, and the name value gives the callback's key value. An exception gets thrown if the name key does not exist.

It's possible that the same name value appears more than once, in the same or different factorys. Each occurence of a name results in the callback getting invoked.

<element id="fixed-canvas" tooltip="canvas-tooltip">

    ...

</element>

/* ----- */

x::w::uielements elements;

layout_manager->generate("dialog", generators, elements);

x::w::canvas fixed_canvas=elements.get_element("fixed-canvas");

An element without a name creates one of several supported widgets directly, without invoking an application callback, using the given parameters. Supported widgets:

These element elements have an optional id attribute. After the widgets get generated, x::w::uielements's get_element() retrieves the created widget with the specified id. Duplicate ids get ignored; get_element() returns the most recently-created widget with the specified id.

These elements have an optional tooltip attribute that creates a tooltip for the widget and an optional context that creates a context popup menu for the widget.