Difference between revisions of "GUIWidgetDefinitionWML"

From The Battle for Wesnoth Wiki
(Scrollbar Panel: Use description from old duplicate section)
 
(37 intermediate revisions by 4 users not shown)
Line 4: Line 4:
 
following fields.
 
following fields.
  
{| border="1"
+
{| class="wikitable"
 
!key
 
!key
 
!type
 
!type
Line 26: Line 26:
 
|}
 
|}
  
== Scrollbar Panel ==
+
== Viewport ==
Visible container to hold multiple widgets.
+
A viewport is an special widget used to view only a part of the widget it 'holds'.
 +
 
 +
== Combobox ==
 +
The definition of an editable combobox.
 +
 
 +
The resolution for a combobox also contains the following keys:
 +
 
 +
{| class="wikitable"
 +
!key !!type !!default !!description
 +
|-
 +
| text_x_offset || [[GUIVariable#f_unsigned|f_unsigned]] || "" || The x offset of the text in the text box. This is needed for the code to determine where in the text the mouse clicks, so it can set the cursor properly.
 +
|-
 +
| text_y_offset || [[GUIVariable#f_unsigned|f_unsigned]] || "" || The y offset of the text in the text box.
 +
|}
 +
 
 +
The following states exist:
 +
* '''state_enabled''' : the combobox is enabled.
 +
* '''state_disabled''' : the combobox is disabled.
 +
* '''state_focussed''' : the combobox has the focus of the keyboard.
 +
 
 +
== Multiline Text ==
 +
Base class for a multiline text area.
 +
 
 +
The resolution for a text box also contains the following keys:
 +
{| class="wikitable"
 +
!key
 +
!type
 +
!default
 +
!description
 +
|-
 +
| text_x_offset
 +
| [[GUIVariable#f_unsigned|f_unsigned]]
 +
| ""
 +
| The x offset of the text in the text box. This is needed for the code to determine where in the text the mouse clicks, so it can set the cursor properly.
 +
|-
 +
| text_y_offset
 +
| [[GUIVariable#f_unsigned|f_unsigned]]
 +
| ""
 +
| The y offset of the text in the text box.
 +
|}
  
This widget can draw items beyond the widgets it holds and in front of them. A panel is always active so these functions return dummy values.
+
The following states exist:
 +
* state_enabled - the text box is enabled.
 +
* state_disabled - the text box is disabled.
 +
* state_focussed - the text box has the focus of the keyboard.
  
A panel is a container holding other elements in its grid. It uses the states as layers to draw on.
+
== Scroll Text ==
 +
Scrollable text area
  
The following layers exist:
+
A multiline text area that shows a scrollbar if the text gets too long.
* background - the background of the panel.
 
* foreground - the foreground of the panel.
 
  
{| border="1"
+
{| class="wikitable"
 
!key
 
!key
 
!type
 
!type
Line 49: Line 90:
 
|}
 
|}
  
{| border="1"
+
TODO: we need one definition for a vertical scrollbar since this is the second time we use it.
 +
 
 +
{| class="wikitable"
 
!key
 
!key
 
!type
 
!type
Line 55: Line 98:
 
!description
 
!description
 
|-
 
|-
| vertical_scrollbar_mode
+
| _content_grid
| [[GUIVariable#scrollbar_mode|scrollbar_mode]]
+
| [[GUIVariable#grid|grid]]
| initial_auto
+
| mandatory
| Determines whether or not to show the scrollbar.
+
| A grid which should only contain one multiline_text widget.
 
|-
 
|-
| horizontal_scrollbar_mode
+
| _scrollbar_grid
| [[GUIVariable#scrollbar_mode|scrollbar_mode]]
+
| [[GUIVariable#grid|grid]]
| initial_auto
+
| mandatory
| Determines whether or not to show the scrollbar.
+
| A grid for the scrollbar (Merge with listbox info.)
 +
|}
 +
 
 +
Description of necessary widgets contained inside _content_grid:
 +
 
 +
{| class="wikitable"
 +
!key
 +
!type
 +
!default
 +
!description
 
|-
 
|-
| definition
+
| _text
| [[GUIVariable#section|section]]
+
| [[GUIVariable#text_box|text_box]]
 
| mandatory
 
| mandatory
| This defines how a scrollbar_panel item looks. It must contain the grid definition for 1 row of the list.
+
| The text_box that shows the value.
 
|}
 
|}
  
== Multimenu ==
+
The following states exist:
A multimenu_button is a styled_widget to choose an element from a list of elements.
+
* state_enabled - the scroll text is enabled.
 +
* state_disabled - the scroll text is disabled.
 +
 
 +
== Size Lock ==
 +
A fixed-size widget that wraps an arbitrary widget and forces it to the given size.
  
When a multimenu_button has a return value it sets the return value for the window. Normally this closes the window and returns this value to the caller. The return value can either be defined by the user or determined from the id of the multimenu_button. The return value has a higher precedence as the one defined by the id. (Of course it's weird to give a multimenu_button an id and then override its return value.)
+
A size lock contains one child widget and forces it to have the specified size. This can be used, for example, when there are two list boxes in different rows of the same grid and it's desired that only one list box changes size when its contents change.
  
When the multimenu_button doesn't have a standard id, but you still want to use the return value of that id, use return_value_id instead. This has a higher precedence as return_value.
+
A size lock has no states.
  
List with the multimenu_button specific variables:
+
{| class="wikitable"
{| border="1"
 
 
!key
 
!key
 
!type
 
!type
Line 85: Line 140:
 
!description
 
!description
 
|-
 
|-
| return_value_id
+
| widget
 +
| [[GUIVariable#section|section]]
 +
| mandatory
 +
| The widget.
 +
|-
 +
| width
 +
| [[GUIVariable#f_unsigned|f_unsigned]]
 +
| mandatory
 +
| The width of the widget.
 +
|-
 +
| height
 +
| [[GUIVariable#f_unsigned|f_unsigned]]
 +
| mandatory
 +
| The height of the widget.
 +
|}
 +
 
 +
== Styled Widget ==
 +
Base class for all visible items.
 +
 
 +
All widgets placed in a cell of a grid have some values in common:
 +
{| class="wikitable"
 +
!key
 +
!type
 +
!default
 +
!description
 +
|-
 +
| id
 +
| [[GUIVariable#string|string]]
 +
| ""
 +
| This value is used for the engine to identify 'special' items. This means that for example a text_box can get the proper initial value. This value should be unique or empty. Those special values are documented at the window definition that uses them. NOTE: items starting with an underscore are used for composed widgets and these should be unique per composed widget.
 +
|-
 +
| definition
 +
| [[GUIVariable#string|string]]
 +
| "default"
 +
| The id of the widget definition to use. This way it's possible to select a specific version of the widget e.g. a title label when the label is used as title.
 +
|-
 +
| linked_group
 
| [[GUIVariable#string|string]]
 
| [[GUIVariable#string|string]]
 
| ""
 
| ""
| The return value id.
+
| The linked group the control belongs to.
 
|-
 
|-
| return_value
+
| label
| [[GUIVariable#int|int]]
+
| [[GUIVariable#t_string|t_string]]
 +
| ""
 +
| Most widgets have some text associated with them, this field contain the value of that text. Some widgets use this value for other purposes, this is documented at the widget. E.g. an image uses the filename in this field.
 +
|-
 +
| tooltip
 +
| [[GUIVariable#t_string|t_string]]
 +
| ""
 +
| If you hover over a widget a while (the time it takes can differ per widget) a short help can show up.This defines the text of that message. This field may not be empty when 'help' is set.
 +
|-
 +
| help
 +
| [[GUIVariable#t_string|t_string]]
 +
| ""
 +
| If you hover over a widget and press F10 (or the key the user defined for the help tip) a help message can show up. This help message might be the same as the tooltip but in general (if used) this message should show more help. This defines the text of that message.
 +
|-
 +
| use_tooltip_on_label_overflow
 +
| [[GUIVariable#bool|bool]]
 +
| true
 +
| If the text on the label is truncated and the tooltip is empty the label can be used for the tooltip. If this variable is set to true this will happen.
 +
|-
 +
| debug_border_mode
 +
| [[GUIVariable#unsigned|unsigned]]
 
| 0
 
| 0
| The return value.
+
| The mode for showing the debug border. This border shows the area reserved for a widget. This function is only meant for debugging and might not be available in all Wesnoth binaries. Available modes:<ul><li>0 - no border</li><li>1 - 1 pixel border</li><li>2 - floodfill the widget area</li></ul>
 +
|-
 +
| debug_border_color
 +
| [[GUIVariable#color|color]]
 +
| ""
 +
| The color of the debug border.
 +
|-
 +
| size_text
 +
| [[GUIVariable#t_string|t_string]]
 +
| ""
 +
| Sets the minimum width of the widget depending on the text in it. (Note: not implemented yet.)
 +
|}
 +
 
 +
== Matrix ==
 +
 
 +
== Scroll Label ==
 +
This version shows a scrollbar if the text gets too long and has some scrolling features. In general this widget is slower as the normal label so the normal label should be preferred.
 +
 
 +
{| class="wikitable"
 +
!key
 +
!type
 +
!default
 +
!description
 +
|-
 +
| grid
 +
| [[GUIVariable#grid|grid]]
 +
| mandatory
 +
| A grid containing the widgets for main widget.
 +
|}
 +
 
 +
TODO: we need one definition for a vertical scrollbar since this is the second time we use it.
 +
 
 +
{| class="wikitable"
 +
!key
 +
!type
 +
!default
 +
!description
 
|-
 
|-
| maximum_shown
+
| _content_grid
| [[GUIVariable#int|int]]
+
| [[GUIVariable#grid|grid]]
| -1
+
| mandatory
| The maximum number of currently selected values to list on the button.
+
| A grid which should only contain one label widget.
 +
|-
 +
| _scrollbar_grid
 +
| [[GUIVariable#grid|grid]]
 +
| mandatory
 +
| A grid for the scrollbar (Merge with listbox info.)
 
|}
 
|}
  
 
The following states exist:
 
The following states exist:
* state_enabled, the multimenu_button is enabled.
+
* state_enabled - the menu_button is enabled.
* state_disabled, the multimenu_button is disabled.
+
* state_disabled - the menu_button is disabled.
* state_pressed, the left mouse multimenu_button is down.
 
* state_focussed, the mouse is over the multimenu_button.
 
  
== Button ==
+
== Menu Button ==
A button is a control that can be pushed to start an action or close a dialog.
+
A menu_button is a styled_widget to choose an element from a list of elements.
 +
 
 +
When a menu_button has a return value it sets the return value for the window. Normally this closes the window and returns this value to the caller. The return value can either be defined by the user or determined from the id of the menu_button. The return value has a higher precedence as the one defined by the id. (Of course it's weird to give a menu_button an id and then override its return value.)
  
When a button has a return value it sets the return value for the window. Normally this closes the window and returns this value to the caller. The return value can either be defined by the user or determined from the id of the button. The return value has a higher precedence as the one defined by the id. (Of course it's weird to give a button an id and then override its return value.)
+
When the menu_button doesn't have a standard id, but you still want to use the return value of that id, use return_value_id instead. This has a higher precedence as return_value.
  
When the button doesn't have a standard id, but you still want to use the return value of that id, use return_value_id instead. This has a higher precedence as return_value.
+
The following states exist:
 +
* state_enabled - the menu_button is enabled.
 +
* state_disabled - the menu_button is disabled.
 +
* state_pressed - the left mouse menu_button is down.
 +
* state_focused - the mouse is over the menu_button.
  
List with the button specific variables:
+
== Password Box ==
{| border="1"
+
{| class="wikitable"
 
!key
 
!key
 
!type
 
!type
Line 121: Line 277:
 
!description
 
!description
 
|-
 
|-
| return_value_id
+
| label
| [[GUIVariable#string|string]]
+
| [[GUIVariable#t_string|t_string]]
 
| ""
 
| ""
| The return value id.
+
| The initial text of the password box.
 +
|}
 +
 
 +
== Spinner ==
 +
A widget with a text_box and two button (named _prev and _next) that allows user to increase or decrease the numeric value inside the text_box. Non-numeric values are considered as zero.
 +
 
 +
{| class="wikitable"
 +
!key
 +
!type
 +
!default
 +
!description
 +
|-
 +
| grid
 +
| [[GUIVariable#grid|grid]]
 +
| mandatory
 +
| A grid containing the widgets for main widget.
 +
|}
 +
 
 +
TODO: we need one definition for a vertical scrollbar since this is the second time we use it.
 +
 
 +
{| class="wikitable"
 +
!key
 +
!type
 +
!default
 +
!description
 +
|-
 +
| _content_grid
 +
| [[GUIVariable#grid|grid]]
 +
| mandatory
 +
| A grid which should contain a text_box and two buttons.
 +
|}
 +
 
 +
Description of necessary widgets contained inside _content_grid :
 +
{| class="wikitable"
 +
!key
 +
!type
 +
!default
 +
!description
 +
|-
 +
| _text
 +
| [[GUIVariable#text_box|text_box]]
 +
| mandatory
 +
| The text_box that shows the value.
 +
|-
 +
| _prev
 +
| [[GUIVariable#button|button]]
 +
| mandatory
 +
| The previous button, clicking on it decreases value by 1.
 
|-
 
|-
| return_value
+
| _next
| [[GUIVariable#int|int]]
+
| [[GUIVariable#button|button]]
| 0
+
| mandatory
| The return value.
+
| The next button, clicking on it increases value by 1.
 +
|}
 +
 
 +
The following states exist:
 +
* state_enabled - the spinner is enabled.
 +
* state_disabled - the spinner is disabled.
 +
 
 +
== Scrollbar Panel ==
 +
The definition of a panel with scrollbars. A panel is a container holding
 +
other elements in its grid. A panel is always enabled and can't be
 +
disabled. Instead it uses the states as layers to draw on.
 +
 
 +
The following layers exist:
 +
* background - the background of the panel.
 +
* foreground - the foreground of the panel.
 +
 
 +
{| class="wikitable"
 +
!key
 +
!type
 +
!default
 +
!description
 +
|-
 +
| grid
 +
| [[GUIVariable#grid|grid]]
 +
| mandatory
 +
| A grid containing the widgets for main widget.
 +
|}
 +
 
 +
 
 +
{| class="wikitable"
 +
!key
 +
!type
 +
!default
 +
!description
 +
|-
 +
| vertical_scrollbar_mode
 +
| [[GUIVariable#scrollbar_mode|scrollbar_mode]]
 +
| initial_auto
 +
| Determines whether or not to show the scrollbar.
 +
|-
 +
| horizontal_scrollbar_mode
 +
| [[GUIVariable#scrollbar_mode|scrollbar_mode]]
 +
| initial_auto
 +
| Determines whether or not to show the scrollbar.
 +
|-
 +
| definition
 +
| [[GUIVariable#section|section]]
 +
| mandatory
 +
| This defines how a scrollbar_panel item looks. It must contain the grid definition for 1 row of the list.
 
|}
 
|}
 +
 +
== Multimenu Button ==
 +
A multimenu button is a widget to choose one or more elements from a list of elements.
 +
 +
When a multimenu button has a return value it sets the return value for the window. Normally this closes the window and returns this value to the caller. The return value can either be defined by the user or determined from the id of the multimenu button. The return value has a higher precedence as the one defined by the id. (Of course it's weird to give a multimenu button an id and then override its return value.)
 +
 +
When the multimenu button doesn't have a standard id, but you still want to use the return value of that id, use return_value_id instead. This has a higher precedence as return_value.
 +
 +
The following states exist:
 +
* '''state_enabled''': the multimenu_button is enabled.
 +
* '''state_disabled''': the multimenu_button is disabled.
 +
* '''state_pressed''': the left mouse multimenu_button is down.
 +
* '''state_focussed''': the mouse is over the multimenu_button.
 +
 +
== Button ==
 +
A button is a control that can be pushed to start an action or close a dialog.
 +
 +
When a button has a return value it sets the return value for the window. Normally this closes the window and returns this value to the caller. The return value can either be defined by the user or determined from the id of the button. The return value has a higher precedence as the one defined by the id. (Of course it's weird to give a button an id and then override its return value.)
 +
 +
When the button doesn't have a standard id, but you still want to use the return value of that id, use return_value_id instead. This has a higher precedence as return_value.
  
 
The following states exist:
 
The following states exist:
Line 157: Line 428:
 
* toggle_button
 
* toggle_button
 
* toggle_panel
 
* toggle_panel
 
List with the listbox specific variables:
 
{| border="1"
 
!ID (return value)
 
!Type
 
!Mandatory
 
!Description
 
|-
 
| vertical_scrollbar_mode
 
| [[GUIToolkitWML#scrollbar_mode|scrollbar_mode]]
 
| initial_auto
 
| Determines whether or not to show the scrollbar.
 
|-
 
| horizontal_scrollbar_mode
 
| [[GUIToolkitWML#scrollbar_mode|scrollbar_mode]]
 
| initial_auto
 
| Determines whether or not to show the scrollbar.
 
|-
 
| header
 
| [[GUIToolkitWML#grid|grid]]
 
| []
 
| Defines the grid for the optional header. (This grid will automatically get the id _header_grid.)
 
|-
 
| footer
 
| [[GUIToolkitWML#grid|grid]]
 
| []
 
| Defines the grid for the optional footer. (This grid will automatically get the id _footer_grid.)
 
|-
 
| list_definition
 
| [[GUIToolkitWML#section|section]]
 
| mandatory
 
| This defines how a listbox item looks. It must contain the grid definition for 1 row of the list.
 
|-
 
| list_data
 
| [[GUIToolkitWML#section|section]]
 
| []
 
| A grid alike section which stores the initial data for the listbox. Every row must have the same number of columns as the 'list_definition'.
 
|-
 
| has_minimum
 
| [[GUIToolkitWML#bool|bool]]
 
| true
 
| If false, less than one row can be selected.
 
|-
 
| has_maximum
 
| [[GUIToolkitWML#bool|bool]]
 
| true
 
| If false, more than one row can be selected.
 
|}
 
  
 
== Grid Listbox ==
 
== Grid Listbox ==
Line 213: Line 436:
 
* toggle_button
 
* toggle_button
 
* toggle_panel
 
* toggle_panel
 
List with the listbox specific variables:
 
{| border="1"
 
!ID (return value)
 
!Type
 
!Mandatory
 
!Description
 
|-
 
| vertical_scrollbar_mode
 
| [[GUIToolkitWML#scrollbar_mode|scrollbar_mode]]
 
| initial_auto
 
| Determines whether or not to show the scrollbar.
 
|-
 
| horizontal_scrollbar_mode
 
| [[GUIToolkitWML#scrollbar_mode|scrollbar_mode]]
 
| initial_auto
 
| Determines whether or not to show the scrollbar.
 
|-
 
| header
 
| [[GUIToolkitWML#grid|grid]]
 
| []
 
| Defines the grid for the optional header. (This grid will automatically get the id _header_grid.)
 
|-
 
| footer
 
| [[GUIToolkitWML#grid|grid]]
 
| []
 
| Defines the grid for the optional footer. (This grid will automatically get the id _footer_grid.)
 
|-
 
| list_definition
 
| [[GUIToolkitWML#section|section]]
 
| mandatory
 
| This defines how a listbox item looks. It must contain the grid definition for 1 row of the list.
 
|-
 
| list_data
 
| [[GUIToolkitWML#section|section]]
 
| []
 
| A grid alike section which stores the initial data for the listbox. Every row must have the same number of columns as the 'list_definition'.
 
|-
 
| has_minimum
 
| [[GUIToolkitWML#bool|bool]]
 
| true
 
| If false, less than one row can be selected.
 
|-
 
| has_maximum
 
| [[GUIToolkitWML#bool|bool]]
 
| true
 
| If false, more than one row can be selected.
 
|}
 
  
 
== Image ==
 
== Image ==
Line 273: Line 448:
  
 
== Label ==
 
== Label ==
A label displays a text, the text can be wrapped but no scrollbars are provided.
+
A label displays text that can be wrapped but no scrollbars are provided.
  
Although the label itself has no event interaction it still has two states.
+
A label has two states because labels are often used as visual indication of the state of the widget it labels.
The reason is that labels are often used as visual indication of the state
 
of the widget it labels.
 
 
 
Note: The above is outdated, if "link_aware" is enabled then there is interaction.
 
  
 
The following states exist:
 
The following states exist:
Line 285: Line 456:
 
* state_disabled, the label is disabled.
 
* state_disabled, the label is disabled.
  
{| border="1"
+
{| class="wikitable"
 
!key
 
!key
 
!type
 
!type
Line 295: Line 466:
 
| #ffff00
 
| #ffff00
 
| The color to render links with. This string will be used verbatim in pango markup for each link.
 
| The color to render links with. This string will be used verbatim in pango markup for each link.
|}
 
 
The label specific variables:
 
{| border="1"
 
!key
 
!type
 
!default
 
!description
 
|-
 
| wrap
 
| [[GUIVariable#bool|bool]]
 
| #ffff00
 
| Is wrapping enabled for the label.
 
|-
 
| characters_per_line
 
| [[GUIVariable#unsigned|unsigned]]
 
| #ffff00
 
| Sets the maximum number of characters per line. The amount is an approximate since the width of a character differs. E.g. iii is smaller than MMM. When the value is non-zero it also implies can_wrap is true. When having long strings wrapping them can increase readability, often 66 characters per line is considered the optimum for a one column text.
 
|-
 
| text_alignment
 
| [[GUIVariable#h_align|h_align]]
 
| #ffff00
 
| The way the text is aligned inside the canvas.
 
|-
 
| can_shrink
 
| [[GUIVariable#bool|bool]]
 
| #ffff00
 
| Whether the label can shrink past its optimal size.
 
|-
 
| link_aware
 
| [[GUIVariable#bool|bool]]
 
| #ffff00
 
| Whether the label is link aware. This means it is rendered with links highlighted, and responds to click events on those links.
 
 
|}
 
|}
  
Line 337: Line 475:
 
The resolution for a listbox also contains the following keys:
 
The resolution for a listbox also contains the following keys:
  
{| border="1"
+
{| class="wikitable"
 
!key
 
!key
 
!type
 
!type
Line 348: Line 486:
 
| A grid containing the widgets for the scrollbar. The scrollbar has some special widgets so it can make default behavior for certain widgets.
 
| A grid containing the widgets for the scrollbar. The scrollbar has some special widgets so it can make default behavior for certain widgets.
 
|}
 
|}
{| border="1"
+
{| class="wikitable"
 
!ID (return value)
 
!ID (return value)
 
!Type
 
!Type
Line 406: Line 544:
 
* state_enabled, the listbox is enabled.
 
* state_enabled, the listbox is enabled.
 
* state_disabled, the listbox is disabled.
 
* state_disabled, the listbox is disabled.
 
List with the listbox specific variables:
 
{| border="1"
 
!ID (return value)
 
!Type
 
!Mandatory
 
!Description
 
|-
 
| vertical_scrollbar_mode
 
| [[GUIToolkitWML#scrollbar_mode|scrollbar_mode]]
 
| initial_auto
 
| Determines whether or not to show the scrollbar.
 
|-
 
| horizontal_scrollbar_mode
 
| [[GUIToolkitWML#scrollbar_mode|scrollbar_mode]]
 
| initial_auto
 
| Determines whether or not to show the scrollbar.
 
|-
 
| header
 
| [[GUIToolkitWML#grid|grid]]
 
| []
 
| Defines the grid for the optional header. (This grid will automatically get the id _header_grid.)
 
|-
 
| footer
 
| [[GUIToolkitWML#grid|grid]]
 
| []
 
| Defines the grid for the optional footer. (This grid will automatically get the id _footer_grid.)
 
|-
 
| list_definition
 
| [[GUIToolkitWML#section|section]]
 
| mandatory
 
| This defines how a listbox item looks. It must contain the grid definition for 1 row of the list.
 
|-
 
| list_data
 
| [[GUIToolkitWML#section|section]]
 
| []
 
| A grid alike section which stores the initial data for the listbox. Every row must have the same number of columns as the 'list_definition'.
 
|-
 
| has_minimum
 
| [[GUIToolkitWML#bool|bool]]
 
| true
 
| If false, less than one row can be selected.
 
|-
 
| has_maximum
 
| [[GUIToolkitWML#bool|bool]]
 
| true
 
| If false, more than one row can be selected.
 
|}
 
  
 
== Minimap ==
 
== Minimap ==
Line 464: Line 554:
 
A multi page is a control that contains several 'pages' of which only one is visible. The pages can contain the same widgets containing the same 'kind' of data or look completely different.
 
A multi page is a control that contains several 'pages' of which only one is visible. The pages can contain the same widgets containing the same 'kind' of data or look completely different.
  
{| border="1"
+
{| class="wikitable"
 
!key
 
!key
 
!type
 
!type
Line 477: Line 567:
  
 
A multipage has no states.
 
A multipage has no states.
 
A multipage has no states. List with the multi page specific variables:
 
{| border="1"
 
!key
 
!type
 
!default
 
!description
 
|-
 
| page_definition
 
| [[GUIVariable#section|section]]
 
| mandatory
 
| This defines how a multi page item looks. It must contain the grid definition for at least one page.
 
|-
 
| page_data
 
| [[GUIVariable#section|section]]
 
| []
 
| A grid alike section which stores the initial data for the multi page. Every row must have the same number of columns as the 'page_definition'.
 
|}
 
  
 
== Panel ==
 
== Panel ==
Line 503: Line 575:
  
 
The resolution for a panel also contains the following keys:
 
The resolution for a panel also contains the following keys:
{| border="1"
+
{| class="wikitable"
 
!key
 
!key
 
!type
 
!type
Line 558: Line 630:
 
when the scrollbar is required (or expected to become required).
 
when the scrollbar is required (or expected to become required).
  
{| border="1"
+
{| class="wikitable"
 
!key
 
!key
 
!type
 
!type
Line 573: Line 645:
 
time we use it.
 
time we use it.
  
{| border="1"
+
{| class="wikitable"
 
!ID (return value)
 
!ID (return value)
 
!Type
 
!Type
Line 593: Line 665:
 
* state_enabled, the scroll label is enabled.
 
* state_enabled, the scroll label is enabled.
 
* state_disabled, the scroll label is disabled.
 
* state_disabled, the scroll label is disabled.
 
== Scrollbar panel ==
 
The definition of a panel with scrollbars. A panel is a container holding
 
other elements in its grid. A panel is always enabled and can't be
 
disabled. Instead it uses the states as layers to draw on.
 
 
{| border="1"
 
!key
 
!type
 
!default
 
!description
 
|-
 
| grid
 
| [[GUIVariable#grid|grid]]
 
| mandatory
 
| A grid containing the widgets for main widget.
 
|}
 
The following layers exist:
 
* background, the background of the panel.
 
* foreground, the foreground of the panel.
 
  
 
== Slider ==
 
== Slider ==
 
A slider is a control that can select a value by moving a grip on a groove.
 
A slider is a control that can select a value by moving a grip on a groove.
  
{| border="1"
+
{| class="wikitable"
 
!key
 
!key
 
!type
 
!type
Line 642: Line 694:
 
| 0
 
| 0
 
| The number of pixels at the right side which can't be used by the positioner.
 
| The number of pixels at the right side which can't be used by the positioner.
|}
 
 
Variables:
 
{| border="1"
 
!key
 
!type
 
!default
 
!description
 
|-
 
| best_slider_length
 
| [[GUIVariable#unsigned|unsigned]]
 
| mandatory
 
| The best length for the sliding part.
 
|-
 
| minimum_value
 
| [[GUIVariable#int|int]]
 
| 0
 
| The minimum value the slider can have.
 
|-
 
| maximum_value
 
| [[GUIVariable#int|int]]
 
| 0
 
| The maximum value the slider can have.
 
|-
 
| step_size
 
| [[GUIVariable#unsigned|unsigned]]
 
| 0
 
| The number of items the slider's value increases with one step.
 
|-
 
| value
 
| [[GUIVariable#int|int]]
 
| 0
 
| The value of the slider.
 
|-
 
| minimum_value_label
 
| [[GUIVariable#t_string|t_string]]
 
| 0
 
| If the minimum value is chosen there might be the need for a special value (eg off). When this key has a value that value will be shown if the minimum is selected.
 
|-
 
| maximum_value_label
 
| [[GUIVariable#t_string|t_string]]
 
| 0
 
| If the maximum value is chosen there might be the need for a special value (eg unlimited)). When this key has a value that value will be shown if the maximum is selected.
 
 
|}
 
|}
  
Line 698: Line 707:
 
Since every grid cell needs a widget this is a blank widget. This widget can also be used to 'force' sizes - if either the width or the height is non-zero the spacer functions as a fixed size spacer.
 
Since every grid cell needs a widget this is a blank widget. This widget can also be used to 'force' sizes - if either the width or the height is non-zero the spacer functions as a fixed size spacer.
  
{| border="1"
+
{| class="wikitable"
 
!key
 
!key
 
!type
 
!type
Line 722: Line 731:
  
 
A stacked widget has no states.
 
A stacked widget has no states.
 +
 +
== Tab Container ==
 +
A tabbed container that holds multiple pages, called tabs. The user can show any of those pages by clicking on a list containing names (optionally images) of the available tabs.
 +
 +
A tab container has no states.
  
 
== Text box ==
 
== Text box ==
Line 728: Line 742:
 
The resolution for a text box also contains the following keys:
 
The resolution for a text box also contains the following keys:
  
{| border="1"
+
{| class="wikitable"
 
!key
 
!key
 
!type
 
!type
Line 749: Line 763:
 
* state_disabled, the text box is disabled.
 
* state_disabled, the text box is disabled.
 
* state_focussed, the text box has the focus of the keyboard.
 
* state_focussed, the text box has the focus of the keyboard.
 
The following variables exist:
 
{| border="1"
 
!key
 
!type
 
!default
 
!description
 
|-
 
| label
 
| [[GUIVariable#t_string|t_string]]
 
| ""
 
| The initial text of the text box.
 
|-
 
| history
 
| [[GUIVariable#string|string]]
 
| ""
 
| The name of the history for the text box. A history saves the data entered in a text box between the games. With the up and down arrow it can be accessed. To create a new history item just add a new unique name for this field and the engine will handle the rest.
 
|}
 
  
 
== Toggle button ==
 
== Toggle button ==
Line 781: Line 777:
 
* state_disabled_selected, the panel is disabled and selected.
 
* state_disabled_selected, the panel is disabled and selected.
 
* state_focussed_selected, the mouse is over the panel and selected.
 
* state_focussed_selected, the mouse is over the panel and selected.
 
Variables:
 
{| border="1"
 
!key
 
!type
 
!default
 
!description
 
|-
 
| grid
 
| [[GUIVariable#grid|grid]]
 
| mandatory
 
| Defines the grid with the widgets to place on the panel.
 
|-
 
| return_value_id
 
| [[GUIVariable#string|string]]
 
| ""
 
| The return value id.
 
|-
 
| return_value
 
| [[GUIVariable#int|int]]
 
| 0
 
| The return value.
 
|}
 
  
 
== Toggle panel ==
 
== Toggle panel ==
Line 818: Line 791:
  
 
The resolution for a toggle panel also contains the following keys:
 
The resolution for a toggle panel also contains the following keys:
{| border="1"
+
{| class="wikitable"
 
!key
 
!key
 
!type
 
!type
Line 853: Line 826:
 
* state_disabled_selected, the panel is disabled and selected.
 
* state_disabled_selected, the panel is disabled and selected.
 
* state_focussed_selected, the mouse is over the panel and selected.
 
* state_focussed_selected, the mouse is over the panel and selected.
 
Variables:
 
{| border="1"
 
!key
 
!type
 
!default
 
!description
 
|-
 
| grid
 
| [[GUIVariable#grid|grid]]
 
| mandatory
 
| Defines the grid with the widgets to place on the panel.
 
|-
 
| return_value_id
 
| [[GUIVariable#string|string]]
 
| ""
 
| The return value id.
 
|-
 
| return_value
 
| [[GUIVariable#int|int]]
 
| 0
 
| The return value.
 
|}
 
  
 
== Tree view ==
 
== Tree view ==
Line 883: Line 833:
 
* state_enabled, the listbox is enabled.
 
* state_enabled, the listbox is enabled.
 
* state_disabled, the listbox is disabled.
 
* state_disabled, the listbox is disabled.
 
List with the tree view specific variables:
 
{| border="1"
 
!key
 
!type
 
!default
 
!description
 
|-
 
| vertical_scrollbar_mode
 
| [[GUIVariable#scrollbar_mode|scrollbar_mode]]
 
| initial_auto
 
| Determines whether or not to show the scrollbar.
 
|-
 
| horizontal_scrollbar_mode
 
| [[GUIVariable#scrollbar_mode|scrollbar_mode]]
 
| initial_auto
 
| Determines whether or not to show the scrollbar.
 
|-
 
| indention_step_size
 
| [[GUIVariable#unsigned|unsigned]]
 
| 0
 
| The number of pixels every level of nodes is indented from the previous level.
 
|-
 
| node
 
| [[GUIVariable#unsigned|unsigned]]
 
| mandatory
 
| The tree view can contain multiple node sections. This part needs more documentation.
 
|-
 
| id
 
| [[GUIVariable#unsigned|unsigned]]
 
| ""
 
| .
 
|-
 
| return_value_id
 
| [[GUIVariable#unsigned|unsigned]]
 
| ""
 
| .
 
|}
 
  
 
== Horizontal scrollbar ==
 
== Horizontal scrollbar ==
Line 927: Line 839:
 
The resolution for a horizontal scrollbar also contains the following keys:
 
The resolution for a horizontal scrollbar also contains the following keys:
  
{| border="1"
+
{| class="wikitable"
 
!key
 
!key
 
!type
 
!type
Line 966: Line 878:
 
The resolution for a vertical scrollbar also contains the following keys:
 
The resolution for a vertical scrollbar also contains the following keys:
  
{| border="1"
+
{| class="wikitable"
 
!key
 
!key
 
!type
 
!type
Line 999: Line 911:
  
 
== Window ==
 
== Window ==
Base class of top level items, the only item which needs to store the final canvases to draw on. The definition of a window. A window is a kind of panel see the panel for which fields exist
+
Base class of top level items, the only item which needs to store the final canvases to draw on. The definition of a window. A window is a kind of panel; see the [[#Panel|panel]] for which fields exist.
  
 
[[Category: WML Reference]]
 
[[Category: WML Reference]]
 
[[Category: GUI WML Reference]]
 
[[Category: GUI WML Reference]]

Latest revision as of 13:09, 25 October 2024

Widget definition

This page describes the definition of all widgets in the toolkit. Every widget has some parts in common, first of all; every definition has the following fields.

key type default description
id string mandatory Unique id for this gui (theme).
description t_string mandatory Unique translatable name for this gui.
resolution section mandatory The definitions of the widget in various resolutions.

Viewport

A viewport is an special widget used to view only a part of the widget it 'holds'.

Combobox

The definition of an editable combobox.

The resolution for a combobox also contains the following keys:

key type default description
text_x_offset f_unsigned "" The x offset of the text in the text box. This is needed for the code to determine where in the text the mouse clicks, so it can set the cursor properly.
text_y_offset f_unsigned "" The y offset of the text in the text box.

The following states exist:

  • state_enabled : the combobox is enabled.
  • state_disabled : the combobox is disabled.
  • state_focussed : the combobox has the focus of the keyboard.

Multiline Text

Base class for a multiline text area.

The resolution for a text box also contains the following keys:

key type default description
text_x_offset f_unsigned "" The x offset of the text in the text box. This is needed for the code to determine where in the text the mouse clicks, so it can set the cursor properly.
text_y_offset f_unsigned "" The y offset of the text in the text box.

The following states exist:

  • state_enabled - the text box is enabled.
  • state_disabled - the text box is disabled.
  • state_focussed - the text box has the focus of the keyboard.

Scroll Text

Scrollable text area

A multiline text area that shows a scrollbar if the text gets too long.

key type default description
grid grid mandatory A grid containing the widgets for main widget.

TODO: we need one definition for a vertical scrollbar since this is the second time we use it.

key type default description
_content_grid grid mandatory A grid which should only contain one multiline_text widget.
_scrollbar_grid grid mandatory A grid for the scrollbar (Merge with listbox info.)

Description of necessary widgets contained inside _content_grid:

key type default description
_text text_box mandatory The text_box that shows the value.

The following states exist:

  • state_enabled - the scroll text is enabled.
  • state_disabled - the scroll text is disabled.

Size Lock

A fixed-size widget that wraps an arbitrary widget and forces it to the given size.

A size lock contains one child widget and forces it to have the specified size. This can be used, for example, when there are two list boxes in different rows of the same grid and it's desired that only one list box changes size when its contents change.

A size lock has no states.

key type default description
widget section mandatory The widget.
width f_unsigned mandatory The width of the widget.
height f_unsigned mandatory The height of the widget.

Styled Widget

Base class for all visible items.

All widgets placed in a cell of a grid have some values in common:

key type default description
id string "" This value is used for the engine to identify 'special' items. This means that for example a text_box can get the proper initial value. This value should be unique or empty. Those special values are documented at the window definition that uses them. NOTE: items starting with an underscore are used for composed widgets and these should be unique per composed widget.
definition string "default" The id of the widget definition to use. This way it's possible to select a specific version of the widget e.g. a title label when the label is used as title.
linked_group string "" The linked group the control belongs to.
label t_string "" Most widgets have some text associated with them, this field contain the value of that text. Some widgets use this value for other purposes, this is documented at the widget. E.g. an image uses the filename in this field.
tooltip t_string "" If you hover over a widget a while (the time it takes can differ per widget) a short help can show up.This defines the text of that message. This field may not be empty when 'help' is set.
help t_string "" If you hover over a widget and press F10 (or the key the user defined for the help tip) a help message can show up. This help message might be the same as the tooltip but in general (if used) this message should show more help. This defines the text of that message.
use_tooltip_on_label_overflow bool true If the text on the label is truncated and the tooltip is empty the label can be used for the tooltip. If this variable is set to true this will happen.
debug_border_mode unsigned 0 The mode for showing the debug border. This border shows the area reserved for a widget. This function is only meant for debugging and might not be available in all Wesnoth binaries. Available modes:
  • 0 - no border
  • 1 - 1 pixel border
  • 2 - floodfill the widget area
debug_border_color color "" The color of the debug border.
size_text t_string "" Sets the minimum width of the widget depending on the text in it. (Note: not implemented yet.)

Matrix

Scroll Label

This version shows a scrollbar if the text gets too long and has some scrolling features. In general this widget is slower as the normal label so the normal label should be preferred.

key type default description
grid grid mandatory A grid containing the widgets for main widget.

TODO: we need one definition for a vertical scrollbar since this is the second time we use it.

key type default description
_content_grid grid mandatory A grid which should only contain one label widget.
_scrollbar_grid grid mandatory A grid for the scrollbar (Merge with listbox info.)

The following states exist:

  • state_enabled - the menu_button is enabled.
  • state_disabled - the menu_button is disabled.

Menu Button

A menu_button is a styled_widget to choose an element from a list of elements.

When a menu_button has a return value it sets the return value for the window. Normally this closes the window and returns this value to the caller. The return value can either be defined by the user or determined from the id of the menu_button. The return value has a higher precedence as the one defined by the id. (Of course it's weird to give a menu_button an id and then override its return value.)

When the menu_button doesn't have a standard id, but you still want to use the return value of that id, use return_value_id instead. This has a higher precedence as return_value.

The following states exist:

  • state_enabled - the menu_button is enabled.
  • state_disabled - the menu_button is disabled.
  • state_pressed - the left mouse menu_button is down.
  • state_focused - the mouse is over the menu_button.

Password Box

key type default description
label t_string "" The initial text of the password box.

Spinner

A widget with a text_box and two button (named _prev and _next) that allows user to increase or decrease the numeric value inside the text_box. Non-numeric values are considered as zero.

key type default description
grid grid mandatory A grid containing the widgets for main widget.

TODO: we need one definition for a vertical scrollbar since this is the second time we use it.

key type default description
_content_grid grid mandatory A grid which should contain a text_box and two buttons.

Description of necessary widgets contained inside _content_grid :

key type default description
_text text_box mandatory The text_box that shows the value.
_prev button mandatory The previous button, clicking on it decreases value by 1.
_next button mandatory The next button, clicking on it increases value by 1.

The following states exist:

  • state_enabled - the spinner is enabled.
  • state_disabled - the spinner is disabled.

Scrollbar Panel

The definition of a panel with scrollbars. A panel is a container holding other elements in its grid. A panel is always enabled and can't be disabled. Instead it uses the states as layers to draw on.

The following layers exist:

  • background - the background of the panel.
  • foreground - the foreground of the panel.
key type default description
grid grid mandatory A grid containing the widgets for main widget.


key type default description
vertical_scrollbar_mode scrollbar_mode initial_auto Determines whether or not to show the scrollbar.
horizontal_scrollbar_mode scrollbar_mode initial_auto Determines whether or not to show the scrollbar.
definition section mandatory This defines how a scrollbar_panel item looks. It must contain the grid definition for 1 row of the list.

Multimenu Button

A multimenu button is a widget to choose one or more elements from a list of elements.

When a multimenu button has a return value it sets the return value for the window. Normally this closes the window and returns this value to the caller. The return value can either be defined by the user or determined from the id of the multimenu button. The return value has a higher precedence as the one defined by the id. (Of course it's weird to give a multimenu button an id and then override its return value.)

When the multimenu button doesn't have a standard id, but you still want to use the return value of that id, use return_value_id instead. This has a higher precedence as return_value.

The following states exist:

  • state_enabled: the multimenu_button is enabled.
  • state_disabled: the multimenu_button is disabled.
  • state_pressed: the left mouse multimenu_button is down.
  • state_focussed: the mouse is over the multimenu_button.

Button

A button is a control that can be pushed to start an action or close a dialog.

When a button has a return value it sets the return value for the window. Normally this closes the window and returns this value to the caller. The return value can either be defined by the user or determined from the id of the button. The return value has a higher precedence as the one defined by the id. (Of course it's weird to give a button an id and then override its return value.)

When the button doesn't have a standard id, but you still want to use the return value of that id, use return_value_id instead. This has a higher precedence as return_value.

The following states exist:

  • state_enabled, the button is enabled.
  • state_disabled, the button is disabled.
  • state_pressed, the left mouse button is down.
  • state_focussed, the mouse is over the button.

Drawing

A drawing is widget with a fixed size and gives access to the canvas of the widget in the window instance. This allows special display only widgets.

The definition of a drawing. The widget normally has no event interaction so only one state is defined.

The following states exist:

  • state_enabled, the drawing is enabled. The state is a dummy since the things really drawn are placed in the window instance.

If either the width or the height is not zero the drawing functions as a fixed size drawing. The variables available are the same as for the window resolution.

Horizontal listbox

A horizontal listbox is a control that holds several items of the same type. Normally the items in a listbox are ordered in rows, this version orders them in columns instead. The definition of a horizontal listbox is the same as for a normal listbox.

In order to force widgets to be the same size inside a horizontal listbox, the widgets need to be inside a linked_group. Inside the list section there are only the following widgets allowed:

  • grid (to nest)
  • toggle_button
  • toggle_panel

Grid Listbox

A grid listbox is a styled_widget that holds several items of the same type. Normally the items in a listbox are ordered in rows, this version lays them out in a text-like flow instead.

In order to force widgets to be the same size inside a grid listbox, the widgets need to be inside a linked_group. In particular, to make the listbox actually be a grid, the linked group must synchronize both height and width. Inside the list section there are only the following widgets allowed:

  • grid (to nest)
  • toggle_button
  • toggle_panel

Image

An image shows a static image.

The definition of an image. The label field of the widget is used as the name of file to show. The widget normally has no event interaction so only one state is defined.

The following states exist:

  • state_enabled, the image is enabled.

Label

A label displays text that can be wrapped but no scrollbars are provided.

A label has two states because labels are often used as visual indication of the state of the widget it labels.

The following states exist:

  • state_enabled, the label is enabled.
  • state_disabled, the label is disabled.
key type default description
link_color string #ffff00 The color to render links with. This string will be used verbatim in pango markup for each link.

Listbox

A listbox is a control that holds several items of the same type. Normally the items in a listbox are ordered in rows, this version might allow more options for ordering the items in the future.

The definition of a listbox contains the definition of its scrollbar.

The resolution for a listbox also contains the following keys:

key type default description
scrollbar section mandatory A grid containing the widgets for the scrollbar. The scrollbar has some special widgets so it can make default behavior for certain widgets.
ID (return value) Type Mandatory Description
_begin clickable no Moves the position to the beginning of the list.
_line_up clickable no Move the position one item up. (NOTE if too many items to move per item it might be more items.)
_half_page_up clickable no Move the position half the number of the visible items up. (See note at _line_up.)
_page_up clickable no Move the position the number of visible items up. (See note at _line_up.)
_end clickable no Moves the position to the end of the list.
_line_down clickable no Move the position one item down.(See note at _line_up.)
_half_page_down clickable no Move the position half the number of the visible items down. (See note at _line_up.)
_page_down clickable no Move the position the number of visible items down. (See note at _line_up.)
_scrollbar vertical_scrollbar yes This is the scrollbar so the user can scroll through the list.

A clickable is one of:

  • button
  • repeating_button

The following states exist:

  • state_enabled, the listbox is enabled.
  • state_disabled, the listbox is disabled.

Minimap

A minimap to show the gamemap, this only shows the map and has no interaction options. This version is used for map previews, there will be a another version which allows interaction.

The following states exist:

  • state_enabled, the minimap is enabled.

Multi page

A multi page is a control that contains several 'pages' of which only one is visible. The pages can contain the same widgets containing the same 'kind' of data or look completely different.

key type default description
grid grid mandatory A grid containing the widgets for main widget.

A multipage has no states.

Panel

A panel is an item which can hold other items. The difference between a grid and a panel is that it's possible to define how a panel looks. A grid in an invisible container to just hold the items.

A panel is always enabled and can't be disabled. Instead it uses the states as layers to draw on.

The resolution for a panel also contains the following keys:

key type default description
top_border unsigned 0 The size which isn't used for the client area.
bottom_border unsigned 0 The size which isn't used for the client area.
left_border unsigned 0 The size which isn't used for the client area.
right_border unsigned 0 The size which isn't used for the client area.

The following layers exist:

  • background, the background of the panel.
  • foreground, the foreground of the panel.

Progress bar

A progress bar shows the progress of a certain object.

The definition of a progress bar. This object shows the progress of a certain action, or the value state of a certain item.

The following states exist:

  • state_enabled, the progress bar is enabled.

Repeating button

A repeating_button is a control that can be pushed down and repeat a certain action. Once the button is down every x milliseconds it is down a new down event is triggered.

The following states exist:

  • state_enabled, the repeating_button is enabled.
  • state_disabled, the repeating_button is disabled.
  • state_pressed, the left mouse repeating_button is down.
  • state_focussed, the mouse is over the repeating_button.

Scroll label

A scroll label is a label that wraps its text and also has a vertical scrollbar. This way a text can't be too long to be shown for this widget.

This widget is slower as a normal label widget so only use this widget when the scrollbar is required (or expected to become required).

key type default description
grid grid mandatory A grid containing the widgets for main widget.

TODO we need one definition for a vertical scrollbar since this is the second time we use it.

ID (return value) Type Mandatory Description
_content_grid grid yes A grid which should only contain one label widget.
_scrollbar_grid grid yes A grid for the scrollbar (Merge with listbox info.)

The following states exist:

  • state_enabled, the scroll label is enabled.
  • state_disabled, the scroll label is disabled.

Slider

A slider is a control that can select a value by moving a grip on a groove.

key type default description
minimum_positioner_length unsigned mandatory The minimum size the positioner is allowed to be. The engine needs to know this in order to calculate the best size for the positioner.
maximum_positioner_length unsigned 0 The maximum size the positioner is allowed to be. If minimum and maximum are the same value the positioner is fixed size. If the maximum is 0 (and the minimum not) there's no maximum.
left_offset unsigned 0 The number of pixels at the left side which can't be used by the positioner.
right_offset unsigned 0 The number of pixels at the right side which can't be used by the positioner.

The following states exist:

  • state_enabled, the slider is enabled.
  • state_disabled, the slider is disabled.
  • state_pressed, the left mouse button is down on the positioner of the slider.
  • state_focussed, the mouse is over the positioner of the slider.

Spacer

An empty widget to either fill in a widget since no empty items are allowed or to reserve a fixed space. Since we're a kind of dummy class we're always active, our drawing does nothing.

Since every grid cell needs a widget this is a blank widget. This widget can also be used to 'force' sizes - if either the width or the height is non-zero the spacer functions as a fixed size spacer.

key type default description
width f_unsigned 0 The width of the spacer.
height f_unsigned 0 The height of the spacer.

Stacked widget

A stacked widget holds several widgets on top of each other. This can be used for various effects; add an optional overlay to an image, stack it with a spacer to force a minimum size of a widget. The latter is handy to avoid making a separate definition for a single instance with a fixed size.

A stacked widget has no states.

Tab Container

A tabbed container that holds multiple pages, called tabs. The user can show any of those pages by clicking on a list containing names (optionally images) of the available tabs.

A tab container has no states.

Text box

The definition of a text box.

The resolution for a text box also contains the following keys:

key type default description
text_x_offset f_unsigned "" The x offset of the text in the text box. This is needed for the code to determine where in the text the mouse clicks, so it can set the cursor properly.
text_y_offset f_unsigned "" The y offset of the text in the text box.

The following states exist:

  • state_enabled, the text box is enabled.
  • state_disabled, the text box is disabled.
  • state_focussed, the text box has the focus of the keyboard.

Toggle button

The definition of a toggle button.

A toggle button is a button with two states 'up' and 'down' or 'selected' and 'deselected'. When the mouse is pressed on it the state changes.

The following states exist:

  • state_enabled, the panel is enabled and not selected.
  • state_disabled, the panel is disabled and not selected.
  • state_focussed, the mouse is over the panel and not selected.
  • state_enabled_selected, the panel is enabled and selected.
  • state_disabled_selected, the panel is disabled and selected.
  • state_focussed_selected, the mouse is over the panel and selected.

Toggle panel

The definition of a toggle panel.

Quite some code looks like toggle_button maybe we should inherit from that but let's test first. the problem is that the toggle_button has an icon we don't want, but maybe look at refactoring later. but maybe we should also ditch the icon, not sure however since it's handy for checkboxes...

A toggle panel is an item which can hold multiple other items. The difference between a grid and a panel is that it's possible to define how a panel looks. A grid in an invisible container to just hold the items. The toggle panel is a combination of the panel and a toggle button, it allows a toggle button with its own grid.

The resolution for a toggle panel also contains the following keys:

key type default description
top_border unsigned 0 The size which isn't used for the client area.
bottom_border unsigned 0 The size which isn't used for the client area.
left_border unsigned 0 The size which isn't used for the client area.
right_border unsigned 0 The size which isn't used for the client area.

The following states exist:

  • state_enabled, the panel is enabled and not selected.
  • state_disabled, the panel is disabled and not selected.
  • state_focussed, the mouse is over the panel and not selected.
  • state_enabled_selected, the panel is enabled and selected.
  • state_disabled_selected, the panel is disabled and selected.
  • state_focussed_selected, the mouse is over the panel and selected.

Tree view

A tree view is a control that holds several items of the same or different types. The items shown are called tree view nodes and when a node has children, these can be shown or hidden. Nodes that contain children need to provide a clickable button in order to fold or unfold the children.

The following states exist:

  • state_enabled, the listbox is enabled.
  • state_disabled, the listbox is disabled.

Horizontal scrollbar

A horizontal scrollbar is a widget that shows a horizontal scrollbar. This widget is most of the time used in a container to control the scrolling of its contents.

The resolution for a horizontal scrollbar also contains the following keys:

key type default description
minimum_positioner_length unsigned mandatory The minimum size the positioner is allowed to be. The engine needs to know this in order to calculate the best size for the positioner.
maximum_positioner_length unsigned 0 The maximum size the positioner is allowed to be. If minimum and maximum are the same value the positioner is fixed size. If the maximum is 0 (and the minimum not) there's no maximum.
left_offset unsigned 0 The number of pixels at the left which can't be used by the positioner.
right_offset unsigned 0 The number of pixels at the right which can't be used by the positioner.

The following states exist:

  • state_enabled, the horizontal scrollbar is enabled.
  • state_disabled, the horizontal scrollbar is disabled.
  • state_pressed, the left mouse button is down on the positioner of the horizontal scrollbar.
  • state_focussed, the mouse is over the positioner of the horizontal scrollbar.

Vertical scrollbar

The definition of a vertical scrollbar. This class is most of the time not used directly. Instead it's used to build other items with scrollbars.

The resolution for a vertical scrollbar also contains the following keys:

key type default description
minimum_positioner_length unsigned mandatory The minimum size the positioner is allowed to be. The engine needs to know this in order to calculate the best size for the positioner.
maximum_positioner_length unsigned 0 The maximum size the positioner is allowed to be. If minimum and maximum are the same value the positioner is fixed size. If the maximum is 0 (and the minimum not) there's no maximum.
top_offset unsigned 0 The number of pixels at the top which can't be used by the positioner.
bottom_offset unsigned 0 The number of pixels at the bottom which can't be used by the positioner.

The following states exist:

  • state_enabled, the vertical scrollbar is enabled.
  • state_disabled, the vertical scrollbar is disabled.
  • state_pressed, the left mouse button is down on the positioner of the vertical scrollbar.
  • state_focussed, the mouse is over the positioner of the vertical scrollbar.

Window

Base class of top level items, the only item which needs to store the final canvases to draw on. The definition of a window. A window is a kind of panel; see the panel for which fields exist.

This page was last edited on 25 October 2024, at 13:09.