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

Allows GuiElements to be grouped together into a "window". More...

#include <gui_window.h>

Inheritance diagram for GuiWindow:
GuiElement GuiKeyboard

Public Member Functions

 GuiWindow ()
 Constructor.
 
 GuiWindow (int w, int h)
 
 ~GuiWindow ()
 Destructor.
 
void Append (GuiElement *e)
 
void Insert (GuiElement *e, u32 i)
 
void Remove (GuiElement *e)
 
void RemoveAll ()
 Removes all GuiElements.
 
bool Find (GuiElement *e)
 
GuiElementGetGuiElementAt (u32 index) const
 
u32 GetSize ()
 
void SetVisible (bool v)
 
void ResetState ()
 Resets the window's state to STATE_DEFAULT. More...
 
void SetState (STATE s)
 
int GetSelected ()
 
void SetFocus (int f)
 
void ChangeFocus (GuiElement *e)
 
void ToggleFocus (GuiTrigger *t)
 
void MoveSelectionHor (int d)
 
void MoveSelectionVert (int d)
 
void ResetText ()
 Resets the text for all contained elements. More...
 
void Draw () override
 Draws all the elements in this GuiWindow. More...
 
void DrawTooltip ()
 Draws all of the tooltips in this GuiWindow. 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

std::vector< GuiElement * > _elements
 Contains all elements within the GuiWindow.
 
- 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

Allows GuiElements to be grouped together into a "window".

Constructor & Destructor Documentation

◆ GuiWindow()

GuiWindow::GuiWindow ( int  w,
int  h 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
wWidth of window
hHeight of window

Member Function Documentation

◆ Append()

void GuiWindow::Append ( GuiElement e)

Appends a GuiElement to the GuiWindow

Parameters
eThe GuiElement to append. If it is already in the GuiWindow, it is removed first

◆ ChangeFocus()

void GuiWindow::ChangeFocus ( GuiElement e)

Change the focus to the specified element This is intended for the primary GuiWindow only

Parameters
eGuiElement that should have focus

◆ Draw()

void GuiWindow::Draw ( )
overridevirtual

Draws all the elements in this GuiWindow.

Implements GuiElement.

◆ DrawTooltip()

void GuiWindow::DrawTooltip ( )
virtual

Draws all of the tooltips in this GuiWindow.

Reimplemented from GuiElement.

◆ Find()

bool GuiWindow::Find ( GuiElement e)

Looks for the specified GuiElement

Parameters
eThe GuiElement to find
Returns
true if found, false otherwise

◆ GetGuiElementAt()

GuiElement * GuiWindow::GetGuiElementAt ( u32  index) const

Returns the GuiElement at the specified index

Parameters
indexThe index of the element
Returns
A pointer to the element at the index, nullptr on error (eg: out of bounds)

◆ GetSelected()

int GuiWindow::GetSelected ( )
virtual

Gets the index of the GuiElement inside the window that is currently selected

Returns
index of selected GuiElement

Reimplemented from GuiElement.

◆ GetSize()

u32 GuiWindow::GetSize ( )

Returns the size of the list of elements

Returns
The size of the current element list

◆ Insert()

void GuiWindow::Insert ( GuiElement e,
u32  i 
)

Inserts a GuiElement into the GuiWindow at the specified index

Parameters
eThe GuiElement to insert. If it is already in the GuiWindow, it is removed first
iIndex in which to insert the element

◆ MoveSelectionHor()

void GuiWindow::MoveSelectionHor ( int  d)

Moves the selected element to the element to the left or right

Parameters
dDirection to move (-1 = left, 1 = right)

◆ MoveSelectionVert()

void GuiWindow::MoveSelectionVert ( int  d)

Moves the selected element to the element above or below

Parameters
dDirection to move (-1 = up, 1 = down)

◆ Remove()

void GuiWindow::Remove ( GuiElement e)

Removes the specified GuiElement from the GuiWindow

Parameters
eGuiElement to be removed

◆ ResetState()

void GuiWindow::ResetState ( )
virtual

Resets the window's state to STATE_DEFAULT.

Reimplemented from GuiElement.

◆ ResetText()

void GuiWindow::ResetText ( )
virtual

Resets the text for all contained elements.

Reimplemented from GuiElement.

◆ SetFocus()

void GuiWindow::SetFocus ( int  f)
virtual

Sets the window focus

Parameters
fFocus

Reimplemented from GuiElement.

◆ SetState()

void GuiWindow::SetState ( STATE  s)

Sets the window's state

Parameters
sState

◆ SetVisible()

void GuiWindow::SetVisible ( bool  v)
virtual

Sets the visibility of the window

Parameters
vvisibility (true = visible)

Reimplemented from GuiElement.

◆ ToggleFocus()

void GuiWindow::ToggleFocus ( GuiTrigger t)

Changes window focus to the next focusable window or element If no element is in focus, changes focus to the first available element If B or 1 button is pressed, changes focus to the next available element This is intended for the primary GuiWindow only

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

◆ Update()

void GuiWindow::Update ( GuiTrigger t)
virtual

Updates the window and all elements contains within Allows the GuiWindow and all elements to respond to the input data specified

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: