User Tools

Site Tools


dragengine:modules:dragonscript:xmlguitheme:borderfactory

Start Page » DragonScript Scripting Language » Gui Themes » Define XML Border Factory

Border Factories

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

Border factories are always based directly or indirectly on a type. This type is the Border Prototype and defines what instance of BorderFactory is used in the scripts. The choice of prototype affects the appearance of the border and the factory configuration possibilities.

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

Name Script Class Description
Empty EmptyBorderFactory Empty border factory
Line LineBorderFactory Line border
Bevel BevelBorderFactory Two-color bevelled border
Etched EtchedBorderFactory Two-color etched border
CanvasCreator CanvasCreatorBorderFactory Border drawn by a canvas creator. Make sure the used canvas creator does not fill the center since it is laid over the widget

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

This example defines a border factory based on the Line prototype.

<border parameter='ParameterName' type='Line'>
   <color parameter='color' r='1' g='0.5' b='0'/>
</border>

If you modify an existing border factory the type of the original border factory is taken over. This example creates a border factory by loading it from a file and then replaces the color.

<border parameter='ParameterName' extend='sharedBorder.border.xml'>
   <color parameter='color' r='0' g='0.5' b='1'/>
</border>

Border Factory Parameters

Border 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 border factory type are listed below.

Empty

The most basic border factory drawing no border yet still occupies space. It is used to create empty borders around widgets simulating margins without altering layout managers used. Creates an instance of the EmptyBorderFactory script class.

These parameters can be used:

Parameter Name Supported parameter type Description
size BorderSize Amount of empty space around the widget

Line

Creates a border factory drawing a line around the widget. Creates an instance of the LineBorderFactory script class. This border adds a size of thickness rounded down to the next integer value around the widget.

These additional parameters compared to Empty type can be used:

Parameter Name Supported parameter type Description
color Color Color to use for the line around the widget
thickness Floating Point Thickness in pixels of the line. Default is 1px width.

Bevel

Creates a border factory drawing a bevelled rectangle around the widget. Creates an instance of the BevelBorderFactory script class. This border adds a size of 1 pixel around the widget.

These additional parameters compared to Empty type can be used:

Parameter Name Supported parameter type Description
colorHilight Color Color to use for the hilight part of the outline
colorShadow Color Color to use for the shadow part of the outline

Etched

Creates a border factory drawing an etched rectangle around the widget. Creates an instance of the EtchedBorderFactory script class. This border adds a size of 2 pixels around the widget.

These additional parameters compared to Empty type can be used:

Parameter Name Supported parameter type Description
colorHilight Color Color to use for the hilight part of the outline
colorShadow Color Color to use for the shadow part of the outline

CanvasCreator

Creates a border factory using a canvas creator. The canvas creator should not draw the center since borders are laid over the widget. Creates an instance of the CanvasCreatorBorderFactory script class. Make sure to always set the right size parameter. This parameter defines the amount of space reserved around the widget for the border to draw. Inside this area no border should draw anything since it overlays the widget unless you want special effects like an ice-like border transparently covering parts of the widget for show.

These additional parameters compared to Empty type can be used:

Parameter Name Supported parameter type Description
canvasCreator CanvasCreator Canvas creator to use. Best used are size adjustable canvas creators
size BorderSize Amount of space reserved around the widget to draw the border
You could leave a comment if you were logged in.
dragengine/modules/dragonscript/xmlguitheme/borderfactory.txt · Last modified: 2024/03/14 16:35 by dragonlord