Version 1 (modified by trac, 12 years ago) (diff)

--

A style provides the means to create a unified look by creating a set of property values, saving it as a style, and allowing other objects to reference the style as its default. Therefore, multiple buttons could share the same look without having to individually set the property values of each button. (Though they don't all have to be buttons; styles aren't even dependent on type.)

Any properties of an object with this style which are not specified override its default value with the values of the new style. Values that are not specified by the object or its style default back to the default style.

The properties used for a style are the same as those available for a normal control (that's the point). The only property that differs is name: This specifies the name of the style, which other objects can specify in their style=<stylename> property to indicate the control's style.

Styles are setup in the <styles.xml> file.

  <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
  
  <!DOCTYPE styles SYSTEM "..\gui.dtd">
  
  <styles>
    <!-- Style that will hide the object as new default -->
    <style name="style_name1"
           hidden="true" 
    />
  
    <!-- Style that helps us create a nice edit box -->
    <style name="editbox_nice"
           sprite="sprite1"
           font="font1"
    />
  </styles>