-
Notifications
You must be signed in to change notification settings - Fork 26
Widget
Alessandro Febretti edited this page Jul 9, 2013
·
29 revisions
[[module omegaToolkit]]
wraps omegaTookit::ui::Widget
Base class for GUI elements
Method(s) | Description |
---|---|
setVisible(visible) , isVisible()
|
Gets or sets the visibility for the widget |
setPosition(position) , getPosition()
|
Gets or sets the widget position in pixels as a Vector2 value |
getSize() , 'getSize(size)
|
Gets or sets the size of the widget in pixels as a Vector2 value |
getWidth() , 'setWidth(value)
|
Gets or sets the widget width |
getHeight() , 'setHeight(value)
|
Gets or sets the widget height |
setAutosize(bool value) , bool getAutosize()
|
Enables / disables autosize mode. |
setName(name) , getName()
|
Gets or sets the widget name |
setStyle(style) |
Sets one or more widget styles as key: value pairs |
setStyleValue(style, value) |
Sets the value for a single style key |
refresh() |
Forces a widget refresh |
hitTest(position) |
Checks if the specified pixel position (as a Vector2 value) lies within the widget area |
setUIEventCommand(command) |
Sets the command to be invoked when events happen in the widget area (like clicks or value changes) |
getLayer() , setLayer(value)
|
Gets or sets the layer for the widget. Layers influence the drawing order of widgets within the same container |
transformPoint(point) |
Transforms a point from global pixel coordinates to local pixel coordinates in the widget space. Returns a Vector2 value |
setCenter(point) , getCenter()
|
Gets or Sets the widget position by it center |
setAlpha(value) getAlpha()
|
Gets or sets the transparency of the widget. Blendng must be enabled through setBlendMode
|
setBlendMode(value) setBlendMode()
|
Gets or sets the blend mode for the widget |
setUpdateCommand(cmdstring) getUpdateCommand()
|
Gets or specified an update command to be executed for each update cycle on the widget. Example: widget.setUpdateCommand("print('widget updated')")
|
isStereo() setStereo(value)
|
Gets or sets stereo mode for the Widget. Some widgets (like Image ) perform rendering differently when stereo mode is enabled. For instance, Image supports rendering of side-by-side stereo images. |
The method getLayer()
returns a value from the WidgetLayer
enumeration. The WidgetLayer
enumeration contains the following values: Front
, Middle
, Back
The method getLayer()
returns a value from the WidgetBlendMode
enumeration. The WidgetLayer
enumeration:
-
BlendInherit
sets the blend mode to inherited from parent -
BlendNormal
sets the blend mode to standard blending -
BlendAdditive
sets the blend mode to additive blending
The methods setStyle
and setStyleValue
accept the following style keys:
-
fill
: sets the widget fill color. Example:widget.setStyleValue('fill', '#ff0000')
-
border
: sets the border style for all borders. widget fill color. Border style is a border width followed by a borer color. Example:widget.setStyleValue('border', '2 #ffff00')
-
border-top
,border-bottom
,border-left
,border-right
: sets each border side style separately