#include <OpenGUI_Widget.h>
Inheritance diagram for OpenGUI::Widget:

Public Member Functions | |
| Widget () | |
| public constructor | |
| virtual | ~Widget () |
| public destructor | |
| const std::string & | getName () |
| returns the name of this Widget | |
| void | setName (const std::string &name) |
| sets the name of this Widget | |
| bool | getEnabled () |
| returns the enabled/disabled state of this Widget | |
| void | setEnabled (bool value) |
| sets the enabled/disabled state of this Widget | |
| void | invalidate () |
| invalidate any caches of this Widget's render output | |
| void | flush () |
| invalidate this Widget, as well as any and all potential children | |
| virtual void | _doflush () |
| Needs to be overridden by container widgets to invalidate self and call _doFlush() for all children. | |
| WidgetCollection * | getContainer () const |
| returns the collection this widget is held within | |
| void | getChildrenAt (const FVector2 &position, WidgetPtrList &outList, bool recursive=false) |
Fills the given outList with pointers to all child Widgets that are under the given position. | |
| Widget * | getChildAt (const FVector2 &position, bool recursive=false) |
Returns a pointer to the top-most child at the given position. Returns 0 if no child is found at the position. | |
| Widget * | getPath (const std::string &path) const |
| Returns a pointer to the widget at the given path, 0 if no widget is found. | |
| FVector2 | pointToScreen (const FVector2 &local_point) |
| Translates the given point from coordinates local to this Widget into Screen level coordinates. | |
| FVector2 | pointFromScreen (const FVector2 &screen_point) |
| Translates the given point from Screen level coordinates into coordinates local to this Widget. | |
| virtual void | _translatePointIn (FVector2 &point) |
| Translate the given point from local coordinates to inside coordinates. | |
| virtual void | _translatePointOut (FVector2 &point) |
| Translate the given point from inside coordinates to local coordinates. | |
| bool | hasCursorFocus () |
Returns true if this Widget has cursor focus within its Screen. | |
| bool | hasKeyFocus () |
Returns true if this Widget has key focus within its Screen. | |
| virtual ObjectAccessorList * | getAccessors () |
| returns this object's ObjectAccessorList head | |
| virtual unsigned int | getObjectType () const |
| Returns an integer identifying the type of object. | |
| virtual bool | isInside (const FVector2 &position) |
| Returns true if the given point is inside this Widget. | |
| void | _injectCursorMove (Cursor_EventArgs &moveEvent) |
| Informs this widget of cursor movement. | |
| virtual void | _sendToChildren_CursorMove (Cursor_EventArgs &moveEvent) |
| Should inject the CursorMove event to all children. | |
| void | _injectCursorPress (Cursor_EventArgs &pressEvent) |
| Informs this widget of cursor press. | |
| virtual void | _sendToChildren_CursorPress (Cursor_EventArgs &pressEvent) |
| Should inject the CursorPress event to all children. | |
| void | _injectCursorRelease (Cursor_EventArgs &releaseEvent) |
| Informs this widget of cursor release. | |
| virtual void | _sendToChildren_CursorRelease (Cursor_EventArgs &releaseEvent) |
| Should inject the CursorRelease event to all children. | |
| void | _injectCursorFocused (Widget *next, Widget *prev) |
| Informs this widget of cursor focus acquisition. | |
| void | _injectCursorFocusLost (Widget *next, Widget *prev) |
| Informs this widget of cursor focus loss. | |
| void | _injectKeyDown (Key_EventArgs &evtArgs) |
| Informs this widget of key down. | |
| void | _injectKeyPressed (Key_EventArgs &evtArgs) |
| Informs this widget of key press. | |
| void | _injectKeyUp (Key_EventArgs &evtArgs) |
| Informs this widget of key up. | |
| void | _injectKeyFocused (Widget *next, Widget *prev) |
| Informs this widget of key focus acquisition. | |
| void | _injectKeyFocusLost (Widget *next, Widget *prev) |
| Informs this widget of key focus loss. | |
Protected Member Functions | |
| Screen * | getScreen () const |
| returns the screen that this Widget is attached to, or 0 if not attached | |
| Object * | getParent () const |
| returns a pointer to the parenting Object of this Widget, or 0 if there isn't one | |
| void | grabKeyFocus () |
| grabs focus for this Widget for keyboard events | |
| void | releaseKeyFocus () |
| releases focus for this Widget for keyboard events | |
| void | grabCursorFocus () |
| grabs focus for this Widget for cursor events | |
| void | releaseCursorFocus () |
| releases focus for this Widget for cursor events | |
Event Triggers | |
| void | eventAttached (WidgetCollection *newContainer, Widget *widget) |
| Widget was attached to a container. | |
| void | eventDetached (WidgetCollection *prevContainer, Widget *widget) |
| Widget was removed from a container. | |
| void | eventDraw (Brush &brush) |
| Draw this object's foreground using the given brush. | |
| void | eventInvalidated () |
| Widget was invalidated and will need to be redrawn next Screen::update(). | |
| void | eventEnabled () |
| Widget's state has changed to Enabled. | |
| void | eventDisabled () |
| Widget's state has changed to Disabled. | |
| bool | eventCursorMoving (float xPos, float yPos) |
| Called for cursor movement before sending to children, giving the X,Y position of the cursor. | |
| bool | eventCursorMove (float xPos, float yPos) |
| Called for cursor movement, giving the X,Y position of the cursor. | |
| bool | eventCursorPressing (float xPos, float yPos) |
| Called for cursor press before sending to children, giving the X,Y position of the cursor. | |
| bool | eventCursorPress (float xPos, float yPos) |
| Called when the cursor button is pressed. | |
| bool | eventCursorReleasing (float xPos, float yPos) |
| Called for cursor release before sending to children, giving the X,Y position of the cursor. | |
| bool | eventCursorRelease (float xPos, float yPos) |
| Called when the cursor button is released. | |
| void | eventCursorEnter () |
| Called when the cursor enters this Control. | |
| void | eventCursorLeave () |
| Called when the cursor leaves this Control. | |
| void | eventCursorFocused (Widget *cur, Widget *prev) |
| Called then this widget receives cursor focus. | |
| void | eventCursorFocusLost (Widget *cur, Widget *prev) |
| Called then this widget loses cursor focus. | |
| bool | eventKeyUp (char character) |
Called when the given character is released. | |
| bool | eventKeyDown (char character) |
Called when the given character is pressed down. | |
| bool | eventKeyPressed (char character) |
Called when the given character is entered. | |
| void | eventKeyFocused (Widget *cur, Widget *prev) |
| Called then this widget receives key focus. | |
| void | eventKeyFocusLost (Widget *cur, Widget *prev) |
| Called then this widget loses key focus. | |
| void | eventTick (float seconds) |
| Called when the passage of time has been measured. | |
Event Handlers | |
| virtual void | onAttached (Object *sender, Attach_EventArgs &evtArgs) |
| "Attached" event | |
| virtual void | onDetached (Object *sender, Attach_EventArgs &evtArgs) |
| "Detached" event | |
| virtual void | onDraw (Object *sender, Draw_EventArgs &evtArgs) |
| "Draw" event | |
| virtual void | onInvalidated (Object *sender, EventArgs &evtArgs) |
| "Invalidated" event | |
| virtual void | onEnabled (Object *sender, EventArgs &evtArgs) |
| "Enabled" event | |
| virtual void | onDisabled (Object *sender, EventArgs &evtArgs) |
| "Disabled" event | |
| virtual void | onCursorMoving (Object *sender, Cursor_EventArgs &evtArgs) |
| "CursorMoving" event | |
| virtual void | onCursorMove (Object *sender, Cursor_EventArgs &evtArgs) |
| "CursorMove" event | |
| virtual void | onCursorPressing (Object *sender, Cursor_EventArgs &evtArgs) |
| "CursorPressing" event | |
| virtual void | onCursorPress (Object *sender, Cursor_EventArgs &evtArgs) |
| "CursorPress" event | |
| virtual void | onCursorReleasing (Object *sender, Cursor_EventArgs &evtArgs) |
| "CursorReleasing" event | |
| virtual void | onCursorRelease (Object *sender, Cursor_EventArgs &evtArgs) |
| "CursorRelease" event | |
| virtual void | onCursorEnter (Object *sender, EventArgs &evtArgs) |
| "CursorEnter" event | |
| virtual void | onCursorLeave (Object *sender, EventArgs &evtArgs) |
| "CursorLeave" event | |
| virtual void | onCursorFocused (Object *sender, Focus_EventArgs &evtArgs) |
| "CursorFocused" event | |
| virtual void | onCursorFocusLost (Object *sender, Focus_EventArgs &evtArgs) |
| "CursorFocusLost" event | |
| virtual void | onKeyUp (Object *sender, Key_EventArgs &evtArgs) |
| "Key_Up" event | |
| virtual void | onKeyDown (Object *sender, Key_EventArgs &evtArgs) |
| "Key_Down" event | |
| virtual void | onKeyPressed (Object *sender, Key_EventArgs &evtArgs) |
| "Key_Pressed" event | |
| virtual void | onKeyFocused (Object *sender, Focus_EventArgs &evtArgs) |
| "Key_Focused" event | |
| virtual void | onKeyFocusLost (Object *sender, Focus_EventArgs &evtArgs) |
| "Key_FocusLost" event | |
| virtual void | onTick (Object *sender, Tick_EventArgs &evtArgs) |
| "Tick" event | |
| OpenGUI::Widget::Widget | ( | ) |
public constructor
| OpenGUI::Widget::~Widget | ( | ) | [virtual] |
public destructor
| void OpenGUI::Widget::_doflush | ( | ) | [virtual] |
Needs to be overridden by container widgets to invalidate self and call _doFlush() for all children.
Reimplemented in OpenGUI::ContainerControl.
Informs this widget of cursor focus acquisition.
Informs this widget of cursor focus loss.
| void OpenGUI::Widget::_injectCursorMove | ( | Cursor_EventArgs & | moveEvent | ) |
Informs this widget of cursor movement.
| void OpenGUI::Widget::_injectCursorPress | ( | Cursor_EventArgs & | pressEvent | ) |
Informs this widget of cursor press.
| void OpenGUI::Widget::_injectCursorRelease | ( | Cursor_EventArgs & | releaseEvent | ) |
Informs this widget of cursor release.
| void OpenGUI::Widget::_injectKeyDown | ( | Key_EventArgs & | evtArgs | ) |
Informs this widget of key down.
Informs this widget of key focus acquisition.
Informs this widget of key focus loss.
| void OpenGUI::Widget::_injectKeyPressed | ( | Key_EventArgs & | evtArgs | ) |
Informs this widget of key press.
| void OpenGUI::Widget::_injectKeyUp | ( | Key_EventArgs & | evtArgs | ) |
Informs this widget of key up.
| void OpenGUI::Widget::_sendToChildren_CursorMove | ( | Cursor_EventArgs & | moveEvent | ) | [virtual] |
Should inject the CursorMove event to all children.
moveEvent is the copy that was sent to _injectCursorMove(), and will likely need to be translated to an inner coordinate before passing on to the children. Also, be sure to preserve the event's Consumed value in both directions, as it is critical to proper operation. Reimplemented in OpenGUI::ContainerControl.
| void OpenGUI::Widget::_sendToChildren_CursorPress | ( | Cursor_EventArgs & | pressEvent | ) | [virtual] |
Should inject the CursorPress event to all children.
pressEvent is the copy that was sent to _injectCursorPress(), and will likely need to be translated to an inner coordinate before passing on to the children. Also, be sure to preserve the event's Consumed value in both directions, as it is critical to proper operation. Reimplemented in OpenGUI::ContainerControl.
| void OpenGUI::Widget::_sendToChildren_CursorRelease | ( | Cursor_EventArgs & | releaseEvent | ) | [virtual] |
Should inject the CursorRelease event to all children.
releaseEvent is the copy that was sent to _injectCursorRelease(), and will likely need to be translated to an inner coordinate before passing on to the children. Also, be sure to preserve the event's Consumed value in both directions, as it is critical to proper operation. Reimplemented in OpenGUI::ContainerControl.
| void OpenGUI::Widget::_translatePointIn | ( | FVector2 & | point | ) | [virtual] |
Translate the given point from local coordinates to inside coordinates.
This function is intended for overriding should the existing method not produce accurate results. Overriding should only be necessary if the widget has children and displays them in a non-standard fashion (rotated, for example).
This function takes the given point and translates its value from local coordinates to inner coordinates. As an example, the ContainerControl takes the given point and subtracts its position and upper left client area offset to it to produce a resulting point that is local to its children. (The children's position and size are defined within the resulting coordinate space)
The result of the transform is written back to the given point
Reimplemented in OpenGUI::ContainerControl.
| void OpenGUI::Widget::_translatePointOut | ( | FVector2 & | point | ) | [virtual] |
Translate the given point from inside coordinates to local coordinates.
This function is intended for overriding should the existing method not produce accurate results.
It should produce the inverse result of _translatePointIn()
This function takes the given point and translates its value from inner coordinates to local coordinates. As an example, the ContainerControl takes the given point and adds its position and upper left client area offset to it to produce a resulting point that is local to itself. (Its own position and size are defined within the resulting coordinate space)
The result of the transform is written back to the given point
Reimplemented in OpenGUI::ContainerControl.
| void OpenGUI::Widget::eventAttached | ( | WidgetCollection * | newContainer, | |
| Widget * | widget | |||
| ) | [protected] |
Widget was attached to a container.
| void OpenGUI::Widget::eventCursorEnter | ( | ) | [protected] |
Called when the cursor enters this Control.
Called then this widget receives cursor focus.
Called then this widget loses cursor focus.
| void OpenGUI::Widget::eventCursorLeave | ( | ) | [protected] |
Called when the cursor leaves this Control.
| bool OpenGUI::Widget::eventCursorMove | ( | float | xPos, | |
| float | yPos | |||
| ) | [protected] |
Called for cursor movement, giving the X,Y position of the cursor.
| xPos | X position of the cursor | |
| yPos | Y position of the cursor |
| bool OpenGUI::Widget::eventCursorMoving | ( | float | xPos, | |
| float | yPos | |||
| ) | [protected] |
Called for cursor movement before sending to children, giving the X,Y position of the cursor.
| xPos | X position of the cursor | |
| yPos | Y position of the cursor |
| bool OpenGUI::Widget::eventCursorPress | ( | float | xPos, | |
| float | yPos | |||
| ) | [protected] |
Called when the cursor button is pressed.
| xPos | X position of the cursor | |
| yPos | Y position of the cursor |
| bool OpenGUI::Widget::eventCursorPressing | ( | float | xPos, | |
| float | yPos | |||
| ) | [protected] |
Called for cursor press before sending to children, giving the X,Y position of the cursor.
| xPos | X position of the cursor | |
| yPos | Y position of the cursor |
| bool OpenGUI::Widget::eventCursorRelease | ( | float | xPos, | |
| float | yPos | |||
| ) | [protected] |
Called when the cursor button is released.
| xPos | X position of the cursor | |
| yPos | Y position of the cursor |
| bool OpenGUI::Widget::eventCursorReleasing | ( | float | xPos, | |
| float | yPos | |||
| ) | [protected] |
Called for cursor release before sending to children, giving the X,Y position of the cursor.
| xPos | X position of the cursor | |
| yPos | Y position of the cursor |
| void OpenGUI::Widget::eventDetached | ( | WidgetCollection * | prevContainer, | |
| Widget * | widget | |||
| ) | [protected] |
Widget was removed from a container.
| void OpenGUI::Widget::eventDisabled | ( | ) | [protected] |
Widget's state has changed to Disabled.
| void OpenGUI::Widget::eventDraw | ( | Brush & | brush | ) | [protected] |
Draw this object's foreground using the given brush.
| void OpenGUI::Widget::eventEnabled | ( | ) | [protected] |
Widget's state has changed to Enabled.
| void OpenGUI::Widget::eventInvalidated | ( | ) | [protected] |
Widget was invalidated and will need to be redrawn next Screen::update().
| bool OpenGUI::Widget::eventKeyDown | ( | char | character | ) | [protected] |
Called when the given character is pressed down.
Called then this widget receives key focus.
Called then this widget loses key focus.
| bool OpenGUI::Widget::eventKeyPressed | ( | char | character | ) | [protected] |
Called when the given character is entered.
| bool OpenGUI::Widget::eventKeyUp | ( | char | character | ) | [protected] |
Called when the given character is released.
| void OpenGUI::Widget::eventTick | ( | float | seconds | ) | [protected] |
Called when the passage of time has been measured.
| void OpenGUI::Widget::flush | ( | ) |
invalidate this Widget, as well as any and all potential children
| ObjectAccessorList * OpenGUI::Widget::getAccessors | ( | ) | [virtual] |
returns this object's ObjectAccessorList head
Reimplemented from OpenGUI::Object.
Reimplemented in OpenGUI::ContainerControl, OpenGUI::Control, and OpenGUI::Window.
Returns a pointer to the top-most child at the given position. Returns 0 if no child is found at the position.
| position | The position to test in the same coordinates that this widget is defined in. | |
| recursive | TRUE to recurse into the matching child, asking the same question. FALSE to only test the direct children of this widget. |
| void OpenGUI::Widget::getChildrenAt | ( | const FVector2 & | position, | |
| WidgetPtrList & | outList, | |||
| bool | recursive = false | |||
| ) |
Fills the given outList with pointers to all child Widgets that are under the given position.
The list is depth sorted, with top-most widgets at the top and bottom-most widgets at the bottom.
| position | The position to test in the same coordinates that this widget is defined in. | |
| outList | Filled with pointers to the Widgets that matched the query criteria | |
| recursive | TRUE to recurse into the matching children, asking the same question. FALSE to only test the direct children of this widget. |
| WidgetCollection * OpenGUI::Widget::getContainer | ( | ) | const |
returns the collection this widget is held within
Every displayable Widget is guaranteed to have a container.
| bool OpenGUI::Widget::getEnabled | ( | ) |
returns the enabled/disabled state of this Widget
| const std::string & OpenGUI::Widget::getName | ( | ) |
returns the name of this Widget
| unsigned int OpenGUI::Widget::getObjectType | ( | ) | const [virtual] |
Returns an integer identifying the type of object.
Implements OpenGUI::Object.
Reimplemented in OpenGUI::ContainerControl, OpenGUI::Control, and OpenGUI::Window.
| Object * OpenGUI::Widget::getParent | ( | ) | const [protected] |
returns a pointer to the parenting Object of this Widget, or 0 if there isn't one
This is a helper function for Widget::getContainer()->WidgetCollection::getParent() with some additional safety checks.
| Widget * OpenGUI::Widget::getPath | ( | const std::string & | path | ) | const |
Returns a pointer to the widget at the given path, 0 if no widget is found.
Widget paths are much like file system paths. They are comprised of Widget names separated by forward slashes ('/'). They provide some common concepts, that are familiar to file system navigation.
| Screen * OpenGUI::Widget::getScreen | ( | ) | const [protected] |
returns the screen that this Widget is attached to, or 0 if not attached
| void OpenGUI::Widget::grabCursorFocus | ( | ) | [protected] |
grabs focus for this Widget for cursor events
You can only grab focus when you are attached to a Screen. Attempts to grab focus when not attached to a screen will cause an exception.
Cursor_Move event. | void OpenGUI::Widget::grabKeyFocus | ( | ) | [protected] |
grabs focus for this Widget for keyboard events
You can only grab focus when you are attached to a Screen. Attempts to grab focus when not attached to a screen will cause an exception.
| bool OpenGUI::Widget::hasCursorFocus | ( | ) |
| bool OpenGUI::Widget::hasKeyFocus | ( | ) |
| void OpenGUI::Widget::invalidate | ( | ) |
| bool OpenGUI::Widget::isInside | ( | const FVector2 & | position | ) | [virtual] |
Returns true if the given point is inside this Widget.
This function is intended to be overridden by subclasses to reflect their own personal interpretation of the given point (in local coordinates) and if that point is considered to be inside the widget. This allows new widgets to break free from the existing "axis aligned rect" paradigm that is usually in place.
Reimplemented in OpenGUI::Control.
| void OpenGUI::Widget::onAttached | ( | Object * | sender, | |
| Attach_EventArgs & | evtArgs | |||
| ) | [protected, virtual] |
"Attached" event
| void OpenGUI::Widget::onCursorFocused | ( | Object * | sender, | |
| Focus_EventArgs & | evtArgs | |||
| ) | [protected, virtual] |
| void OpenGUI::Widget::onCursorFocusLost | ( | Object * | sender, | |
| Focus_EventArgs & | evtArgs | |||
| ) | [protected, virtual] |
| void OpenGUI::Widget::onCursorMove | ( | Object * | sender, | |
| Cursor_EventArgs & | evtArgs | |||
| ) | [protected, virtual] |
"CursorMove" event
Reimplemented in OpenGUI::ContainerControl, OpenGUI::Control, and OpenGUI::Window.
| void OpenGUI::Widget::onCursorMoving | ( | Object * | sender, | |
| Cursor_EventArgs & | evtArgs | |||
| ) | [protected, virtual] |
"CursorMoving" event
| void OpenGUI::Widget::onCursorPress | ( | Object * | sender, | |
| Cursor_EventArgs & | evtArgs | |||
| ) | [protected, virtual] |
| void OpenGUI::Widget::onCursorPressing | ( | Object * | sender, | |
| Cursor_EventArgs & | evtArgs | |||
| ) | [protected, virtual] |
"CursorPressing" event
| void OpenGUI::Widget::onCursorRelease | ( | Object * | sender, | |
| Cursor_EventArgs & | evtArgs | |||
| ) | [protected, virtual] |
| void OpenGUI::Widget::onCursorReleasing | ( | Object * | sender, | |
| Cursor_EventArgs & | evtArgs | |||
| ) | [protected, virtual] |
"CursorReleasing" event
| void OpenGUI::Widget::onDetached | ( | Object * | sender, | |
| Attach_EventArgs & | evtArgs | |||
| ) | [protected, virtual] |
"Detached" event
"Disabled" event
| void OpenGUI::Widget::onDraw | ( | Object * | sender, | |
| Draw_EventArgs & | evtArgs | |||
| ) | [protected, virtual] |
"Draw" event
"Enabled" event
| void OpenGUI::Widget::onKeyDown | ( | Object * | sender, | |
| Key_EventArgs & | evtArgs | |||
| ) | [protected, virtual] |
"Key_Down" event
| void OpenGUI::Widget::onKeyFocused | ( | Object * | sender, | |
| Focus_EventArgs & | evtArgs | |||
| ) | [protected, virtual] |
"Key_Focused" event
| void OpenGUI::Widget::onKeyFocusLost | ( | Object * | sender, | |
| Focus_EventArgs & | evtArgs | |||
| ) | [protected, virtual] |
"Key_FocusLost" event
| void OpenGUI::Widget::onKeyPressed | ( | Object * | sender, | |
| Key_EventArgs & | evtArgs | |||
| ) | [protected, virtual] |
"Key_Pressed" event
| void OpenGUI::Widget::onKeyUp | ( | Object * | sender, | |
| Key_EventArgs & | evtArgs | |||
| ) | [protected, virtual] |
"Key_Up" event
| void OpenGUI::Widget::onTick | ( | Object * | sender, | |
| Tick_EventArgs & | evtArgs | |||
| ) | [protected, virtual] |
"Tick" event
| void OpenGUI::Widget::releaseCursorFocus | ( | ) | [protected] |
releases focus for this Widget for cursor events
This is automatically performed when a widget is detached from a Screen, which also means that it occurs during widget destruction. Requires attachment to a Screen at time of calling or will have no effect.
Cursor_Move event.