Public Member Functions | Protected Attributes

GuiElement Class Reference

Primary GUI class. Most other classes inherit from this class. More...

#include <gui.h>

Inheritance diagram for GuiElement:
GuiButton GuiFileBrowser GuiImage GuiOptionBrowser GuiText GuiWindow GuiKeyboard

List of all members.

Public Member Functions

 GuiElement ()
 Constructor.
 ~GuiElement ()
 Destructor.
void SetParent (GuiElement *e)
GuiElementGetParent ()
int GetLeft ()
int GetTop ()
void SetMinY (int y)
int GetMinY ()
void SetMaxY (int y)
int GetMaxY ()
void SetMinX (int x)
int GetMinX ()
void SetMaxX (int x)
int GetMaxX ()
int GetWidth ()
int GetHeight ()
void SetSize (int w, int h)
bool IsVisible ()
bool IsSelectable ()
bool IsClickable ()
bool IsHoldable ()
void SetSelectable (bool s)
void SetClickable (bool c)
void SetHoldable (bool d)
int GetState ()
int GetStateChan ()
void SetAlpha (int a)
int GetAlpha ()
void SetScale (float s)
float GetScale ()
void SetTrigger (GuiTrigger *t)
void SetTrigger (u8 i, GuiTrigger *t)
bool Rumble ()
void SetRumble (bool r)
void SetEffect (int e, int a, int t=0)
void SetEffectOnOver (int e, int a, int t=0)
void SetEffectGrow ()
 Shortcut to SetEffectOnOver(EFFECT_SCALE, 4, 110).
int GetEffect ()
bool IsInside (int x, int y)
void SetPosition (int x, int y)
void UpdateEffects ()
void SetUpdateCallback (UpdateCallback u)
int IsFocused ()
virtual void SetVisible (bool v)
virtual void SetFocus (int f)
virtual void SetState (int s, int c=-1)
virtual void ResetState ()
 Resets the element's state to STATE_DEFAULT.
virtual int GetSelected ()
virtual void SetAlignment (int hor, int vert)
virtual void Update (GuiTrigger *t)
virtual void Draw ()
 Called constantly to redraw the element.

Protected Attributes

bool visible
 Visibility of the element. If false, Draw() is skipped.
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).
f32 scale
 Element scale (1 = 100%).
int alphaDyn
 Element alpha, dynamic (multiplied by alpha value for blending/fading effects).
f32 scaleDyn
 Element scale, dynamic (multiplied by alpha value for blending/fading effects).
bool rumble
 Wiimote rumble (on/off) - set to on when this element requests a rumble event.
int effects
 Currently enabled effect(s). 0 when no effects are enabled.
int effectAmount
 Effect amount. Used by different effects for different purposes.
int effectTarget
 Effect target amount. Used by different effects for different purposes.
int effectsOver
 Effects to enable when wiimote cursor is over this element. Copied to effects variable on over event.
int effectAmountOver
 EffectAmount to set when wiimote cursor is over this element.
int effectTargetOver
 EffectTarget to set when wiimote cursor is over this element.
int alignmentHor
 Horizontal element alignment, respective to parent element (LEFT, RIGHT, CENTRE).
int alignmentVert
 Horizontal element alignment, respective to parent element (TOP, BOTTOM, MIDDLE).
int 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).
GuiTriggertrigger [2]
 GuiTriggers (input actions) that this element responds to.
GuiElementparentElement
 Parent element.
UpdateCallback updateCB
 Callback function to call when this element is updated.

Detailed Description

Primary GUI class. Most other classes inherit from this class.

Definition at line 223 of file gui.h.


Constructor & Destructor Documentation

GuiElement::GuiElement (  ) 

Constructor.

Constructor for the Object class.

Definition at line 16 of file gui_element.cpp.

GuiElement::~GuiElement (  ) 

Destructor.

Destructor for the GuiElement class.

Definition at line 59 of file gui_element.cpp.


Member Function Documentation

void GuiElement::Draw (  )  [virtual]

Called constantly to redraw the element.

Draw an element on screen.

Reimplemented in GuiWindow, GuiImage, GuiText, GuiButton, GuiOptionBrowser, and GuiFileBrowser.

Definition at line 556 of file gui_element.cpp.

int GuiElement::GetAlpha (  ) 

Gets the element's alpha value Considers alpha, alphaDyn, and the parent element's GetAlpha() value

Returns:
alpha

Definition at line 242 of file gui_element.cpp.

int GuiElement::GetEffect (  ) 

Gets the current element effects

Returns:
element effects

Definition at line 373 of file gui_element.cpp.

int GuiElement::GetHeight (  ) 

Gets the height of the element. Does not currently consider the scale

Returns:
height

Get the height of the GuiElement.

See also:
SetHeight()
Returns:
Height of the GuiElement.

Definition at line 198 of file gui_element.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

Returns:
left coordinate

Get the left position of the GuiElement.

See also:
SetLeft()
Returns:
Left position in pixel.

Definition at line 78 of file gui_element.cpp.

int GuiElement::GetMaxX (  ) 

Gets the maximum x offset of the element

Returns:
Maximum X offset

Definition at line 158 of file gui_element.cpp.

int GuiElement::GetMaxY (  ) 

Gets the maximum y offset of the element

Returns:
Maximum Y offset

Definition at line 178 of file gui_element.cpp.

int GuiElement::GetMinX (  ) 

Gets the minimum x offset of the element

Returns:
Minimum X offset

Definition at line 148 of file gui_element.cpp.

int GuiElement::GetMinY (  ) 

Gets the minimum y offset of the element

Returns:
Minimum Y offset

Definition at line 168 of file gui_element.cpp.

GuiElement * GuiElement::GetParent (  ) 

Gets the element's parent

Returns:
Pointer to parent element

Definition at line 68 of file gui_element.cpp.

float GuiElement::GetScale (  ) 

Gets the element's current scale Considers scale, scaleDyn, and the parent element's GetScale() value

Definition at line 262 of file gui_element.cpp.

int GuiElement::GetSelected (  )  [virtual]

Gets whether or not the element is in STATE_SELECTED

Returns:
true if selected, false otherwise

Reimplemented in GuiWindow.

Definition at line 548 of file gui_element.cpp.

int GuiElement::GetState (  ) 

Gets the element's current state

Returns:
state

Definition at line 272 of file gui_element.cpp.

int GuiElement::GetStateChan (  ) 

Gets the controller channel that last changed the element's state

Returns:
Channel number (0-3, -1 = no channel)

Definition at line 277 of file gui_element.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

Returns:
top coordinate

Get the top position of the GuiElement.

See also:
SetTop()
Returns:
Top position in pixel.

Definition at line 113 of file gui_element.cpp.

int GuiElement::GetWidth (  ) 

Gets the current width of the element. Does not currently consider the scale

Returns:
width

Get the width of the GuiElement.

See also:
SetWidth()
Returns:
Width of the GuiElement.

Definition at line 188 of file gui_element.cpp.

bool GuiElement::IsClickable (  ) 

Checks whether or not the element is clickable

Returns:
true if clickable, false otherwise

Definition at line 320 of file gui_element.cpp.

int GuiElement::IsFocused (  ) 

Checks whether the element is in focus

Returns:
true if element is in focus, false otherwise

Definition at line 343 of file gui_element.cpp.

bool GuiElement::IsHoldable (  ) 

Checks whether or not the element is holdable

Returns:
true if holdable, false otherwise

Definition at line 330 of file gui_element.cpp.

bool GuiElement::IsInside ( int  x,
int  y 
)

Checks whether the specified coordinates are within the element's boundaries

Parameters:
x X coordinate
y Y coordinate
Returns:
true if contained within, false otherwise

Check if a position is inside the GuiElement.

Parameters:
[in] x X position in pixel.
[in] y Y position in pixel.

Definition at line 565 of file gui_element.cpp.

bool GuiElement::IsSelectable (  ) 

Checks whether or not the element is selectable

Returns:
true if selectable, false otherwise

Definition at line 312 of file gui_element.cpp.

bool GuiElement::IsVisible (  ) 

Checks whether or not the element is visible

Returns:
true if visible, false otherwise

Get visible.

See also:
SetVisible()
Returns:
true if visible, false otherwise.

Definition at line 222 of file gui_element.cpp.

bool GuiElement::Rumble (  ) 

Checks whether rumble was requested by the element

Returns:
true is rumble was requested, false otherwise

Definition at line 363 of file gui_element.cpp.

void GuiElement::SetAlignment ( int  hor,
int  vert 
) [virtual]

Sets the element's alignment respective to its parent element

Parameters:
hor Horizontal alignment (ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTRE)
vert Vertical alignment (ALIGN_TOP, ALIGN_BOTTOM, ALIGN_MIDDLE)

Reimplemented in GuiText.

Definition at line 542 of file gui_element.cpp.

void GuiElement::SetAlpha ( int  a  ) 

Sets the element's alpha value

Parameters:
a alpha value

Definition at line 237 of file gui_element.cpp.

void GuiElement::SetClickable ( bool  c  ) 

Sets whether or not the element is clickable

Parameters:
c Clickable

Definition at line 297 of file gui_element.cpp.

void GuiElement::SetEffect ( int  e,
int  a,
int  t = 0 
)

Set an effect for the element

Parameters:
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 378 of file gui_element.cpp.

void GuiElement::SetEffectOnOver ( int  e,
int  a,
int  t = 0 
)

Sets an effect to be enabled on wiimote cursor over

Parameters:
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 406 of file gui_element.cpp.

void GuiElement::SetFocus ( int  f  )  [virtual]

Sets the element's focus

Parameters:
f Focus (true = in focus)

Reimplemented in GuiWindow, GuiOptionBrowser, and GuiFileBrowser.

Definition at line 338 of file gui_element.cpp.

void GuiElement::SetHoldable ( bool  d  ) 

Sets whether or not the element is holdable

Parameters:
c Holdable

Definition at line 307 of file gui_element.cpp.

void GuiElement::SetMaxX ( int  x  ) 

Sets the maximum x offset of the element

Parameters:
x X offset

Definition at line 153 of file gui_element.cpp.

void GuiElement::SetMaxY ( int  y  ) 

Sets the maximum y offset of the element

Parameters:
y Y offset

Definition at line 173 of file gui_element.cpp.

void GuiElement::SetMinX ( int  x  ) 

Sets the minimum x offset of the element

Parameters:
x X offset

Definition at line 143 of file gui_element.cpp.

void GuiElement::SetMinY ( int  y  ) 

Sets the minimum y offset of the element

Parameters:
y Y offset

Definition at line 163 of file gui_element.cpp.

void GuiElement::SetParent ( GuiElement e  ) 

Set the element's parent

Parameters:
e Pointer to parent element

Definition at line 63 of file gui_element.cpp.

void GuiElement::SetPosition ( int  x,
int  y 
)

Sets the element's position

Parameters:
x X coordinate
y Y coordinate

Definition at line 536 of file gui_element.cpp.

void GuiElement::SetRumble ( bool  r  ) 

Sets whether or not the element is requesting a rumble event

Parameters:
r true if requesting rumble, false if not

Definition at line 368 of file gui_element.cpp.

void GuiElement::SetScale ( float  s  ) 

Sets the element's scale

Parameters:
s scale (1 is 100%)

Definition at line 257 of file gui_element.cpp.

void GuiElement::SetSelectable ( bool  s  ) 

Sets whether or not the element is selectable

Parameters:
s Selectable

Definition at line 302 of file gui_element.cpp.

void GuiElement::SetSize ( int  w,
int  h 
)

Sets the size (width/height) of the element

Parameters:
w Width of element
h Height of element

Set the width and height of the GuiElement.

Parameters:
[in] Width Width in pixel.
[in] Height Height in pixel.
See also:
SetWidth()
SetHeight()

Definition at line 210 of file gui_element.cpp.

void GuiElement::SetState ( int  s,
int  c = -1 
) [virtual]

Sets the element's state

Parameters:
s State (STATE_DEFAULT, STATE_SELECTED, STATE_CLICKED, STATE_DISABLED)
c Controller channel (0-3, -1 = none)

Definition at line 282 of file gui_element.cpp.

void GuiElement::SetTrigger ( u8  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.

Parameters:
i Index of trigger array to set
t Pointer to GuiTrigger

Definition at line 358 of file gui_element.cpp.

void GuiElement::SetTrigger ( GuiTrigger t  ) 

Set a new GuiTrigger for the element

Parameters:
t Pointer to GuiTrigger

Definition at line 348 of file gui_element.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 531 of file gui_element.cpp.

void GuiElement::SetVisible ( bool  v  )  [virtual]

Sets the element's visibility

Parameters:
v Visibility (true = visible)

Set visible.

Parameters:
[in] Visible Set to true to show GuiElement.
See also:
IsVisible()

Reimplemented in GuiWindow.

Definition at line 232 of file gui_element.cpp.

void GuiElement::Update ( GuiTrigger t  )  [virtual]

Called constantly to allow the element to respond to the current input data

Parameters:
t Pointer to a GuiTrigger, containing the current input data from PAD/WPAD

Reimplemented in GuiWindow, GuiButton, GuiKeyboard, GuiOptionBrowser, and GuiFileBrowser.

Definition at line 525 of file gui_element.cpp.

void GuiElement::UpdateEffects (  ) 

Updates the element's effects (dynamic values) Called by Draw(), used for animation purposes

Definition at line 418 of file gui_element.cpp.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Enumerations Enumerator Defines