omegalib  13.1
omegaToolkit::ui::Container Class Reference

#include <Container.h>

Public Types

enum  Layout {
  LayoutFree, LayoutHorizontal, LayoutVertical, LayoutGridHorizontal,
  LayoutGridVertical
}
 
enum  HorizontalAlign { AlignRight, AlignLeft, AlignCenter }
 
enum  VerticalAlign { AlignTop, AlignMiddle, AlignBottom }
 
- Public Types inherited from omegaToolkit::ui::Widget
enum  Layer { Back, Middle, Front, NumLayers }
 
enum  BlendMode { BlendInherit, BlendNormal, BlendAdditive, BlendDisabled }
 

Public Member Functions

 Container (Engine *server)
 
virtual ~Container ()
 
virtual RenderablecreateRenderable ()
 
virtual void handleEvent (const omega::Event &evt)
 
virtual void update (const omega::UpdateContext &context)
 
void load (Setting &setting)
 
bool isEventInside (const Event &evt)
 Returns true if the event happens within the container boundaries. More...
 
bool rayToPointerEvent (const Event &inEvt, Event &outEvt)
 For 3D mode containers: converts a ray event to a pointer event with 2D coordintes in the container coordinate space. More...
 
virtual void layout ()
 
Container3dSettingsget3dSettings ()
 Gets the container 3d settings. More...
 
virtual bool isIn3DContainer ()
 Returns true if this widget is part of a container that will be drawn in 3D mode. More...
 
virtual void updateSize ()
 
virtual void autosize ()
 
void updateChildrenNavigation ()
 Recomputes navigation links for widgets in this container. More...
 
void addChild (Widget *child)
 Child management. More...
 
void removeChild (Widget *child)
 Remove a child from this widget. More...
 
int getNumChildren ()
 Return the number of children. More...
 
WidgetgetChildByName (const String &name)
 Find a child by its name. More...
 
WidgetgetChildByIndex (int index)
 
WidgetgetChildBefore (const Widget *w)
 
WidgetgetChildAfter (const Widget *w)
 
void setLayout (Layout layout)
 Layout options. More...
 
Layout getLayout ()
 
void setPadding (float value)
 Sets the margin between the container's content and its borders. More...
 
float getPadding ()
 
void setMargin (float value)
 Sets the padding space between elements within the container. More...
 
float getMargin ()
 
HorizontalAlign getHorizontalAlign ()
 
void setHorizontalAlign (HorizontalAlign value)
 
VerticalAlign getVerticalAlign ()
 
void setVerticalAlign (VerticalAlign value)
 
int getGridRows ()
 
int getGridColumns ()
 
void setGridRows (int value)
 
void setGridColumns (int value)
 
bool isClippingEnabled ()
 
void setClippingEnabled (bool value)
 
bool isPixelOutputEnabled ()
 Pixel output. More...
 
void setPixelOutputEnabled (bool value)
 
PixelDatagetPixels ()
 
- Public Member Functions inherited from omegaToolkit::ui::Widget
 Widget (Engine *server)
 
virtual ~Widget ()
 
virtual void handleEvent (const Event &evt)
 
ContainergetContainer ()
 
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...
 
void setStereo (bool value)
 
bool isStereo ()
 
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 ()
 
WidgetFactorygetFactory ()
 
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)
 
bool isPointerInside ()
 
void setHorizontalNextWidget (Widget *value)
 Navigation. More...
 
WidgetgetHorizontalNextWidget ()
 
void setHorizontalPrevWidget (Widget *value)
 
WidgetgetHorizontalPrevWidget ()
 
void setVerticalNextWidget (Widget *value)
 
WidgetgetVerticalNextWidget ()
 
void setVerticalPrevWidget (Widget *value)
 
WidgetgetVerticalPrevWidget ()
 
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)
 
BorderStylegetBorderStyle (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 ()
 
RenderablegetRenderable (Renderer *client)
 
EnginegetEngine ()
 
- Public Member Functions inherited from omicron::ReferenceType
 ReferenceType ()
 
virtual ~ReferenceType ()
 
void ref ()
 
void unref ()
 
long refCount ()
 

Static Public Member Functions

static Containercreate (Layout layout, Container *parent)
 
- Static Public Member Functions inherited from omegaToolkit::ui::Widget
static Widgetcreate (Container *parent)
 
template<typename W >
static W * getSource (const Event &evt)
 
- Static Public Member Functions inherited from omicron::ReferenceType
static void printObjCounts ()
 

Protected Member Functions

virtual void activate ()
 Called when this widget becomes the active widget. More...
 
- Protected Member Functions inherited from omegaToolkit::ui::Widget
bool simpleHitTest (const omega::Vector2f &point)
 
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
RenderableaddRenderable (Renderer *cli)
 

Protected Attributes

List< Ref< Widget > > myChildren
 
List< Widget * > myChildrenToRemove
 
Layout myLayout
 
float myPadding
 
float myMargin
 
int myGridRows
 
int myGridColumns
 
HorizontalAlign myHorizontalAlign
 
VerticalAlign myVerticalAlign
 
bool myClipping
 
Container3dSettings my3dSettings
 
Ref< PixelDatamyPixels
 
bool myPixelOutputEnabled
 
- Protected Attributes inherited from omegaToolkit::ui::Widget
omega::Vector2f myPosition
 
omega::Vector2f mySize
 
float myRotation
 

Friends

class ContainerRenderable
 
class UiRenderPass
 

Additional Inherited Members

- Static Public Attributes inherited from omegaToolkit::ui::Widget
static const int MaxWidgets = 16384
 
- Static Protected Member Functions inherited from omegaToolkit::ui::Widget
static bool simpleHitTest (const omega::Vector2f &point, const omega::Vector2f &pos, const omega::Vector2f &size)
 
- Static Protected Attributes inherited from omicron::ReferenceType
static List< ReferenceType * > mysObjList
 
+ Inheritance diagram for omegaToolkit::ui::Container:

Member Enumeration Documentation

Enumerator
AlignRight 
AlignLeft 
AlignCenter 
Enumerator
LayoutFree 
LayoutHorizontal 
LayoutVertical 
LayoutGridHorizontal 
LayoutGridVertical 
Enumerator
AlignTop 
AlignMiddle 
AlignBottom 

Constructor & Destructor Documentation

omegaToolkit::ui::Container::Container ( Engine server)
virtual omegaToolkit::ui::Container::~Container ( )
virtual

Member Function Documentation

virtual void omegaToolkit::ui::Container::activate ( )
protectedvirtual

Called when this widget becomes the active widget.

Derivec classes can implement this method to specify a custom activation behavior

Reimplemented from omegaToolkit::ui::Widget.

void omegaToolkit::ui::Container::addChild ( Widget child)

Child management.

Add a child to this widget.

virtual void omegaToolkit::ui::Container::autosize ( )
virtual

Reimplemented from omegaToolkit::ui::Widget.

static Container* omegaToolkit::ui::Container::create ( Layout  layout,
Container parent 
)
static
virtual Renderable* omegaToolkit::ui::Container::createRenderable ( )
virtual

Reimplemented from omegaToolkit::ui::Widget.

Container3dSettings& omegaToolkit::ui::Container::get3dSettings ( )
inline

Gets the container 3d settings.

Widget* omegaToolkit::ui::Container::getChildAfter ( const Widget w)
Widget* omegaToolkit::ui::Container::getChildBefore ( const Widget w)
Widget* omegaToolkit::ui::Container::getChildByIndex ( int  index)
Widget* omegaToolkit::ui::Container::getChildByName ( const String name)

Find a child by its name.

int omegaToolkit::ui::Container::getGridColumns ( )
inline
int omegaToolkit::ui::Container::getGridRows ( )
inline
Container::HorizontalAlign omegaToolkit::ui::Container::getHorizontalAlign ( )
inline
Container::Layout omegaToolkit::ui::Container::getLayout ( )
inline
float omegaToolkit::ui::Container::getMargin ( )
inline
int omegaToolkit::ui::Container::getNumChildren ( )
inline

Return the number of children.

float omegaToolkit::ui::Container::getPadding ( )
inline
PixelData* omegaToolkit::ui::Container::getPixels ( )
Container::VerticalAlign omegaToolkit::ui::Container::getVerticalAlign ( )
inline
virtual void omegaToolkit::ui::Container::handleEvent ( const omega::Event evt)
virtual
bool omegaToolkit::ui::Container::isClippingEnabled ( )
bool omegaToolkit::ui::Container::isEventInside ( const Event evt)

Returns true if the event happens within the container boundaries.

This method supports all pointer and ray-generating events, and works with 2D and 3D mode containers.

bool omegaToolkit::ui::Container::isIn3DContainer ( )
inlinevirtual

Returns true if this widget is part of a container that will be drawn in 3D mode.

Reimplemented from omegaToolkit::ui::Widget.

bool omegaToolkit::ui::Container::isPixelOutputEnabled ( )

Pixel output.

virtual void omegaToolkit::ui::Container::layout ( )
virtual

Reimplemented from omegaToolkit::ui::Widget.

void omegaToolkit::ui::Container::load ( Setting setting)
bool omegaToolkit::ui::Container::rayToPointerEvent ( const Event inEvt,
Event outEvt 
)

For 3D mode containers: converts a ray event to a pointer event with 2D coordintes in the container coordinate space.

Returns true if the event happens within the container boundaries, and could be converted to a pointer event successfully.

void omegaToolkit::ui::Container::removeChild ( Widget child)

Remove a child from this widget.

void omegaToolkit::ui::Container::setClippingEnabled ( bool  value)
void omegaToolkit::ui::Container::setGridColumns ( int  value)
inline
void omegaToolkit::ui::Container::setGridRows ( int  value)
inline
void omegaToolkit::ui::Container::setHorizontalAlign ( HorizontalAlign  value)
inline
void omegaToolkit::ui::Container::setLayout ( Layout  layout)
inline

Layout options.

void omegaToolkit::ui::Container::setMargin ( float  value)
inline

Sets the padding space between elements within the container.

void omegaToolkit::ui::Container::setPadding ( float  value)
inline

Sets the margin between the container's content and its borders.

void omegaToolkit::ui::Container::setPixelOutputEnabled ( bool  value)
void omegaToolkit::ui::Container::setVerticalAlign ( VerticalAlign  value)
inline
virtual void omegaToolkit::ui::Container::update ( const omega::UpdateContext context)
virtual

Reimplemented from omegaToolkit::ui::Widget.

void omegaToolkit::ui::Container::updateChildrenNavigation ( )

Recomputes navigation links for widgets in this container.

Only enabled widgets take part in navigation.

virtual void omegaToolkit::ui::Container::updateSize ( )
virtual

Reimplemented from omegaToolkit::ui::Widget.

Friends And Related Function Documentation

friend class ContainerRenderable
friend
friend class UiRenderPass
friend

Member Data Documentation

Container3dSettings omegaToolkit::ui::Container::my3dSettings
protected
List< Ref<Widget> > omegaToolkit::ui::Container::myChildren
protected
List<Widget*> omegaToolkit::ui::Container::myChildrenToRemove
protected
bool omegaToolkit::ui::Container::myClipping
protected
int omegaToolkit::ui::Container::myGridColumns
protected
int omegaToolkit::ui::Container::myGridRows
protected
HorizontalAlign omegaToolkit::ui::Container::myHorizontalAlign
protected
Layout omegaToolkit::ui::Container::myLayout
protected
float omegaToolkit::ui::Container::myMargin
protected
float omegaToolkit::ui::Container::myPadding
protected
bool omegaToolkit::ui::Container::myPixelOutputEnabled
protected
Ref<PixelData> omegaToolkit::ui::Container::myPixels
protected
VerticalAlign omegaToolkit::ui::Container::myVerticalAlign
protected

The documentation for this class was generated from the following file: