libwiigui 1.07
libwiigui is a GUI library for the Wii
 
Loading...
Searching...
No Matches
GuiElement Class Referenceabstract

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

#include <gui_element.h>

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

Public Member Functions

 GuiElement ()
 Constructor. More...
 
virtual ~GuiElement ()
 Destructor. More...
 
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 h)
 
STATE GetState ()
 
int GetStateChan ()
 
void SetAlpha (int a)
 
int GetAlpha ()
 
void SetScale (float s)
 
void SetScaleX (float s)
 
void SetScaleY (float s)
 
void SetScale (int w, int h)
 
float GetScale ()
 
float GetScaleX ()
 
float GetScaleY ()
 
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 (STATE s, int c=-1)
 
virtual void ResetState ()
 Resets the element's state to STATE::DEFAULT. More...
 
virtual int GetSelected ()
 
virtual void SetAlignment (ALIGN_H hor, ALIGN_V vert)
 
virtual void ResetText ()
 Called when the language has changed, to obtain new text values for all text elements. More...
 
virtual void Update (GuiTrigger *t)
 
virtual void Draw ()=0
 Called constantly to redraw the element. More...
 
virtual void DrawTooltip ()
 Called constantly to redraw the element's tooltip. More...
 

Protected Attributes

GuiTriggertrigger [MAX_TRIGGERS]
 GuiTriggers (input actions) that this element responds to.
 
UpdateCallback updateCB
 Callback function to call when this element is updated.
 
GuiElementparentElement
 Parent element.
 
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)
 
f32 xscale
 Element X scale (1 = 100%)
 
f32 yscale
 Element Y scale (1 = 100%)
 
f32 scaleDyn
 Element scale, dynamic (multiplied by alpha value for blending/fading effects)
 
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.
 
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. If false, Draw() is skipped.
 
bool rumble
 Wiimote rumble (on/off) - set to on when this element requests a rumble event.
 

Detailed Description

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

Constructor & Destructor Documentation

◆ GuiElement()

GuiElement::GuiElement ( )

Constructor.

Constructor for the Object class.

◆ ~GuiElement()

GuiElement::~GuiElement ( )
virtual

Destructor.

Destructor for the GuiElement class.

Member Function Documentation

◆ Draw()

virtual void GuiElement::Draw ( )
pure virtual

Called constantly to redraw the element.

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

◆ DrawTooltip()

void GuiElement::DrawTooltip ( )
virtual

Called constantly to redraw the element's tooltip.

Reimplemented in GuiButton, GuiTooltip, and GuiWindow.

◆ GetAlpha()

int GuiElement::GetAlpha ( )

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

Returns
alpha

◆ GetEffect()

int GuiElement::GetEffect ( )

Gets the current element effects

Returns
element effects

◆ GetHeight()

int GuiElement::GetHeight ( )

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

Returns
height

◆ GetLeft()

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

◆ GetMaxX()

int GuiElement::GetMaxX ( )

Gets the maximum x offset of the element

Returns
Maximum X offset

◆ GetMaxY()

int GuiElement::GetMaxY ( )

Gets the maximum y offset of the element

Returns
Maximum Y offset

◆ GetMinX()

int GuiElement::GetMinX ( )

Gets the minimum x offset of the element

Returns
Minimum X offset

◆ GetMinY()

int GuiElement::GetMinY ( )

Gets the minimum y offset of the element

Returns
Minimum Y offset

◆ GetParent()

GuiElement * GuiElement::GetParent ( )

Gets the element's parent

Returns
Pointer to parent element

◆ GetScale()

float GuiElement::GetScale ( )

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

◆ GetScaleX()

float GuiElement::GetScaleX ( )

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

◆ GetScaleY()

float GuiElement::GetScaleY ( )

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

◆ GetSelected()

int GuiElement::GetSelected ( )
virtual

Gets whether or not the element is in STATE::SELECTED

Returns
true if selected, false otherwise

Reimplemented in GuiWindow.

◆ GetState()

STATE GuiElement::GetState ( )

Gets the element's current state

Returns
state

◆ GetStateChan()

int GuiElement::GetStateChan ( )

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

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

◆ GetTop()

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

◆ GetWidth()

int GuiElement::GetWidth ( )

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

Returns
width

◆ IsClickable()

bool GuiElement::IsClickable ( )

Checks whether or not the element is clickable

Returns
true if clickable, false otherwise

◆ IsFocused()

int GuiElement::IsFocused ( )

Checks whether the element is in focus

Returns
true if element is in focus, false otherwise

◆ IsHoldable()

bool GuiElement::IsHoldable ( )

Checks whether or not the element is holdable

Returns
true if holdable, false otherwise

◆ IsInside()

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

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

Parameters
xX coordinate
yY coordinate
Returns
true if contained within, false otherwise

◆ IsSelectable()

bool GuiElement::IsSelectable ( )

Checks whether or not the element is selectable

Returns
true if selectable, false otherwise

◆ IsVisible()

bool GuiElement::IsVisible ( )

Checks whether or not the element is visible

Returns
true if visible, false otherwise

◆ ResetState()

void GuiElement::ResetState ( )
virtual

Resets the element's state to STATE::DEFAULT.

Reimplemented in GuiFileBrowser, GuiOptionBrowser, and GuiWindow.

◆ ResetText()

void GuiElement::ResetText ( )
virtual

Called when the language has changed, to obtain new text values for all text elements.

Reimplemented in GuiButton, GuiOptionBrowser, GuiText, and GuiWindow.

◆ Rumble()

bool GuiElement::Rumble ( )

Checks whether rumble was requested by the element

Returns
true is rumble was requested, false otherwise

◆ SetAlignment()

void GuiElement::SetAlignment ( ALIGN_H  hor,
ALIGN_V  vert 
)
virtual

Sets the element's alignment respective to its parent element

Parameters
horHorizontal alignment (LEFT, RIGHT, CENTRE)
vertVertical alignment (TOP, BOTTOM, MIDDLE)

Reimplemented in GuiText.

◆ SetAlpha()

void GuiElement::SetAlpha ( int  a)

Sets the element's alpha value

Parameters
aalpha value

◆ SetClickable()

void GuiElement::SetClickable ( bool  c)

Sets whether or not the element is clickable

Parameters
cClickable

◆ SetEffect()

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

Set an effect for the element

Parameters
eEffect to enable
aAmount of the effect (usage varies on effect)
tTarget amount of the effect (usage varies on effect)

◆ SetEffectOnOver()

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

Sets an effect to be enabled on wiimote cursor over

Parameters
eEffect to enable
aAmount of the effect (usage varies on effect)
tTarget amount of the effect (usage varies on effect)

◆ SetFocus()

void GuiElement::SetFocus ( int  f)
virtual

Sets the element's focus

Parameters
fFocus (true = in focus)

Reimplemented in GuiFileBrowser, GuiOptionBrowser, and GuiWindow.

◆ SetHoldable()

void GuiElement::SetHoldable ( bool  h)

Sets whether or not the element is holdable

Parameters
hHoldable

◆ SetMaxX()

void GuiElement::SetMaxX ( int  x)

Sets the maximum x offset of the element

Parameters
xX offset

◆ SetMaxY()

void GuiElement::SetMaxY ( int  y)

Sets the maximum y offset of the element

Parameters
yY offset

◆ SetMinX()

void GuiElement::SetMinX ( int  x)

Sets the minimum x offset of the element

Parameters
xX offset

◆ SetMinY()

void GuiElement::SetMinY ( int  y)

Sets the minimum y offset of the element

Parameters
yY offset

◆ SetParent()

void GuiElement::SetParent ( GuiElement e)

Set the element's parent

Parameters
ePointer to parent element

◆ SetPosition()

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

Sets the element's position

Parameters
xX coordinate
yY coordinate

◆ SetRumble()

void GuiElement::SetRumble ( bool  r)

Sets whether or not the element is requesting a rumble event

Parameters
rtrue if requesting rumble, false if not

◆ SetScale() [1/2]

void GuiElement::SetScale ( float  s)

Sets the element's x and y scale

Parameters
sscale (1 is 100%)

◆ SetScale() [2/2]

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

Sets the element's x and y scale, using the provided max width/height

Parameters
wMaximum width
hMaximum height

◆ SetScaleX()

void GuiElement::SetScaleX ( float  s)

Sets the element's x scale

Parameters
sscale (1 is 100%)

◆ SetScaleY()

void GuiElement::SetScaleY ( float  s)

Sets the element's y scale

Parameters
sscale (1 is 100%)

◆ SetSelectable()

void GuiElement::SetSelectable ( bool  s)

Sets whether or not the element is selectable

Parameters
sSelectable

◆ SetSize()

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

Sets the size (width/height) of the element

Parameters
wWidth of element
hHeight of element

◆ SetState()

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

Sets the element's state

Parameters
sState (STATE::DEFAULT, STATE::SELECTED, STATE::CLICKED, STATE::DISABLED)
cController channel (0-3, -1 = none)

◆ SetTrigger() [1/2]

void GuiElement::SetTrigger ( GuiTrigger t)

Set a new GuiTrigger for the element

Parameters
tPointer to GuiTrigger

◆ SetTrigger() [2/2]

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
iIndex of trigger array to set
tPointer to GuiTrigger

◆ SetUpdateCallback()

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

◆ SetVisible()

void GuiElement::SetVisible ( bool  v)
virtual

Sets the element's visibility

Parameters
vVisibility (true = visible)

Reimplemented in GuiWindow.

◆ Update()

void GuiElement::Update ( GuiTrigger t)
virtual

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

Parameters
tPointer to a GuiTrigger, containing the current input data from PAD/WPAD

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

◆ UpdateEffects()

void GuiElement::UpdateEffects ( )

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


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