Creating widgets directly from an XML theme file

It's always possible to create label widgets by specifying a named element in the theme file, and implementing the named x::w::uielements callback when generating the widgets.

It is possible to create regular widgets directly from a specification in the XML theme file. uigenerator4.C gives an example of creating label widgets from the theme file. This example creates the same label widget wordwraplabel.C, but this approach makes it possible to tweak labels without recompiling the code.

<?xml version="1.0" encoding="utf-8"?>
<theme version="1"


Custom fonts and colors

The <label> also uses a font called "label", which comes from the
default theme.

  <font id="title">
    <family>liberation sans</family>

  <color id="background">

  <layout id="main-window-grid" type="grid">

  <factory id="main-window-contents" type="grid">
      <label type="theme_text">                                 $#
${font:title}${color:blue}${decoration:underline}Lorem Ipsum${decoration:none}${color:black}${font:label}

dolor sit amet, consectetur adipisicing elit,                   $#
sed do eiusmod tempor incididunt ut labore et dolore mana       $#
aliqua. Ut enim ad minim veniam, quis nostrud exercitation      $#
ullamco laboris nisi ut aliquip ex ea commodo consequat.        $#
Duis aute irure dolor in reprehenderit in voluptate velit       $#
esse cillum dolore eu fugiat nulla pariatur.                    $#
Excepteur sint occaecat cupidatat non proident,                 $#
sunt in culpa qui officia deserunt mollit anim id est           $#



The contents of the label is a x::w::theme_text with references to colors and fonts defined in the theme file or the default display theme.