[[:start|Start Page]] >> [[dragengine:modules:dragonscript:main|DragonScript Scripting Language]] >> [[dragengine:modules:dragonscript:guitheme|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 #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1Borders_1_1Factories_1_1BorderFactories.html,BorderFactories~@# script class: ^ Name ^ Script Class ^ Description ^ | [[#empty|Empty]] | #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1Borders_1_1Factories_1_1EmptyBorderFactory.html,EmptyBorderFactory~@# | Empty border factory | | [[#line|Line]] | #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1Borders_1_1Factories_1_1LineBorderFactory.html,LineBorderFactory~@# | Line border | | [[#bevel|Bevel]] | #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1Borders_1_1Factories_1_1BevelBorderFactory.html,BevelBorderFactory~@# | Two-color bevelled border | | [[#etched|Etched]] | #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1Borders_1_1Factories_1_1EtchedBorderFactory.html,EtchedBorderFactory~@# | Two-color etched border | | [[#canvascreator|CanvasCreator]] | #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1Borders_1_1Factories_1_1CanvasCreatorBorderFactory.html,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 #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1Borders_1_1Factories_1_1BorderFactories.html,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. 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 Factory Parameters ====== Border 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 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 #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1Borders_1_1Factories_1_1EmptyBorderFactory.html,EmptyBorderFactory~@# script class. These parameters can be used: ^ Parameter Name ^ Supported parameter type ^ Description ^ | size | [[dragengine:modules:dragonscript:xmlguitheme:parameters#bordersize|BorderSize]] | Amount of empty space around the widget | ===== Line ===== Creates a border factory drawing a line around the widget. Creates an instance of the #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1Borders_1_1Factories_1_1LineBorderFactory.html,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 | [[dragengine:modules:dragonscript:xmlguitheme:parameters#color|Color]] | Color to use for the line around the widget | | thickness | [[dragengine:modules:dragonscript:xmlguitheme:parameters#floating_point|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 #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1Borders_1_1Factories_1_1BevelBorderFactory.html,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 | [[dragengine:modules:dragonscript:xmlguitheme:parameters#color|Color]] | Color to use for the hilight part of the outline | | colorShadow | [[dragengine:modules:dragonscript:xmlguitheme:parameters#color|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 #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1Borders_1_1Factories_1_1EtchedBorderFactory.html,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 | [[dragengine:modules:dragonscript:xmlguitheme:parameters#color|Color]] | Color to use for the hilight part of the outline | | colorShadow | [[dragengine:modules:dragonscript:xmlguitheme:parameters#color|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 #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1Borders_1_1Factories_1_1CanvasCreatorBorderFactory.html,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 | [[dragengine:modules:dragonscript:xmlguitheme:parameters#canvas_creator|CanvasCreator]] | Canvas creator to use. Best used are size adjustable canvas creators | | size | [[dragengine:modules:dragonscript:xmlguitheme:parameters#bordersize|BorderSize]] | Amount of space reserved around the widget to draw the border |