# GuiWindow Class Reference

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

`#include <gui.h>`

Inheritance diagram for GuiWindow:

List of all members.

## 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.
GuiElement * | GetGuiElementAt (u32 index) const
u32 | GetSize ()
void | SetVisible (bool v)
void | ResetState ()
| Resets the window's state to STATE_DEFAULT.
void | SetState (int s)
int | GetSelected ()
void | SetFocus (int f)
void | ChangeFocus (GuiElement *e)
void | ToggleFocus (GuiTrigger *t)
void | MoveSelectionHor (int d)
void | MoveSelectionVert (int d)
void | Draw ()
| Draws all the elements in this GuiWindow.
void | Update (GuiTrigger *t)
## Protected Attributes
std::vector< GuiElement * > | _elements
| Contains all elements within the GuiWindow.

## Detailed Description

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

## Constructor & Destructor Documentation

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:

  | w | Width of window
  | h | Height of window

## Member Function Documentation

void GuiWindow::Append | ( | GuiElement * | e | ) |

Appends a GuiElement to the GuiWindow

Parameters:

  | e | The GuiElement to append. If it is already in the GuiWindow, it is removed first

void GuiWindow::ChangeFocus | ( | GuiElement * | e | ) |

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

Parameters:

  | e | GuiElement that should have focus

GuiElement * GuiWindow::GetGuiElementAt | ( | u32 | index | ) | const

Returns the GuiElement at the specified index

Parameters:

  | index | The index of the element

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

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.

u32 GuiWindow::GetSize | ( |  | ) |

Returns the size of the list of elements

Returns:
  The size of the current element list

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

Inserts a GuiElement into the GuiWindow at the specified index

Parameters:

  | e | The GuiElement to insert. If it is already in the GuiWindow, it is removed first
  | i | Index in which to insert the element

void GuiWindow::MoveSelectionHor | ( | int | d | ) |

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

Parameters:

  | d | Direction to move (-1 = left, 1 = right)

void GuiWindow::MoveSelectionVert | ( | int | d | ) |

Moves the selected element to the element above or below

Parameters:

  | d | Direction to move (-1 = up, 1 = down)

void GuiWindow::Remove | ( | GuiElement * | e | ) |

Removes the specified GuiElement from the GuiWindow

Parameters:

  | e | GuiElement to be removed

void GuiWindow::SetFocus | ( | int | f | ) | `[virtual]`

Sets the window focus

Parameters:

  | f | Focus

Reimplemented from GuiElement.

void GuiWindow::SetState | ( | int | s | ) |

Sets the window's state

Parameters:

  | s | State

void GuiWindow::SetVisible | ( | bool | v | ) | `[virtual]`

Sets the visibility of the window

Parameters:

  | v | visibility (true = visible)

Reimplemented from GuiElement.

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:

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

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:

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

Reimplemented from GuiElement.

Reimplemented in GuiKeyboard.

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

- gui.h
- gui_window.cpp