libgui 2.01
libgui is a GUI library for the GameCube, Wii, and Wii U
 
Loading...
Searching...
No Matches
GuiWindow.h
1/****************************************************************************
2 * libgui
3 * Daryl Borth 2009-2026
4 * GuiWindow.h
5 ***************************************************************************/
6#pragma once
7
10class GuiWindow : public GuiElement
11{
12 public:
14 GuiWindow();
18 GuiWindow(int w, int h);
20 ~GuiWindow();
23 void append(GuiElement* e);
30 void insert(GuiElement* e, uint32_t i);
33 void remove(GuiElement* e);
35 void removeAll();
39 bool find(GuiElement* e);
43 GuiElement* getGuiElementAt(uint32_t index) const;
46 uint32_t getSize();
49 void setVisible(bool v);
51 void resetState();
55 void setState(STATE s, int c = -1);
58 int getSelected();
61 void setFocus(int f);
65 void changeFocus(GuiElement * e);
74 void moveSelectionHor(int d);
77 void moveSelectionVert(int d);
79 void resetText();
81 void draw();
85 void update(InputController * c);
86 protected:
90 bool collectNavigation(std::vector<GuiElement*>& out);
92 void moveSelectionIn(std::vector<GuiElement*>& list, NAV_DIR d);
93 std::vector<GuiElement*> _elements;
94};
GuiElement()
Constructor.
Definition GuiElement.cpp:9
void moveSelectionIn(std::vector< GuiElement * > &list, NAV_DIR d)
Moves the selection within a collected list by on-screen geometry.
uint32_t getSize()
Returns the size of the list of elements.
void toggleFocus(InputController *c)
Changes window focus to the next focusable window or element If no element is in focus,...
bool collectNavigation(std::vector< GuiElement * > &out)
Gathers the elements selection can move between, looking inside layout containers.
void append(GuiElement *e)
Appends a GuiElement to the GuiWindow.
Definition GuiWindow.cpp:31
bool find(GuiElement *e)
Looks for the specified GuiElement.
Definition GuiWindow.cpp:85
void setFocus(int f)
Sets the window focus.
void setVisible(bool v)
Sets the visibility of the window.
void moveSelectionVert(int d)
Moves the selected element to the element above or below.
void resetState()
Resets the window's state to STATE::DEFAULT.
GuiElement * getGuiElementAt(uint32_t index) const
Returns the GuiElement at the specified index.
Definition GuiWindow.cpp:97
void appendWithAutoRemove(GuiElement *e)
Appends a GuiElement to the GuiWindow, and instructs the GuiElement to inform its parent on destructi...
Definition GuiWindow.cpp:41
void removeAll()
Removes all GuiElements.
Definition GuiWindow.cpp:75
GuiWindow()
Constructor.
Definition GuiWindow.cpp:9
int getSelected()
Gets the index of the GuiElement inside the window that is currently selected.
void draw()
Draws all the elements in this GuiWindow.
void setState(STATE s, int c=-1)
Sets the window state, propagated to every child element.
~GuiWindow()
Destructor.
Definition GuiWindow.cpp:23
void resetText()
Resets the text for all contained elements.
void update(InputController *c)
Updates the window and all elements contains within Allows the GuiWindow and all elements to respond ...
void insert(GuiElement *e, uint32_t i)
Inserts a GuiElement into the GuiWindow at the specified index.
Definition GuiWindow.cpp:48
void remove(GuiElement *e)
Removes the specified GuiElement from the GuiWindow.
Definition GuiWindow.cpp:58
std::vector< GuiElement * > _elements
Contains all elements within the GuiWindow.
Definition GuiWindow.h:93
void changeFocus(GuiElement *e)
Change the focus to the specified element This is intended for the primary GuiWindow only.
void moveSelectionHor(int d)
Moves the selected element to the element to the left or right.
Logical controller for one input channel.
STATE
Interaction state of a GuiElement (default, selected, clicked, held, disabled).
Definition GuiElement.h:36
NAV_DIR
Directions for moving the selection.