Primary GUI class. More...
#include <GuiElement.h>
Public Member Functions | |
| GuiElement () | |
| Constructor. | |
| virtual | ~GuiElement () |
| Destructor. | |
| void | setParent (GuiElement *e) |
| Set the element's parent. | |
| GuiElement * | getParent () |
| Gets the element's parent. | |
| virtual void | remove (GuiElement *) |
| Removes the specified child. | |
| void | setRemoveOnDestroy (bool autoRemove) |
| Whether to notify parent on destruction to allow removal. | |
| int | getLeft () |
| Gets the current leftmost coordinate of the element Considers horizontal alignment, x offset, width, and parent element's GetLeft() / GetWidth() values. | |
| int | getTop () |
| Gets the current topmost coordinate of the element Considers vertical alignment, y offset, height, and parent element's GetTop() / GetHeight() values. | |
| void | setMinY (int y) |
| Sets the minimum y offset of the element. | |
| int | getMinY () |
| Gets the minimum y offset of the element. | |
| void | setMaxY (int y) |
| Sets the maximum y offset of the element. | |
| int | getMaxY () |
| Gets the maximum y offset of the element. | |
| void | setMinX (int x) |
| Sets the minimum x offset of the element. | |
| int | getMinX () |
| Gets the minimum x offset of the element. | |
| void | setMaxX (int x) |
| Sets the maximum x offset of the element. | |
| int | getMaxX () |
| Gets the maximum x offset of the element. | |
| int | getWidth () |
| Gets the current width of the element. | |
| int | getHeight () |
| Gets the height of the element. | |
| void | setSize (int w, int h) |
| Sets the size (width/height) of the element. | |
| bool | isVisible () |
| Checks whether or not the element is visible. | |
| bool | isSelectable () |
| Checks whether or not the element is selectable. | |
| bool | isClickable () |
| Checks whether or not the element is clickable. | |
| bool | isHoldable () |
| Checks whether or not the element is holdable. | |
| void | setSelectable (bool s) |
| Sets whether or not the element is selectable. | |
| void | setClickable (bool c) |
| Sets whether or not the element is clickable. | |
| void | setHoldable (bool h) |
| Sets whether or not the element is holdable. | |
| STATE | getState () |
| Gets the element's current state. | |
| int | getStateChan () |
| Gets the controller channel that last changed the element's state. | |
| void | setAlpha (int a) |
| Sets the element's alpha value. | |
| int | getAlpha () |
| Gets the element's alpha value Considers alpha, alphaDyn, and the parent element's GetAlpha() value. | |
| void | setScale (float s) |
| Sets the element's x and y scale. | |
| void | setScaleX (float s) |
| Sets the element's x scale. | |
| void | setScaleY (float s) |
| Sets the element's y scale. | |
| void | setScale (int w, int h) |
| Sets the element's x and y scale, using the provided max width/height. | |
| float | getScale () |
| Gets the element's current scale Considers scale, scaleDyn, and the parent element's GetScale() value. | |
| float | getScaleX () |
| Gets the element's current x scale Considers scale, scaleDyn, and the parent element's GetScale() value. | |
| float | getScaleY () |
| Gets the element's current y scale Considers scale, scaleDyn, and the parent element's GetScale() value. | |
| void | setTrigger (GuiTrigger *t) |
| Set a new GuiTrigger for the element. | |
| void | setTrigger (uint8_t i, GuiTrigger *t) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| bool | isRumble () |
| Checks whether rumble was requested by the element. | |
| void | setRumble (bool r) |
| Sets whether or not the element is requesting a rumble event. | |
| void | setEffect (int e, int a, int t=0) |
| Set an effect for the element. | |
| void | setEffectOnOver (int e, int a, int t=0) |
| Sets an effect to be enabled on wiimote cursor over. | |
| void | setEffectGrow () |
| Shortcut to SetEffectOnOver(EFFECT::SCALE, 4, 110) | |
| int | getEffect () |
| Gets the current element effects. | |
| bool | isInside (int x, int y) |
| Checks whether the specified coordinates are within the element's boundaries. | |
| void | setPosition (int x, int y) |
| Sets the element's position. | |
| void | updateEffects () |
| Updates the element's effects (dynamic values) Called by Draw(), used for animation purposes. | |
| void | setUpdateCallback (UpdateCallback u) |
| Sets a function to called after after Update() Callback function can be used to response to changes in the state of the element, and/or update the element's attributes. | |
| int | isFocused () |
| Checks whether the element is in focus. | |
| virtual void | setVisible (bool v) |
| Sets the element's visibility. | |
| virtual void | setFocus (int f) |
| Sets the element's focus. | |
| virtual void | setState (STATE s, int c=-1) |
| Sets the element's state. | |
| virtual void | resetState () |
| Resets the element's state to STATE::DEFAULT. | |
| virtual int | getSelected () |
| Gets whether or not the element is in STATE::SELECTED. | |
| virtual void | setAlignment (ALIGN_H hor, ALIGN_V vert) |
| Sets the element's alignment respective to its parent element. | |
| virtual void | getNaturalSize (int &w, int &h) |
| Layout protocol: how a layout container (GuiRow, GuiColumn, GuiGrid, GuiOverlay) asks about and arranges its children. | |
| virtual void | setLayoutPosition (int x, int y) |
| Places the element so its top-left corner is at (x, y) relative to its parent's top-left (default: LEFT/TOP alignment plus an offset) | |
| virtual void | setLayoutSize (int w, int h) |
| Gives the element a size chosen by a container (default: sets width and height) | |
| virtual void | layout () |
| Brings the element's own layout up to date. | |
| virtual void | collectNavigable (std::vector< GuiElement * > &out) |
| Appends the elements that selection can move between (default: this element; layout containers add their children instead, so the D-pad moves through them) | |
| virtual void | resetText () |
| Called when the language has changed, to obtain new text values for all text elements. | |
| virtual void | update (InputController *c) |
| Called constantly to allow the element to respond to the current input data. | |
| virtual void | draw ()=0 |
| Called constantly to redraw the element. | |
Protected Attributes | |
| GuiTrigger * | trigger [MAX_TRIGGERS] |
| GuiTriggers (input actions) that this element responds to. | |
| UpdateCallback | updateCB |
| Callback function to call when this element is updated. | |
| GuiElement * | parentElement |
| Parent element. | |
| bool | removeOnDestroy |
| Whether to instruct parent to remove this element when it is destroyed. | |
| int | focus |
| Element focus (-1 = focus disabled, 0 = not focused, 1 = focused) | |
| int | width |
| Element width. | |
| int | height |
| Element height. | |
| int | xoffset |
| Element X offset. | |
| int | yoffset |
| Element Y offset. | |
| int | ymin |
| Element's min Y offset allowed. | |
| int | ymax |
| Element's max Y offset allowed. | |
| int | xmin |
| Element's min X offset allowed. | |
| int | xmax |
| Element's max X offset allowed. | |
| int | xoffsetDyn |
| Element X offset, dynamic (added to xoffset value for animation effects) | |
| int | yoffsetDyn |
| Element Y offset, dynamic (added to yoffset value for animation effects) | |
| int | alpha |
| Element alpha value (0-255) | |
| int | alphaDyn |
| Element alpha, dynamic (multiplied by alpha value for blending/fading effects) | |
| float | xscale |
| Element X scale (1 = 100%) | |
| float | yscale |
| Element Y scale (1 = 100%) | |
| float | scaleDyn |
| Element scale, dynamic (multiplied by alpha value for blending/fading effects) | |
| int | effects |
| Currently enabled effect(s). | |
| int | effectAmount |
| Effect amount. | |
| int | effectTarget |
| Effect target amount. | |
| int | effectsOver |
| Effects to enable when wiimote cursor is over this element. | |
| int | effectAmountOver |
| EffectAmount to set when wiimote cursor is over this element. | |
| int | effectTargetOver |
| EffectTarget to set when wiimote cursor is over this element. | |
| ALIGN_H | alignmentHor |
| Horizontal element alignment, respective to parent element (LEFT, RIGHT, CENTRE) | |
| ALIGN_V | alignmentVert |
| Horizontal element alignment, respective to parent element (TOP, BOTTOM, MIDDLE) | |
| STATE | state |
| Element state (DEFAULT, SELECTED, CLICKED, DISABLED) | |
| int | stateChan |
| Which controller channel is responsible for the last change in state. | |
| bool | selectable |
| Whether or not this element selectable (can change to SELECTED state) | |
| bool | clickable |
| Whether or not this element is clickable (can change to CLICKED state) | |
| bool | holdable |
| Whether or not this element is holdable (can change to HELD state) | |
| bool | visible |
| Visibility of the element. | |
| bool | rumble |
| Wiimote rumble (on/off) - set to on when this element requests a rumble event. | |
Primary GUI class.
Most other classes inherit from this class.
Definition at line 60 of file GuiElement.h.
| GuiElement::GuiElement | ( | ) |
Constructor.
Definition at line 9 of file GuiElement.cpp.
|
virtual |
Destructor.
Definition at line 51 of file GuiElement.cpp.
|
virtual |
Appends the elements that selection can move between (default: this element; layout containers add their children instead, so the D-pad moves through them)
Reimplemented in GuiLayout.
Definition at line 596 of file GuiElement.cpp.
|
pure virtual |
Called constantly to redraw the element.
Implemented in GuiButton, GuiControllerView, GuiFileBrowser, GuiGlyph, GuiImage, GuiLayout, GuiOptionBrowser, GuiShape, GuiText, GuiWindow, and UiScope::Runner.
| int GuiElement::getAlpha | ( | ) |
Gets the element's alpha value Considers alpha, alphaDyn, and the parent element's GetAlpha() value.
Definition at line 202 of file GuiElement.cpp.
| int GuiElement::getEffect | ( | ) |
Gets the current element effects.
Definition at line 382 of file GuiElement.cpp.
| int GuiElement::getHeight | ( | ) |
Gets the height of the element.
Does not currently consider the scale
Definition at line 175 of file GuiElement.cpp.
| int GuiElement::getLeft | ( | ) |
Gets the current leftmost coordinate of the element Considers horizontal alignment, x offset, width, and parent element's GetLeft() / GetWidth() values.
Definition at line 68 of file GuiElement.cpp.
| int GuiElement::getMaxX | ( | ) |
Gets the maximum x offset of the element.
Definition at line 145 of file GuiElement.cpp.
| int GuiElement::getMaxY | ( | ) |
Gets the maximum y offset of the element.
Definition at line 165 of file GuiElement.cpp.
| int GuiElement::getMinX | ( | ) |
Gets the minimum x offset of the element.
Definition at line 135 of file GuiElement.cpp.
| int GuiElement::getMinY | ( | ) |
Gets the minimum y offset of the element.
Definition at line 155 of file GuiElement.cpp.
|
virtual |
Layout protocol: how a layout container (GuiRow, GuiColumn, GuiGrid, GuiOverlay) asks about and arranges its children.
The defaults suit any element with a size. Gets the size the element wants when laid out (default: its width and height)
Reimplemented in GuiLayout, and GuiText.
Definition at line 574 of file GuiElement.cpp.
| GuiElement * GuiElement::getParent | ( | ) |
Gets the element's parent.
Definition at line 63 of file GuiElement.cpp.
| float GuiElement::getScale | ( | ) |
Gets the element's current scale Considers scale, scaleDyn, and the parent element's GetScale() value.
Definition at line 244 of file GuiElement.cpp.
| float GuiElement::getScaleX | ( | ) |
Gets the element's current x scale Considers scale, scaleDyn, and the parent element's GetScale() value.
Definition at line 254 of file GuiElement.cpp.
| float GuiElement::getScaleY | ( | ) |
Gets the element's current y scale Considers scale, scaleDyn, and the parent element's GetScale() value.
Definition at line 264 of file GuiElement.cpp.
|
virtual |
Gets whether or not the element is in STATE::SELECTED.
Reimplemented in GuiWindow.
Definition at line 557 of file GuiElement.cpp.
| STATE GuiElement::getState | ( | ) |
| int GuiElement::getStateChan | ( | ) |
Gets the controller channel that last changed the element's state.
Definition at line 279 of file GuiElement.cpp.
| int GuiElement::getTop | ( | ) |
Gets the current topmost coordinate of the element Considers vertical alignment, y offset, height, and parent element's GetTop() / GetHeight() values.
Definition at line 99 of file GuiElement.cpp.
| int GuiElement::getWidth | ( | ) |
Gets the current width of the element.
Does not currently consider the scale
Definition at line 170 of file GuiElement.cpp.
| bool GuiElement::isClickable | ( | ) |
Checks whether or not the element is clickable.
Definition at line 322 of file GuiElement.cpp.
| int GuiElement::isFocused | ( | ) |
Checks whether the element is in focus.
Definition at line 345 of file GuiElement.cpp.
| bool GuiElement::isHoldable | ( | ) |
Checks whether or not the element is holdable.
Definition at line 332 of file GuiElement.cpp.
| bool GuiElement::isInside | ( | int | x, |
| int | y ) |
Checks whether the specified coordinates are within the element's boundaries.
| x | X coordinate |
| y | Y coordinate |
Definition at line 566 of file GuiElement.cpp.
| bool GuiElement::isRumble | ( | ) |
Checks whether rumble was requested by the element.
Definition at line 372 of file GuiElement.cpp.
| bool GuiElement::isSelectable | ( | ) |
Checks whether or not the element is selectable.
Definition at line 314 of file GuiElement.cpp.
| bool GuiElement::isVisible | ( | ) |
Checks whether or not the element is visible.
Definition at line 187 of file GuiElement.cpp.
|
virtual |
Brings the element's own layout up to date.
Containers call this on their children first, so nested layouts settle in a single pass (default: nothing to do).
Reimplemented in GuiLayout.
Definition at line 592 of file GuiElement.cpp.
|
inlinevirtual |
Removes the specified child.
Reimplemented in GuiLayout, and GuiWindow.
Definition at line 74 of file GuiElement.h.
|
virtual |
Resets the element's state to STATE::DEFAULT.
Reimplemented in GuiButton, GuiFileBrowser, GuiOptionBrowser, and GuiWindow.
Definition at line 290 of file GuiElement.cpp.
|
virtual |
Called when the language has changed, to obtain new text values for all text elements.
Reimplemented in GuiButton, GuiOptionBrowser, GuiText, and GuiWindow.
Definition at line 562 of file GuiElement.cpp.
Sets the element's alignment respective to its parent element.
| hor | Horizontal alignment (LEFT, RIGHT, CENTRE) |
| vert | Vertical alignment (TOP, BOTTOM, MIDDLE) |
Reimplemented in GuiText.
Definition at line 551 of file GuiElement.cpp.
| void GuiElement::setAlpha | ( | int | a | ) |
Sets the element's alpha value.
| a | alpha value |
Definition at line 197 of file GuiElement.cpp.
| void GuiElement::setClickable | ( | bool | c | ) |
Sets whether or not the element is clickable.
| c | Clickable |
Definition at line 299 of file GuiElement.cpp.
| void GuiElement::setEffect | ( | int | e, |
| int | a, | ||
| int | t = 0 ) |
Set an effect for the element.
| e | Effect to enable |
| a | Amount of the effect (usage varies on effect) |
| t | Target amount of the effect (usage varies on effect) |
Definition at line 387 of file GuiElement.cpp.
| void GuiElement::setEffectGrow | ( | ) |
Shortcut to SetEffectOnOver(EFFECT::SCALE, 4, 110)
Definition at line 421 of file GuiElement.cpp.
| void GuiElement::setEffectOnOver | ( | int | e, |
| int | a, | ||
| int | t = 0 ) |
Sets an effect to be enabled on wiimote cursor over.
| e | Effect to enable |
| a | Amount of the effect (usage varies on effect) |
| t | Target amount of the effect (usage varies on effect) |
Definition at line 414 of file GuiElement.cpp.
|
virtual |
Sets the element's focus.
| f | Focus (true = in focus) |
Reimplemented in GuiFileBrowser, GuiOptionBrowser, and GuiWindow.
Definition at line 340 of file GuiElement.cpp.
| void GuiElement::setHoldable | ( | bool | h | ) |
Sets whether or not the element is holdable.
| h | Holdable |
Definition at line 309 of file GuiElement.cpp.
|
virtual |
Places the element so its top-left corner is at (x, y) relative to its parent's top-left (default: LEFT/TOP alignment plus an offset)
Definition at line 580 of file GuiElement.cpp.
|
virtual |
Gives the element a size chosen by a container (default: sets width and height)
Reimplemented in GuiLayout.
Definition at line 586 of file GuiElement.cpp.
| void GuiElement::setMaxX | ( | int | x | ) |
Sets the maximum x offset of the element.
| x | X offset |
Definition at line 140 of file GuiElement.cpp.
| void GuiElement::setMaxY | ( | int | y | ) |
Sets the maximum y offset of the element.
| y | Y offset |
Definition at line 160 of file GuiElement.cpp.
| void GuiElement::setMinX | ( | int | x | ) |
Sets the minimum x offset of the element.
| x | X offset |
Definition at line 130 of file GuiElement.cpp.
| void GuiElement::setMinY | ( | int | y | ) |
Sets the minimum y offset of the element.
| y | Y offset |
Definition at line 150 of file GuiElement.cpp.
| void GuiElement::setParent | ( | GuiElement * | e | ) |
Set the element's parent.
| e | Pointer to parent element |
Definition at line 58 of file GuiElement.cpp.
| void GuiElement::setPosition | ( | int | x, |
| int | y ) |
Sets the element's position.
| x | X coordinate |
| y | Y coordinate |
Definition at line 545 of file GuiElement.cpp.
|
inline |
Whether to notify parent on destruction to allow removal.
Definition at line 76 of file GuiElement.h.
| void GuiElement::setRumble | ( | bool | r | ) |
Sets whether or not the element is requesting a rumble event.
| r | true if requesting rumble, false if not |
Definition at line 377 of file GuiElement.cpp.
| void GuiElement::setScale | ( | float | s | ) |
Sets the element's x and y scale.
| s | scale (1 is 100%) |
Definition at line 215 of file GuiElement.cpp.
| void GuiElement::setScale | ( | int | w, |
| int | h ) |
Sets the element's x and y scale, using the provided max width/height.
| w | Maximum width |
| h | Maximum height |
Definition at line 231 of file GuiElement.cpp.
| void GuiElement::setScaleX | ( | float | s | ) |
Sets the element's x scale.
| s | scale (1 is 100%) |
Definition at line 221 of file GuiElement.cpp.
| void GuiElement::setScaleY | ( | float | s | ) |
Sets the element's y scale.
| s | scale (1 is 100%) |
Definition at line 226 of file GuiElement.cpp.
| void GuiElement::setSelectable | ( | bool | s | ) |
Sets whether or not the element is selectable.
| s | Selectable |
Definition at line 304 of file GuiElement.cpp.
| void GuiElement::setSize | ( | int | w, |
| int | h ) |
Sets the size (width/height) of the element.
| w | Width of element |
| h | Height of element |
Definition at line 180 of file GuiElement.cpp.
|
virtual |
Sets the element's state.
| s | State (STATE::DEFAULT, STATE::SELECTED, STATE::CLICKED, STATE::DISABLED) |
| c | Controller channel (0-3, -1 = none) |
Reimplemented in GuiButton, and GuiWindow.
Definition at line 284 of file GuiElement.cpp.
| void GuiElement::setTrigger | ( | GuiTrigger * | t | ) |
Set a new GuiTrigger for the element.
| t | Pointer to GuiTrigger |
Definition at line 350 of file GuiElement.cpp.
| void GuiElement::setTrigger | ( | uint8_t | i, |
| GuiTrigger * | t ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| i | Index of trigger array to set |
| t | Pointer to GuiTrigger |
Definition at line 366 of file GuiElement.cpp.
| void GuiElement::setUpdateCallback | ( | UpdateCallback | u | ) |
Sets a function to called after after Update() Callback function can be used to response to changes in the state of the element, and/or update the element's attributes.
Definition at line 540 of file GuiElement.cpp.
|
virtual |
Sets the element's visibility.
| v | Visibility (true = visible) |
Reimplemented in GuiWindow.
Definition at line 192 of file GuiElement.cpp.
|
virtual |
Called constantly to allow the element to respond to the current input data.
| c | Pointer to a InputController, containing the current input data |
Reimplemented in GuiButton, GuiFileBrowser, GuiKeyboard, GuiLayout, GuiOptionBrowser, GuiWindow, and UiScope::Runner.
Definition at line 534 of file GuiElement.cpp.
| void GuiElement::updateEffects | ( | ) |
Updates the element's effects (dynamic values) Called by Draw(), used for animation purposes.
Definition at line 426 of file GuiElement.cpp.
|
protected |
Horizontal element alignment, respective to parent element (LEFT, RIGHT, CENTRE)
Definition at line 289 of file GuiElement.h.
|
protected |
Horizontal element alignment, respective to parent element (TOP, BOTTOM, MIDDLE)
Definition at line 290 of file GuiElement.h.
|
protected |
Element alpha value (0-255)
Definition at line 278 of file GuiElement.h.
|
protected |
Element alpha, dynamic (multiplied by alpha value for blending/fading effects)
Definition at line 279 of file GuiElement.h.
|
protected |
Whether or not this element is clickable (can change to CLICKED state)
Definition at line 294 of file GuiElement.h.
|
protected |
Effect amount.
Used by different effects for different purposes
Definition at line 284 of file GuiElement.h.
|
protected |
EffectAmount to set when wiimote cursor is over this element.
Definition at line 287 of file GuiElement.h.
|
protected |
Currently enabled effect(s).
0 when no effects are enabled
Definition at line 283 of file GuiElement.h.
|
protected |
Effects to enable when wiimote cursor is over this element.
Copied to effects variable on over event
Definition at line 286 of file GuiElement.h.
|
protected |
Effect target amount.
Used by different effects for different purposes
Definition at line 285 of file GuiElement.h.
|
protected |
EffectTarget to set when wiimote cursor is over this element.
Definition at line 288 of file GuiElement.h.
|
protected |
Element focus (-1 = focus disabled, 0 = not focused, 1 = focused)
Definition at line 267 of file GuiElement.h.
|
protected |
Element height.
Definition at line 269 of file GuiElement.h.
|
protected |
Whether or not this element is holdable (can change to HELD state)
Definition at line 295 of file GuiElement.h.
|
protected |
Parent element.
Definition at line 265 of file GuiElement.h.
|
protected |
Whether to instruct parent to remove this element when it is destroyed.
Definition at line 266 of file GuiElement.h.
|
protected |
Wiimote rumble (on/off) - set to on when this element requests a rumble event.
Definition at line 297 of file GuiElement.h.
|
protected |
Element scale, dynamic (multiplied by alpha value for blending/fading effects)
Definition at line 282 of file GuiElement.h.
|
protected |
Whether or not this element selectable (can change to SELECTED state)
Definition at line 293 of file GuiElement.h.
|
protected |
Element state (DEFAULT, SELECTED, CLICKED, DISABLED)
Definition at line 291 of file GuiElement.h.
|
protected |
Which controller channel is responsible for the last change in state.
Definition at line 292 of file GuiElement.h.
|
protected |
GuiTriggers (input actions) that this element responds to.
Definition at line 263 of file GuiElement.h.
|
protected |
Callback function to call when this element is updated.
Definition at line 264 of file GuiElement.h.
|
protected |
|
protected |
Element width.
Definition at line 268 of file GuiElement.h.
|
protected |
Element's max X offset allowed.
Definition at line 275 of file GuiElement.h.
|
protected |
Element's min X offset allowed.
Definition at line 274 of file GuiElement.h.
|
protected |
Element X offset.
Definition at line 270 of file GuiElement.h.
|
protected |
Element X offset, dynamic (added to xoffset value for animation effects)
Definition at line 276 of file GuiElement.h.
|
protected |
Element X scale (1 = 100%)
Definition at line 280 of file GuiElement.h.
|
protected |
Element's max Y offset allowed.
Definition at line 273 of file GuiElement.h.
|
protected |
Element's min Y offset allowed.
Definition at line 272 of file GuiElement.h.
|
protected |
Element Y offset.
Definition at line 271 of file GuiElement.h.
|
protected |
Element Y offset, dynamic (added to yoffset value for animation effects)
Definition at line 277 of file GuiElement.h.
|
protected |
Element Y scale (1 = 100%)
Definition at line 281 of file GuiElement.h.