-
Notifications
You must be signed in to change notification settings - Fork 26
Widget
Alessandro Febretti edited this page Aug 28, 2013
·
29 revisions
[[module omegaToolkit | Python-Reference#module-omegatoolkit]]
wraps omegaTookit::ui::Widget
Base class for GUI elements
Method(s) | Description |
---|---|
setVisible(bool visible) , bool isVisible()
|
Gets or sets the visibility for the widget |
setPosition([[Vector]]2 position) , [[Vector]]2 getPosition()
|
Gets or sets the widget position in pixels |
[[Vector]]2 getSize() , 'setSize([[Vector]]2 size)
|
Gets or sets the size of the widget in pixels |
int getWidth() , 'setWidth(int value)
|
Gets or sets the widget width |
int getHeight() , 'setHeight(int value)
|
Gets or sets the widget height |
setAutosize(bool value) , bool getAutosize()
|
Enables / disables autosize mode. |
setName(stirng name) , string 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([[Vector]]2 position) |
Checks if the specified pixel position lies within the widget area |
setUIEventCommand(string command) |
Sets the command to be invoked when events happen in the widget area (like clicks or value changes) |
WidgetLayer getLayer() , setLayer(WidgetLayer value)
|
Gets or sets the layer for the widget. Layers influence the drawing order of widgets within the same container |
[[Vector]]2 transformPoint([[Vector]]2 point) |
Transforms a point from global pixel coordinates to local pixel coordinates in the widget space. |
setCenter([[Vector]]2 point) , [[Vector]]2 getCenter()
|
Gets or Sets the widget position by it center |
setAlpha(float value) float getAlpha()
|
Gets or sets the transparency of the widget. Blendng must be enabled through setBlendMode
|
setBlendMode(WidgetBlendMode value) WidgetBlendMode setBlendMode()
|
Gets or sets the blend mode for the widget |
setUpdateCommand(string cmdstring) string getUpdateCommand()
|
Gets or specified an update command to be executed for each update cycle on the widget. Example: widget.setUpdateCommand("print('widget updated')")
|
bool isStereo() setStereo(bool 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