libgui
2.01
libgui is a GUI library for the GameCube, Wii, and Wii U
Loading...
Searching...
No Matches
GuiButton.h
1
/****************************************************************************
2
* libgui
3
* Daryl Borth 2009-2026
4
* GuiButton.h
5
***************************************************************************/
6
#pragma once
7
8
#define MAX_BTN_LABELS 3
9
12
class
GuiButton
:
public
GuiElement
13
{
14
public
:
18
GuiButton
(
int
w = 0,
int
h = 0);
20
~GuiButton
();
23
void
setImage
(
GuiElement
* i);
26
void
setImageOver
(
GuiElement
* i);
29
void
setImageHold
(
GuiElement
* i);
32
void
setImageClick
(
GuiElement
* i);
35
void
setIcon
(
GuiElement
* i);
38
void
setIconOver
(
GuiElement
* i);
41
void
setIconHold
(
GuiElement
* i);
44
void
setIconClick
(
GuiElement
* i);
48
void
setLabel
(
GuiText
* t,
int
n = 0);
52
void
setLabelOver
(
GuiText
* t,
int
n = 0);
56
void
setLabelHold
(
GuiText
* t,
int
n = 0);
60
void
setLabelClick
(
GuiText
* t,
int
n = 0);
63
void
setSoundOver
(
GuiSound
* s);
66
void
setSoundHold
(
GuiSound
* s);
69
void
setSoundClick
(
GuiSound
* s);
71
void
draw
()
override
;
73
void
resetText
();
76
void
setState
(
STATE
s,
int
c = -1)
override
;
78
void
resetState
()
override
;
81
void
update
(
InputController
* c);
82
protected
:
83
GuiElement
*
image
;
84
GuiElement
*
imageOver
;
85
GuiElement
*
imageHold
;
86
GuiElement
*
imageClick
;
87
GuiElement
*
icon
;
88
GuiElement
*
iconOver
;
89
GuiElement
*
iconHold
;
90
GuiElement
*
iconClick
;
91
GuiText
*
label
[MAX_BTN_LABELS];
92
GuiText
*
labelOver
[MAX_BTN_LABELS];
93
GuiText
*
labelHold
[MAX_BTN_LABELS];
94
GuiText
*
labelClick
[MAX_BTN_LABELS];
95
GuiSound
*
soundOver
;
96
GuiSound
*
soundHold
;
97
GuiSound
*
soundClick
;
98
};
GuiButton::iconClick
GuiElement * iconClick
Button icon for STATE::CLICKED.
Definition
GuiButton.h:90
GuiButton::setLabel
void setLabel(GuiText *t, int n=0)
Sets the button's label.
Definition
GuiButton.cpp:82
GuiButton::resetState
void resetState() override
Resets the state and mirrors it into the button's images and icons.
Definition
GuiButton.cpp:115
GuiButton::labelOver
GuiText * labelOver[MAX_BTN_LABELS]
Label(s) to display for STATE::SELECTED.
Definition
GuiButton.h:92
GuiButton::image
GuiElement * image
Button image (default): a GuiImage, GuiShape or any element.
Definition
GuiButton.h:83
GuiButton::update
void update(InputController *c)
Constantly called to allow the GuiButton to respond to updated input data.
Definition
GuiButton.cpp:191
GuiButton::setIconClick
void setIconClick(GuiElement *i)
Sets the button's icon on click.
Definition
GuiButton.cpp:77
GuiButton::imageOver
GuiElement * imageOver
Button image for STATE::SELECTED.
Definition
GuiButton.h:84
GuiButton::soundOver
GuiSound * soundOver
Sound to play for STATE::SELECTED.
Definition
GuiButton.h:95
GuiButton::soundHold
GuiSound * soundHold
Sound to play for STATE::HELD.
Definition
GuiButton.h:96
GuiButton::imageClick
GuiElement * imageClick
Button image for STATE::CLICKED.
Definition
GuiButton.h:86
GuiButton::GuiButton
GuiButton(int w=0, int h=0)
Constructor.
Definition
GuiButton.cpp:9
GuiButton::setSoundHold
void setSoundHold(GuiSound *s)
Sets the sound to play on hold.
Definition
GuiButton.cpp:128
GuiButton::labelClick
GuiText * labelClick[MAX_BTN_LABELS]
Label(s) to display for STATE::CLICKED.
Definition
GuiButton.h:94
GuiButton::setImage
void setImage(GuiElement *i)
Sets the button's image.
Definition
GuiButton.cpp:42
GuiButton::draw
void draw() override
Constantly called to draw the GuiButton.
Definition
GuiButton.cpp:140
GuiButton::setImageHold
void setImageHold(GuiElement *i)
Sets the button's image on hold.
Definition
GuiButton.cpp:52
GuiButton::setSoundClick
void setSoundClick(GuiSound *s)
Sets the sound to play on click.
Definition
GuiButton.cpp:132
GuiButton::setIcon
void setIcon(GuiElement *i)
Sets the button's icon.
Definition
GuiButton.cpp:62
GuiButton::setSoundOver
void setSoundOver(GuiSound *s)
Sets the sound to play on over.
Definition
GuiButton.cpp:124
GuiButton::setLabelClick
void setLabelClick(GuiText *t, int n=0)
Sets the button's label on click.
Definition
GuiButton.cpp:100
GuiButton::imageHold
GuiElement * imageHold
Button image for STATE::HELD.
Definition
GuiButton.h:85
GuiButton::~GuiButton
~GuiButton()
Destructor.
Definition
GuiButton.cpp:38
GuiButton::icon
GuiElement * icon
Button icon (drawn after button image)
Definition
GuiButton.h:87
GuiButton::setImageClick
void setImageClick(GuiElement *i)
Sets the button's image on click.
Definition
GuiButton.cpp:57
GuiButton::setLabelOver
void setLabelOver(GuiText *t, int n=0)
Sets the button's label on over (eg: different colored text)
Definition
GuiButton.cpp:88
GuiButton::soundClick
GuiSound * soundClick
Sound to play for STATE::CLICKED.
Definition
GuiButton.h:97
GuiButton::iconOver
GuiElement * iconOver
Button icon for STATE::SELECTED.
Definition
GuiButton.h:88
GuiButton::labelHold
GuiText * labelHold[MAX_BTN_LABELS]
Label(s) to display for STATE::HELD.
Definition
GuiButton.h:93
GuiButton::resetText
void resetText()
Resets the text for all contained elements.
Definition
GuiButton.cpp:180
GuiButton::setLabelHold
void setLabelHold(GuiText *t, int n=0)
Sets the button's label on hold.
Definition
GuiButton.cpp:94
GuiButton::label
GuiText * label[MAX_BTN_LABELS]
Label(s) to display (default)
Definition
GuiButton.h:91
GuiButton::setState
void setState(STATE s, int c=-1) override
Sets the state and mirrors it into the button's images and icons, so a state-aware element such as Gu...
Definition
GuiButton.cpp:106
GuiButton::iconHold
GuiElement * iconHold
Button icon for STATE::HELD.
Definition
GuiButton.h:89
GuiButton::setIconOver
void setIconOver(GuiElement *i)
Sets the button's icon on over.
Definition
GuiButton.cpp:67
GuiButton::setIconHold
void setIconHold(GuiElement *i)
Sets the button's icon on hold.
Definition
GuiButton.cpp:72
GuiButton::setImageOver
void setImageOver(GuiElement *i)
Sets the button's image on over.
Definition
GuiButton.cpp:47
GuiElement::GuiElement
GuiElement()
Constructor.
Definition
GuiElement.cpp:9
GuiSound
Sound conversion and playback.
Definition
GuiSound.h:27
GuiText
Display, manage, and manipulate text in the GUI.
Definition
GuiText.h:10
InputController
Logical controller for one input channel.
Definition
InputController.h:16
STATE
STATE
Interaction state of a GuiElement (default, selected, clicked, held, disabled).
Definition
GuiElement.h:36
source
libgui
GuiButton.h
Generated by
1.13.2