libwiigui 1.07
libwiigui is a GUI library for the Wii
 
Loading...
Searching...
No Matches
GuiButton Class Reference

Display, manage, and manipulate buttons in the GUI. Buttons can have images, icons, text, and sound set (all of which are optional) More...

#include <gui_button.h>

Inheritance diagram for GuiButton:
GuiElement

Public Member Functions

 GuiButton (int w=0, int h=0)
 
 ~GuiButton ()
 Destructor. More...
 
void SetImage (GuiImage *i)
 
void SetImageOver (GuiImage *i)
 
void SetImageHold (GuiImage *i)
 
void SetImageClick (GuiImage *i)
 
void SetIcon (GuiImage *i)
 
void SetIconOver (GuiImage *i)
 
void SetIconHold (GuiImage *i)
 
void SetIconClick (GuiImage *i)
 
void SetLabel (GuiText *t, int n=0)
 
void SetLabelOver (GuiText *t, int n=0)
 
void SetLabelHold (GuiText *t, int n=0)
 
void SetLabelClick (GuiText *t, int n=0)
 
void SetSoundOver (GuiSound *s)
 
void SetSoundHold (GuiSound *s)
 
void SetSoundClick (GuiSound *s)
 
void SetTooltip (GuiTooltip *t)
 
void Draw () override
 Constantly called to draw the GuiButton. More...
 
void DrawTooltip ()
 Constantly called to draw the GuiButton's tooltip. More...
 
void ResetText ()
 Resets the text for all contained elements. More...
 
void Update (GuiTrigger *t)
 
- Public Member Functions inherited from GuiElement
 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

GuiImageimage
 Button image (default)
 
GuiImageimageOver
 Button image for STATE_SELECTED.
 
GuiImageimageHold
 Button image for STATE_HELD.
 
GuiImageimageClick
 Button image for STATE_CLICKED.
 
GuiImageicon
 Button icon (drawn after button image)
 
GuiImageiconOver
 Button icon for STATE_SELECTED.
 
GuiImageiconHold
 Button icon for STATE_HELD.
 
GuiImageiconClick
 Button icon for STATE_CLICKED.
 
GuiTextlabel [3]
 Label(s) to display (default)
 
GuiTextlabelOver [3]
 Label(s) to display for STATE_SELECTED.
 
GuiTextlabelHold [3]
 Label(s) to display for STATE_HELD.
 
GuiTextlabelClick [3]
 Label(s) to display for STATE_CLICKED.
 
GuiSoundsoundOver
 Sound to play for STATE_SELECTED.
 
GuiSoundsoundHold
 Sound to play for STATE_HELD.
 
GuiSoundsoundClick
 Sound to play for STATE_CLICKED.
 
GuiTooltiptooltip
 Tooltip to display on over.
 
- Protected Attributes inherited from GuiElement
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

Display, manage, and manipulate buttons in the GUI. Buttons can have images, icons, text, and sound set (all of which are optional)

Constructor & Destructor Documentation

◆ GuiButton()

GuiButton::GuiButton ( int  w = 0,
int  h = 0 
)

Constructor

Parameters
wWidth
hHeight

Constructor for the GuiButton class.

◆ ~GuiButton()

GuiButton::~GuiButton ( )

Destructor.

Destructor for the GuiButton class.

Member Function Documentation

◆ Draw()

void GuiButton::Draw ( )
overridevirtual

Constantly called to draw the GuiButton.

Draw the button on screen

Implements GuiElement.

◆ DrawTooltip()

void GuiButton::DrawTooltip ( )
virtual

Constantly called to draw the GuiButton's tooltip.

Reimplemented from GuiElement.

◆ ResetText()

void GuiButton::ResetText ( )
virtual

Resets the text for all contained elements.

Reimplemented from GuiElement.

◆ SetIcon()

void GuiButton::SetIcon ( GuiImage i)

Sets the button's icon

Parameters
iPointer to GuiImage object

◆ SetIconClick()

void GuiButton::SetIconClick ( GuiImage i)

Sets the button's icon on click

Parameters
iPointer to GuiImage object

◆ SetIconHold()

void GuiButton::SetIconHold ( GuiImage i)

Sets the button's icon on hold

Parameters
iPointer to GuiImage object

◆ SetIconOver()

void GuiButton::SetIconOver ( GuiImage i)

Sets the button's icon on over

Parameters
iPointer to GuiImage object

◆ SetImage()

void GuiButton::SetImage ( GuiImage i)

Sets the button's image

Parameters
iPointer to GuiImage object

◆ SetImageClick()

void GuiButton::SetImageClick ( GuiImage i)

Sets the button's image on click

Parameters
iPointer to GuiImage object

◆ SetImageHold()

void GuiButton::SetImageHold ( GuiImage i)

Sets the button's image on hold

Parameters
iPointer to GuiImage object

◆ SetImageOver()

void GuiButton::SetImageOver ( GuiImage i)

Sets the button's image on over

Parameters
iPointer to GuiImage object

◆ SetLabel()

void GuiButton::SetLabel ( GuiText t,
int  n = 0 
)

Sets the button's label

Parameters
tPointer to GuiText object
nIndex of label to set (optional, default is 0)

◆ SetLabelClick()

void GuiButton::SetLabelClick ( GuiText t,
int  n = 0 
)

Sets the button's label on click

Parameters
tPointer to GuiText object
nIndex of label to set (optional, default is 0)

◆ SetLabelHold()

void GuiButton::SetLabelHold ( GuiText t,
int  n = 0 
)

Sets the button's label on hold

Parameters
tPointer to GuiText object
nIndex of label to set (optional, default is 0)

◆ SetLabelOver()

void GuiButton::SetLabelOver ( GuiText t,
int  n = 0 
)

Sets the button's label on over (eg: different colored text)

Parameters
tPointer to GuiText object
nIndex of label to set (optional, default is 0)

◆ SetSoundClick()

void GuiButton::SetSoundClick ( GuiSound s)

Sets the sound to play on click

Parameters
sPointer to GuiSound object

◆ SetSoundHold()

void GuiButton::SetSoundHold ( GuiSound s)

Sets the sound to play on hold

Parameters
sPointer to GuiSound object

◆ SetSoundOver()

void GuiButton::SetSoundOver ( GuiSound s)

Sets the sound to play on over

Parameters
sPointer to GuiSound object

◆ SetTooltip()

void GuiButton::SetTooltip ( GuiTooltip t)

Sets the tooltip for the button

Parameters
tTooltip

◆ Update()

void GuiButton::Update ( GuiTrigger t)
virtual

Constantly called to allow the GuiButton to respond to updated input data

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

Reimplemented from GuiElement.


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