omegalib
13.1
|
#include <Widget.h>
Classes | |
struct | BorderStyle |
Public Types | |
enum | Layer { Back, Middle, Front, NumLayers } |
enum | BlendMode { BlendInherit, BlendNormal, BlendAdditive, BlendDisabled } |
Public Member Functions | |
Widget (Engine *server) | |
virtual | ~Widget () |
virtual Renderable * | createRenderable () |
virtual void | handleEvent (const Event &evt) |
virtual void | update (const omega::UpdateContext &context) |
Container * | getContainer () |
const String & | getName () |
Returns the widget name. More... | |
void | setName (const String &name) |
Sets the widget name. More... | |
int | getId () |
Returns the unique Widget id. More... | |
virtual void | layout () |
void | setStereo (bool value) |
bool | isStereo () |
virtual void | autosize () |
virtual void | updateSize () |
void | requestLayoutRefresh () |
Layer | getLayer () |
void | setLayer (Layer layer) |
bool | hitTest (const Vector2f &point) |
Returns true if the point is within this widget's bounding box. More... | |
Vector2f | transformPoint (const omega::Vector2f &point) |
Transforms a 2D point from screen space to this widget's reference frame. More... | |
void | setUserData (void *data) |
void * | getUserData () |
bool | isDraggable () |
void | setDraggable (bool value) |
bool | isDragging () |
bool | isPinned () |
When a widget is pinned, its position will remain fixed with respect to its container. More... | |
void | setPinned (bool value) |
void | setSizeAnchorEnabled (bool enabled) |
bool | isSizeAnchorEnabled () |
void | setSizeAnchor (const Vector2f &value) |
const Vector2f | getSizeAnchor () |
WidgetFactory * | getFactory () |
void | setUIEventHandler (IEventListener *value) |
Input and Events. More... | |
IEventListener * | getUIEventHandler () |
void | setUIEventCommand (const String &command) |
bool | isButtonDown (const Event &evt, Event::Flags button) |
Returns true if the event is a button down event happening on this widget. More... | |
bool | isButtonUp (const Event &evt, Event::Flags button) |
Returns true if the event is a button up event happening on this widget. More... | |
void | setUpdateCommand (const String &cmd) |
Sets or gets a script command to be invoked on every update for this widget. More... | |
String | getUpdateCommand () |
void | setDragBeginCommand (const String &cmd) |
Sets or gets a script command to be invoked when this widget starts dragging. More... | |
String | getDragBeginCommand () |
void | setDragEndCommand (const String &cmd) |
Sets or gets a script command to be invoked when this widget ends dragging. More... | |
String | getDragEndCommand () |
void | setActivateCommand (const String &cmd) |
Sets or gets a script command to be invoked when this widget gets active status. More... | |
String | getActivateCommand () |
void | setDeactivateCommand (const String &cmd) |
Sets or gets a script command to be invoked when this widget loses active status. More... | |
String | getDeactivateCommand () |
const Vector2f & | getPosition () |
Position and rotation. More... | |
Vector2f | getDerivedPosition () |
Gets the widget position in screen space. More... | |
void | setPosition (const omega::Vector2f &value) |
Sets the widget position. More... | |
void | setPosition (int value, int dimension) |
void | setCenter (const omega::Vector2f &value) |
Vector2f | getCenter () |
void | setRotation (float value) |
Sets the widget rotation. More... | |
float | getRotation () |
Gets the widget position. More... | |
const Vector2f & | getSize () |
Size constraints. More... | |
float | getWidth () |
float | getHeight () |
void | setSize (const Vector2f &value) |
Sets the widget size. More... | |
void | setWidth (float value) |
void | setHeight (float value) |
const Vector2f & | getMinimumSize () |
const Vector2f & | getMaximumSize () |
void | setMinimumSize (const Vector2f &value) |
int | getMinimumWidth () |
int | getMinimumHeight () |
void | setMaximumSize (const Vector2f &value) |
int | getMaximumWidth () |
int | getMaximumHeight () |
void | setMinimumWidth (float value) |
void | setMinimumHeight (float value) |
void | setMaximumWidth (float value) |
void | setMaximumHeight (float value) |
void | clearSizeConstaints () |
void | setAutosize (bool value) |
bool | getAutosize () |
bool | isVisible () |
Flags. More... | |
void | setVisible (bool value) |
bool | isEnabled () |
When true, the widget is enabled, i.e. it can receive input events and takes part in navigation (can become active) More... | |
void | setEnabled (bool value) |
bool | isActive () |
void | setActive (bool value) |
virtual bool | isIn3DContainer () |
Returns true if this widget is part of a container that will be drawn in 3D mode. More... | |
bool | isPointerInside () |
void | setHorizontalNextWidget (Widget *value) |
Navigation. More... | |
Widget * | getHorizontalNextWidget () |
void | setHorizontalPrevWidget (Widget *value) |
Widget * | getHorizontalPrevWidget () |
void | setVerticalNextWidget (Widget *value) |
Widget * | getVerticalNextWidget () |
void | setVerticalPrevWidget (Widget *value) |
Widget * | getVerticalPrevWidget () |
bool | isNavigationEnabled () |
void | setNavigationEnabled (bool value) |
bool | isGamepadInteractionEnabled () |
bool | isPointerInteractionEnabled () |
void | setStyle (const String &style) |
Appearance. More... | |
String | getStyleValue (const String &key, const String &defaultValue="") |
void | setStyleValue (const String &key, const String &value) |
void | setScale (float value) |
void | setActiveStyle (const String &value) |
void | setInactiveStyle (const String &value) |
String | getActiveStyle () |
String | getInactiveStyle () |
float | getScale () |
Sets the widget scale. More... | |
float | getDerivedScale () |
Gets the scale of this widget, taking into account the scale of any parent container. More... | |
void | setAlpha (float value) |
float | getAlpha () |
void | setBlendMode (BlendMode value) |
BlendMode | getBlendMode () |
void | setFillColor (const Color &c) |
void | setFillEnabled (bool value) |
BorderStyle & | getBorderStyle (int side) |
Gets the style for one of the borders. More... | |
void | setShaderEnabled (bool value) |
Enables or disables shaders for this widget. More... | |
bool | isShaderEnabled () |
void | setShaderName (const String &name) |
Sets the name of the shader used by this widget. More... | |
const String & | getShaderName () |
Color | getDebugColor () |
Debug mode. More... | |
void | setDebugColor (omega::Color value) |
Sets the color used when widget debug mode is enabled. More... | |
bool | isDebugModeEnabled () |
Returns true if debug mode is enabled for this widget. More... | |
void | setDebugModeEnabled (bool value) |
Enabled or disabled debug mode for this widget. More... | |
void | setPreDrawCallback (PyObject *predcb) |
Scriptable draw callbacks. More... | |
void | setPostDrawCallback (PyObject *postdcb) |
Sets a python function to be called right before rendering of this widget terminates. More... | |
Public Member Functions inherited from omega::RenderableFactory | |
RenderableFactory () | |
virtual | ~RenderableFactory () |
virtual void | initialize (Engine *srv) |
void | dispose () |
void | refresh () |
virtual bool | isInitialized () |
Renderable * | getRenderable (Renderer *client) |
Engine * | getEngine () |
Public Member Functions inherited from omicron::ReferenceType | |
ReferenceType () | |
virtual | ~ReferenceType () |
void | ref () |
void | unref () |
long | refCount () |
Static Public Member Functions | |
static Widget * | create (Container *parent) |
template<typename W > | |
static W * | getSource (const Event &evt) |
Static Public Member Functions inherited from omicron::ReferenceType | |
static void | printObjCounts () |
Static Public Attributes | |
static const int | MaxWidgets = 16384 |
Protected Member Functions | |
bool | simpleHitTest (const omega::Vector2f &point) |
virtual void | activate () |
Called when this widget becomes the active widget. More... | |
virtual void | deactivate () |
Called when this widget is not the active widget anymore. More... | |
virtual void | updateStyle () |
void | setContainer (Container *value) |
void | dispatchUIEvent (const Event &evt) |
void | playMenuScrollSound () |
bool | needLayoutRefresh () |
internal layout management More... | |
void | setActualSize (int value, Orientation orientation, bool force=false) |
Protected Member Functions inherited from omega::RenderableFactory | |
Renderable * | addRenderable (Renderer *cli) |
Static Protected Member Functions | |
static bool | simpleHitTest (const omega::Vector2f &point, const omega::Vector2f &pos, const omega::Vector2f &size) |
Protected Attributes | |
omega::Vector2f | myPosition |
omega::Vector2f | mySize |
float | myRotation |
Friends | |
class | UiManager |
class | UiRenderPass |
class | Container |
class | WidgetRenderable |
Additional Inherited Members | |
Static Protected Attributes inherited from omicron::ReferenceType | |
static List< ReferenceType * > | mysObjList |
omegaToolkit::ui::Widget::Widget | ( | Engine * | server | ) |
|
virtual |
|
inlineprotectedvirtual |
Called when this widget becomes the active widget.
Derivec classes can implement this method to specify a custom activation behavior
Reimplemented in omegaToolkit::ui::Container, and omegaToolkit::ui::TextBox.
|
inlinevirtual |
Reimplemented in omegaToolkit::ui::Container, omegaToolkit::ui::Label, and omegaToolkit::ui::Button.
void omegaToolkit::ui::Widget::clearSizeConstaints | ( | ) |
|
virtual |
Implements omega::RenderableFactory.
Reimplemented in omegaToolkit::ui::Container, omegaToolkit::ui::DefaultSlider, omegaToolkit::ui::DefaultButton, omegaToolkit::ui::Label, and omegaToolkit::ui::Image.
|
inlineprotectedvirtual |
Called when this widget is not the active widget anymore.
Derivec classes can implement this method to specify a custom deactivation behavior
Reimplemented in omegaToolkit::ui::TextBox.
|
protected |
|
inline |
|
inline |
float omegaToolkit::ui::Widget::getAlpha | ( | ) |
|
inline |
|
inline |
|
inline |
Gets the style for one of the borders.
Vector2f omegaToolkit::ui::Widget::getCenter | ( | ) |
|
inline |
|
inline |
|
inline |
Debug mode.
Gets the color used when widget debug mode is enabled.
Vector2f omegaToolkit::ui::Widget::getDerivedPosition | ( | ) |
Gets the widget position in screen space.
float omegaToolkit::ui::Widget::getDerivedScale | ( | ) |
Gets the scale of this widget, taking into account the scale of any parent container.
|
inline |
|
inline |
WidgetFactory* omegaToolkit::ui::Widget::getFactory | ( | ) |
|
inline |
|
inline |
|
inline |
int omegaToolkit::ui::Widget::getId | ( | ) |
Returns the unique Widget id.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Returns the widget name.
|
inline |
Position and rotation.
Gets the widget position relative to its container
|
inline |
Gets the widget position.
|
inline |
Sets the widget scale.
Scale controls the visual appearance of a widget without changing its actual size or forcing a layout refresh of the widget container. Scale is indicated as a proportion of the current widget size.
|
inline |
|
inline |
Size constraints.
Gets the widget size
|
inline |
|
inlinestatic |
String omegaToolkit::ui::Widget::getStyleValue | ( | const String & | key, |
const String & | defaultValue = "" |
||
) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
virtual |
Reimplemented in omegaToolkit::ui::TextBox.
bool omegaToolkit::ui::Widget::hitTest | ( | const Vector2f & | point | ) |
Returns true if the point is within this widget's bounding box.
|
inline |
|
inline |
Returns true if the event is a button down event happening on this widget.
|
inline |
Returns true if the event is a button up event happening on this widget.
|
inline |
Returns true if debug mode is enabled for this widget.
|
inline |
|
inline |
|
inline |
When true, the widget is enabled, i.e. it can receive input events and takes part in navigation (can become active)
bool omegaToolkit::ui::Widget::isGamepadInteractionEnabled | ( | ) |
|
virtual |
Returns true if this widget is part of a container that will be drawn in 3D mode.
Reimplemented in omegaToolkit::ui::Container.
|
inline |
|
inline |
When a widget is pinned, its position will remain fixed with respect to its container.
Pinning widgets is useful to make container draggable only on a sub-section represented by the pinned widget.
|
inline |
bool omegaToolkit::ui::Widget::isPointerInteractionEnabled | ( | ) |
|
inline |
|
inline |
|
inline |
|
inline |
Flags.
|
virtual |
Reimplemented in omegaToolkit::ui::Container.
|
protected |
internal layout management
|
protected |
void omegaToolkit::ui::Widget::requestLayoutRefresh | ( | ) |
|
inline |
Sets or gets a script command to be invoked when this widget gets active status.
void omegaToolkit::ui::Widget::setActive | ( | bool | value | ) |
|
inline |
|
protected |
|
inline |
|
inline |
|
inline |
void omegaToolkit::ui::Widget::setCenter | ( | const omega::Vector2f & | value | ) |
|
protected |
|
inline |
Sets or gets a script command to be invoked when this widget loses active status.
|
inline |
Sets the color used when widget debug mode is enabled.
|
inline |
Enabled or disabled debug mode for this widget.
When debug mode is enabled, the widget bounding box will be displayed.
|
inline |
Sets or gets a script command to be invoked when this widget starts dragging.
|
inline |
Sets or gets a script command to be invoked when this widget ends dragging.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Navigation.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Sets the widget name.
void omegaToolkit::ui::Widget::setNavigationEnabled | ( | bool | value | ) |
|
inline |
|
inline |
Sets the widget position.
|
inline |
|
inline |
Sets a python function to be called right before rendering of this widget terminates.
Pointer must be to a callable PyObject.
|
inline |
Scriptable draw callbacks.
Sets a python function to be called before rendering of this widget begins. Pointer must be to a callable PyObject.
|
inline |
Sets the widget rotation.
value | - the widget rotation in degrees |
|
inline |
|
inline |
Enables or disables shaders for this widget.
Shaders are enabled by default and are required to correctly render some widget features like correct transparency. The shader used by the widget can be replaced using the setShaderName method.
|
inline |
Sets the name of the shader used by this widget.
The widget will look for a vertex and a fragment shader with this name. By default, widgets use a shader named 'system/shaders/widget-shader'. The default shaders will be 'system/shaders/widget-shader.vert' and 'system/shaders/widget-shader.frag'. The shader sources can be found in the omegalib data directory.
|
inline |
Sets the widget size.
|
inline |
|
inline |
|
inline |
void omegaToolkit::ui::Widget::setStyle | ( | const String & | style | ) |
Appearance.
void omegaToolkit::ui::Widget::setStyleValue | ( | const String & | key, |
const String & | value | ||
) |
void omegaToolkit::ui::Widget::setUIEventCommand | ( | const String & | command | ) |
|
inline |
Input and Events.
Sets the event listener used to handle events generated by this widget.
|
inline |
Sets or gets a script command to be invoked on every update for this widget.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |
|
staticprotected |
Vector2f omegaToolkit::ui::Widget::transformPoint | ( | const omega::Vector2f & | point | ) |
Transforms a 2D point from screen space to this widget's reference frame.
|
virtual |
|
virtual |
Reimplemented in omegaToolkit::ui::Container, and omegaToolkit::ui::TextBox.
|
protectedvirtual |
Reimplemented in omegaToolkit::ui::Label.
|
friend |
|
friend |
|
friend |
|
friend |
|
static |
|
protected |
|
protected |
|
protected |