User Tools

Site Tools


dragengine:modules:dragonscript:xmlguitheme:decoration

Start Page » DragonScript Scripting Language » Gui Themes » Define XML Decoration

Decorations

Decorations can be defined as parameters using the decoration tag or inside own XML files typically with the extension *.decoration.xml. The extension can be chosen differently if required. For both versions the same tag definition is used.

Decorations are always based directly or indirectly on a type. This type is the Decoration Prototype and defines what instance of DecorationFactory is used in the scripts. The choice of prototype affects the appearance and functionality of the decoration and the factory configuration possibilities.

The following prototypes are provided by default by the DecorationFactories script class:

Name Script Class Description
Default DefaultDecorationFactory Default decoration with no visual appearance and no interaction
CanvasCreator CanvasCreatorDecorationFactory Decoration using canvas creator for the border elements

You can use custom prototypes by adding them to DecorationFactories instance before loading gui themes. This is useful if you created custom decoration subclasses requiring custom parameters.

This example defines a decoration based on the CanvasCreator prototype.

<decoration parameter='ParameterName' type='Default'>
   <!-- set parameters here -->
</decoration>

If you modify an existing decoration factory the type of the original decoration factory is taken over. This example creates a decoration factory by loading it from a file.

<decoration parameter='ParameterName' extend='sharedDecoration.decoration.xml'>
   <!-- set parameters here to modify the loaded decoration -->
</decoration>

Decoration Factory Parameters

Decoration factories are configured by setting parameters. For each supported parameter type an own tag exists. See Defining Parameters for an overview of the supported types. The supported parameters by decoration factory type are listed below.

Default

The most basic decoration with no visual appearance and no interaction at all. Creates an instance of the DefaultDecorationFactory script class. This is used to define windows with no decoration at all for example for full screen windows. You can also use null or not setting a decoration at all. By default windows have no decorations.

This factory has no parameters.

CanvasCreator

Creates a decoration factory using canvas creators. Creates an instance of the CanvasCreatorDecorationFactory script class.

The window support these display states to style individually:

  • active. Window is active.
  • inactive. Window is inactive.

The buttons support these display states to style individually:

  • normal. Button is in the normal or basic state.
  • disabled. Button is disabled and can not be pressed.
  • hover. Mouse pointer is hovering over the button.
  • pressed. Button is pressed down.

In the list below replace {windowState} with one of the window state names above and {buttonState} with one of the button state names above. For example to define the canvas for inactive window state the parameter name would be inactive.canvas. To define the button image for hover state the parameter name would be hover.imageButtonClose.

These parameters can be used:

Parameter Name Supported parameter type Description
decorationSize BorderSize Amount of space reserved around the widget to draw the decoration
{windowState}.canvas CanvasCreator Canvas creator to use for window state
{buttonState}.imageButtonClose Image Image to use for the close button in the state
{buttonState}.imageButtonMaximize Image Image to use for the maximize button in the state
{buttonState}.imageButtonMinimize Image Image to use for the minimize button in the state
You could leave a comment if you were logged in.
dragengine/modules/dragonscript/xmlguitheme/decoration.txt · Last modified: 2024/03/14 16:44 by dragonlord