| Next revision |
— | dragengine:modules:dragonscript:xmlguitheme:decoration [2018/02/28 16:25] – created dragonlord |
---|
| <WRAP youarehere> |
| [[:start|Start Page]] >> [[dragengine:modules:dragonscript:main|DragonScript Scripting Language]] >> [[dragengine:modules:dragonscript:guitheme|Gui Themes]] >> **Define XML Decoration** |
| </WRAP> |
| |
| |
| ====== 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 [[https://dragengine.rptd.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Gui_1_1Decorations_1_1Factories_1_1DecorationFactories.html|DecorationFactories]] script class: |
| ^ Name ^ Script Class ^ Description ^ |
| | [[#default|Default]] | [[https://dragengine.rptd.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Gui_1_1Decorations_1_1Factories_1_1DefaultDecorationFactory.html|DefaultDecorationFactory]] | Default decoration with no visual appearance and no interaction | |
| | [[#canvascreator|CanvasCreator]] | [[https://dragengine.rptd.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Gui_1_1Decorations_1_1Factories_1_1CanvasCreatorDecorationFactory.html|CanvasCreatorDecorationFactory]] | Decoration using canvas creator for the border elements | |
| |
| You can use custom prototypes by adding them to [[https://dragengine.rptd.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Gui_1_1Decorations_1_1Factories_1_1DecorationFactories.html|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. |
| <code xml> |
| <decoration parameter='ParameterName' type='Default'> |
| <!-- set parameters here --> |
| </decoration> |
| </code> |
| |
| 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. |
| <code xml> |
| <decoration parameter='ParameterName' extend='sharedDecoration.decoration.xml'> |
| <!-- set parameters here to modify the loaded decoration --> |
| </decoration> |
| </code> |
| |
| |
| ====== Decoration Factory Parameters ====== |
| Decoration factories are configured by setting parameters. For each supported parameter type an own tag exists. See [[dragengine:modules:dragonscript:xmlguitheme:parameters|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 [[https://dragengine.rptd.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Gui_1_1Decorations_1_1Factories_1_1DefaultDecorationFactory.html|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 [[https://dragengine.rptd.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Gui_1_1Decorations_1_1Factories_1_1CanvasCreatorDecorationFactory.html|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 | [[dragengine:modules:dragonscript:xmlguitheme:parameters#bordersize|BorderSize]] | Amount of space reserved around the widget to draw the decoration | |
| | {windowState}.canvas | [[dragengine:modules:dragonscript:xmlguitheme:parameters#canvas_creator|CanvasCreator]] | Canvas creator to use for window state | |
| | {buttonState}.imageButtonClose | [[dragengine:modules:dragonscript:xmlguitheme:parameters#image|Image]] | Image to use for the close button in the state | |
| | {buttonState}.imageButtonMaximize | [[dragengine:modules:dragonscript:xmlguitheme:parameters#image|Image]] | Image to use for the maximize button in the state | |
| | {buttonState}.imageButtonMinimize | [[dragengine:modules:dragonscript:xmlguitheme:parameters#image|Image]] | Image to use for the minimize button in the state | |
| |