simvx.core.ui.types¶
UI utility types — UIInputEvent, DragData, Theme, and theme descriptors.
The :class:Colour palette/Property lives in :mod:simvx.core.properties.
Module Contents¶
Classes¶
Input event for UI controls. |
|
Data being dragged between controls. |
|
Descriptor that reads a colour from the theme unless explicitly overridden. |
|
Descriptor that reads a layout size from the theme unless overridden. |
|
Descriptor that reads a StyleBox from the theme unless explicitly overridden. |
|
UI theme controlling colours, fonts, and sizing. |
Data¶
API¶
- simvx.core.ui.types.__all__¶
[‘UIInputEvent’, ‘DragData’, ‘Theme’, ‘ThemeColour’, ‘ThemeSize’, ‘ThemeStyleBox’]
- class simvx.core.ui.types.UIInputEvent(position=None, button: int = 0, pressed: bool = True, key: str = '', char: str = '')[source]¶
Input event for UI controls.
Attributes: position: Mouse position in screen coordinates. button: Mouse button (1=left, 2=middle, 3=right) or 0 for keyboard. pressed: True for press, False for release. key: Key name for keyboard events. char: Character typed (for text input).
Initialization
- __slots__¶
(‘position’, ‘button’, ‘pressed’, ‘key’, ‘char’)
- class simvx.core.ui.types.DragData(data: Any = None, preview: Any = None)[source]¶
Data being dragged between controls.
Attributes: data: Arbitrary payload. preview: Optional visual preview control shown during drag. source: Control the drag originated from (set by the system).
Initialization
- __slots__¶
(‘data’, ‘preview’, ‘source’)
- class simvx.core.ui.types.ThemeColour(key: str)[source]¶
Descriptor that reads a colour from the theme unless explicitly overridden.
Overrides are serializable — saved to scene files like Property values. Setting to
Nonereverts to the theme default.Usage::
class Button(Control): bg_colour = ThemeColour("btn_bg") text_colour = ThemeColour("text") btn.bg_colour = Colour.RED # override btn.bg_colour = None # revert to themeInitialization
- __slots__¶
(‘key’, ‘attr’, ‘name’)
- class simvx.core.ui.types.ThemeSize(key: str, default: float = 0.0)[source]¶
Descriptor that reads a layout size from the theme unless overridden.
Same semantics as :class:
ThemeColourbut for numeric layout values.Initialization
- __slots__¶
(‘key’, ‘attr’, ‘name’, ‘default’)
- class simvx.core.ui.types.ThemeStyleBox(key: str)[source]¶
Descriptor that reads a StyleBox from the theme unless explicitly overridden.
Same semantics as :class:
ThemeColourbut for StyleBox values. Setting toNonereverts to the theme default.Initialization
- __slots__¶
(‘key’, ‘attr’, ‘name’)
- class simvx.core.ui.types.Theme[source]¶
UI theme controlling colours, fonts, and sizing.
All colours are float tuples (r, g, b, a) in 0.0-1.0 range.
Example: theme = Theme() theme.colours[‘accent’] = Colour.hex(“#33CCFF”) theme.sizes[‘button_height’] = 40
Initialization