1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 20:53:53 +00:00
openmw/docs/source/reference/lua-scripting/widgets/widget.rst

94 lines
2.6 KiB
ReStructuredText
Raw Normal View History

2021-11-18 15:19:54 +00:00
Widget
======
Properties
----------
.. list-table::
:header-rows: 1
:widths: 20 20 60
* - name
- type (default value)
- description
* - position
- util.vector2 (0, 0)
- | Offsets the position of the widget from its parent's
| top-left corner in pixels.
* - size
- util.vector2 (0, 0)
- Increases the widget's size in pixels.
* - relativePosition
- util.vector2 (0, 0)
- | Offsets the position of the widget from its parent's
| top-left corner as a fraction of the parent's size.
* - relativeSize
- util.vector2 (0, 0)
- Increases the widget's size by a fraction of its parent's size.
* - anchor
- util.vector2 (0, 0)
- | Offsets the widget's position by a fraction of its size.
| Useful for centering or aligning to a corner.
* - visible
- boolean (true)
- Defines if the widget is visible
2022-01-28 09:31:45 +00:00
.. TODO: document the mouse pointer property, when API for reading / adding pointer types is available
2021-11-18 15:19:54 +00:00
Events
------
.. list-table::
:header-rows: 1
:widths: 20 20 60
* - name
2021-12-02 21:52:29 +00:00
- first argument type
2021-11-18 15:19:54 +00:00
- description
* - keyPress
- `KeyboardEvent <../openmw_input.html##(KeyboardEvent)>`_
- A key was pressed with this widget in focus
* - keyRelease
- `KeyboardEvent <../openmw_input.html##(KeyboardEvent)>`_
- A key was released with this widget in focus
* - mouseMove
- `MouseEvent <../openmw_ui.html##(MouseEvent)>`_
- | Mouse cursor moved on this widget
| `MouseEvent.button` is the mouse button being held
| (nil when simply moving, and not dragging)
* - mouseClick
- nil
- Widget was clicked with left mouse button
* - mouseDoubleClick
- nil
- Widget was double clicked with left mouse button
* - mousePress
- `MouseEvent <../openmw_ui.html##(MouseEvent)>`_
- A mouse button was pressed on this widget
* - mouseRelease
- `MouseEvent <../openmw_ui.html##(MouseEvent)>`_
- A mouse button was released on this widget
* - focusGain
- nil
- Widget gained focus (either through mouse or keyboard)
* - focusLoss
- nil
- Widget lost focus
* - textInput
- string
- Text input with this widget in focus
2022-01-28 09:31:45 +00:00
External
--------
.. list-table::
:header-rows: 1
:widths: 20 20 60
* - name
- type (default value)
- description
* - slot
- bool (false)
- | Only applies for template content (ignored in layout content).
| If true, all the widgets defined in layout content will be rendered as children of this widget.
| Only one widget per template can have slot = true (others will be ignored).