Open main menu

Difference between revisions of "GUI Themes/STX Syntax"

add xml syntax highlighting here too
(add xml syntax highlighting here too)
Line 11: Line 11:
===== Example =====
===== Example =====


<pre>&lt;render_info resolution = &quot;320x240&quot;&gt;
<syntax type="xml">
<render_info resolution = "320x240">
     ...
     ...
&lt;/render_info&gt;</pre>
</render_info>
</syntax>
 
===== Description =====
===== Description =====


Line 32: Line 35:
===== Example =====
===== Example =====


<pre>&lt;palette&gt;
<syntax type="xml">
<palette>
     ...
     ...
&lt;/palette&gt;</pre>
</palette>
</syntax>
 
===== Description =====
===== Description =====


Line 49: Line 55:
===== Example =====
===== Example =====


<pre>&lt;color name = 'red'
<syntax type="xml">
<color name = 'red'
         rgb = '255, 0, 0'
         rgb = '255, 0, 0'
/&gt;</pre>
/>
</syntax>
 
===== Description =====
===== Description =====


Line 73: Line 82:
===== Example =====
===== Example =====


<pre>&lt;bitmaps&gt;
<syntax type="xml">
<bitmaps>
     ...
     ...
&lt;/bitmaps&gt;</pre>
</bitmaps>
</syntax>
 
===== Description =====
===== Description =====


Line 91: Line 103:
===== Example =====
===== Example =====


<pre>&lt;bitmap filename = 'logo.bmp'/&gt;</pre>
<syntax type="xml">
<bitmap filename = 'logo.bmp'/>
</syntax>
 
===== Description =====
===== Description =====


Line 113: Line 128:
===== Example =====
===== Example =====


<pre>&lt;fonts&gt;
<syntax type="xml">
<fonts>
     ...
     ...
&lt;/fonts&gt;</pre>
</fonts>
</syntax>
 
===== Description =====
===== Description =====


Line 131: Line 149:
===== Example =====
===== Example =====


<pre>&lt;font  id = 'text_default'
<syntax type="xml">
<font  id = 'text_default'
         file = 'default'
         file = 'default'
         color = 'black'
         color = 'black'
/&gt;</pre>
/>
</syntax>
 
===== Description =====
===== Description =====


Line 169: Line 190:
===== Example =====
===== Example =====


<pre>&lt;defaults fill = 'gradient' fg_color = 'white' bevel_color = '237, 169, 72'/&gt;</pre>
<syntax type="xml">
<defaults fill = 'gradient' fg_color = 'white' bevel_color = '237, 169, 72'/>
</syntax>
 
===== Description =====
===== Description =====


Line 187: Line 211:
===== Example =====
===== Example =====


<pre>&lt;cursor file = 'cursor.bmp' hotspot = '0, 0' scale = '3'/&gt;</pre>
<syntax type="xml">
<cursor file = 'cursor.bmp' hotspot = '0, 0' scale = '3'/>
</syntax>
 
===== Description =====
===== Description =====


Line 211: Line 238:
===== Example =====
===== Example =====


<pre>&lt;drawdata id = 'mainmenu_bg' cache = false&gt;
<syntax type="xml">
     &lt;drawstep  ...
<drawdata id = 'mainmenu_bg' cache = false>
     /&gt;
     <drawstep  ...
&lt;/drawdata&gt;</pre>
     />
</drawdata>
</syntax>
 
===== Description =====
===== Description =====


Line 259: Line 289:
===== Example =====
===== Example =====


<pre>&lt;drawstep  func = 'roundedsq'
<syntax type="xml">
<drawstep  func = 'roundedsq'
             radius = '6'
             radius = '6'
             stroke = 1
             stroke = 1
Line 268: Line 299:
             gradient_end = 'darkred'
             gradient_end = 'darkred'
             bevel = 1
             bevel = 1
/&gt;</pre>
/>
</syntax>
 
===== Description =====
===== Description =====


Line 341: Line 374:
===== Example =====
===== Example =====


<pre>&lt;text  font = 'text_button'
<syntax type="xml">
<text  font = 'text_button'
         vertical_align = 'center'
         vertical_align = 'center'
         horizontal_align = 'center'
         horizontal_align = 'center'
/&gt;</pre>
/>
</syntax>
 
===== Description =====
===== Description =====


Line 384: Line 420:
===== Example =====
===== Example =====


<pre>&lt;layout_info resolution = '320xY'&gt;
<syntax type="xml">
<layout_info resolution = '320xY'>
     ...
     ...
&lt;/layout_info&gt;</pre>
</layout_info>
</syntax>
 
===== Description =====
===== Description =====


Line 405: Line 444:
===== Example =====
===== Example =====


<pre>&lt;globals&gt;
<syntax type="xml">
<globals>
     ...
     ...
&lt;/globals&gt;</pre>
</globals>
</syntax>
 
===== Description =====
===== Description =====


Line 423: Line 465:
===== Example =====
===== Example =====


<pre>&lt;def var = 'WidgetSize' value = 'kBigWidgetSize' /&gt;
<syntax type="xml">
&lt;def resolution = '320xY' var = 'WidgetSize' value = 'kNormalWidgetSize' /&gt;</pre>
<def var = 'WidgetSize' value = 'kBigWidgetSize' />
<def resolution = '320xY' var = 'WidgetSize' value = 'kNormalWidgetSize' />
</syntax>
 
===== Description =====
===== Description =====


Line 470: Line 515:
===== Example =====
===== Example =====


<pre>&lt;widget name = 'SmallButton'
<syntax type="xml">
<widget name = 'SmallButton'
         size = '128, 18'
         size = '128, 18'
/&gt;</pre>
/>
</syntax>
 
===== Description =====
===== Description =====


A global widget definition is a parser-exclusive alias for the layout properties of a specific widget. For instance, the definition of a global widget named <tt>Slider</tt> with certain size properties will allow you to specify <tt>Slider</tt> as a Widget type when adding widgets to a Dialog, and that widget will inherit the size properties defined in this global definition. For more information, please check the documentation on <tt>&lt;widget&gt;</tt> (''local widget definition'').
A global widget definition is a parser-exclusive alias for the layout properties of a specific widget. For instance, the definition of a global widget named <tt>Slider</tt> with certain size properties will allow you to specify <tt>Slider</tt> as a Widget type when adding widgets to a Dialog, and that widget will inherit the size properties defined in this global definition. For more information, please check the documentation on <tt>&lt;widget&gt;</tt> (''local widget definition'').


<pre>&lt;dialog name = 'SampleDialog' overlays = 'screen'&gt;
<syntax type="xml">
     &lt;layout type = 'vertical' ...&gt;
<dialog name = 'SampleDialog' overlays = 'screen'>
     <layout type = 'vertical' ...>


     /*   
     /*   
Line 485: Line 534:
         automaticall inherits its size
         automaticall inherits its size
     */
     */
         &lt;widget name = 'A.Sample.Button'
         <widget name = 'A.Sample.Button'
                 type = 'SmallButton'
                 type = 'SmallButton'
         /&gt;
         />


         ...
         ...
     &lt;/layout&gt;
     </layout>
&lt;/dialog&gt;</pre>
</dialog>
</syntax>
 
Because of this, there are no unique identifiers for Widget names. You may give them any alias (since these aliases are only queried by your own layout definition, inside the parser). However, for added customization, the Theme Renderer will also poll a few unique Global Widget names for their layout information:
Because of this, there are no unique identifiers for Widget names. You may give them any alias (since these aliases are only queried by your own layout definition, inside the parser). However, for added customization, the Theme Renderer will also poll a few unique Global Widget names for their layout information:


Line 519: Line 570:
===== Example =====
===== Example =====


<pre>&lt;dialog name = 'Launcher' overlays = 'screen'&gt;
<syntax type="xml">
<dialog name = 'Launcher' overlays = 'screen'>
     ...
     ...
&lt;/dialog&gt;
</dialog>


&lt;dialog name = 'GameOptions_Graphics' overlays = 'Dialog.GlobalOptions.TabWidget'&gt;
<dialog name = 'GameOptions_Graphics' overlays = 'Dialog.GlobalOptions.TabWidget'>
     ...
     ...
&lt;/dialog&gt;</pre>
</dialog>
</syntax>
 
===== Description =====
===== Description =====


Line 584: Line 638:
===== Example =====
===== Example =====


<pre>&lt;layout type = 'vertical' center = 'true' padding = '23, 23, 8, 23'&gt;
<syntax type="xml">
<layout type = 'vertical' center = 'true' padding = '23, 23, 8, 23'>
     ...
     ...
&lt;/layout&gt;</pre>
</layout>
</syntax>
 
===== Description =====
===== Description =====


Line 615: Line 672:
===== Example =====
===== Example =====


<pre>&lt;dialog name = 'GameOptions_Audio' overlays = 'Dialog.GlobalOptions.TabWidget'&gt;
<syntax type="xml">
     &lt;layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'&gt;
<dialog name = 'GameOptions_Audio' overlays = 'Dialog.GlobalOptions.TabWidget'>
         &lt;widget name = 'EnableTabCheckbox' type = 'Checkbox' /&gt;
     <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'>
         &lt;import layout = 'Dialog.GlobalOptions_Audio' /&gt;
         <widget name = 'EnableTabCheckbox' type = 'Checkbox' />
     &lt;/layout&gt;
         <import layout = 'Dialog.GlobalOptions_Audio' />
&lt;/dialog&gt;</pre>
     </layout>
</dialog>
</syntax>
 
===== Description =====
===== Description =====


Line 641: Line 701:
===== Example =====
===== Example =====


<pre>&lt;widget name = 'StartButton' type = 'Button'/&gt;
<syntax type="xml">
&lt;space size = '16' /&gt;
<widget name = 'StartButton' type = 'Button'/>
&lt;widget name = 'AddGameButton' type = 'Button' /&gt;</pre>
<space size = '16' />
<widget name = 'AddGameButton' type = 'Button' />
</syntax>
 
===== Description =====
===== Description =====


Line 652: Line 715:
Space keys may be optionally left without a <tt>size</tt> property: The space will automatically expand itself to fill all the remaining space inside the layout. This may be used to align widgets on the further side of a layout.
Space keys may be optionally left without a <tt>size</tt> property: The space will automatically expand itself to fill all the remaining space inside the layout. This may be used to align widgets on the further side of a layout.


<pre>&lt;layout type = 'horizontal' ...&gt;
<syntax type="xml">
<layout type = 'horizontal' ...>
     /** Add a button on the left */
     /** Add a button on the left */
     &lt;widget name = 'Button1' type = 'Button'/&gt;
     <widget name = 'Button1' type = 'Button'/>


     /** The space without size value will expand to fill all the layout */
     /** The space without size value will expand to fill all the layout */
     &lt;space/&gt;
     <space/>


     /** Add another button: */
     /** Add another button: */
     &lt;widget name = 'Button2' type = 'Button'/&gt;
     <widget name = 'Button2' type = 'Button'/>
     /** Since the space had filled the layout, this new button shrinks the
     /** Since the space had filled the layout, this new button shrinks the
         space by the button's width; hence Button2 is now aligned to the right */
         space by the button's width; hence Button2 is now aligned to the right */
&lt;/layout&gt;</pre>
</layout>
</syntax>
 
===== Properties =====
===== Properties =====


Line 678: Line 744:
===== Example =====
===== Example =====


<pre>&lt;widget name = 'AddGameButton'  
<syntax type="xml">
<widget name = 'AddGameButton'  
         width = '95'
         width = '95'
         height = 'Globals.Button.Height'  
         height = 'Globals.Button.Height'  
/&gt;
>
&lt;widget name = 'AboutButton'  
<widget name = 'AboutButton'  
         type = 'Button'  
         type = 'Button'  
/&gt;</pre>
/>
</syntax>
 
===== Description =====
===== Description =====


2,051

edits