The GUI system is inspired by the World of Warcraft customizeable GUI system allowing end-users to easily develop and distribute 'addons'.
GUI Architecture Overview
GUI Control Message Flow
The GUI system is a basic, straight-forward event-driven system with a top-down approach. Event's that are passed to the GUI via a Broadcaster are passed to the Root or Top Level Control and are propgated down the list to all other controls that are active starting with the first Control that is on top of the Stack.
Top Level Control
The Top Level Control (TLC) is the Parent of all Control's within the GUI system. Much like the Desktop of modern GUI Operating Systems, Control's can be added to and removed from the TLC. All events start at the TLC and are propogated downward to Controls that have Focus.
Event Handling
Fill me out.
Control Stack
Like a set of cards, Control's within the TLC are stacked. The top-most Control recieves input events first and onward down the line. When a Control gains focus, it is brought to the top of a stack. A Control at the top of the stack doesn't necessarily go backward in the stack if it loses focus (e.g., the player clicks outside of any Controls and into the Game World itself).
Using the GUI
Adding New Controls
Adding new Controls to the Stack is a simple matter of calling the addChild() function from any Control.
void Control::addChild(Control *child)
It is also possible to add Control's by using the GUI's add(Control *control) function. All Control's added with this method will be added to the Root or Top Level Control.
Usage Example
There are several ways of adding a Control to the GUI system.
// Adding a pre-built Control Control *myControl = new Control("My Awesome Control", 32, 32); mGui->add(myControl); // Adding a new Control instantiated during insertion mGui->add(new Control("My Other Awesome Control", 64, 32));
NOTE
GUI currently provides a method of getting the top Control. This function will most likely be deprecated and should not be used.
Available Controls
There are several controls that are currently available:
| Type | Description |
|---|---|
| Control | This is the Base Control and is what all other Control's derive from. |
| Button | The quintisential Control that any GUI requires, the basic push-button. |
| Label | A basic text label. |
| ProgressBar | Progress Bar. Displays a progress meter set by calling logic. |
| ScrollArea | A containing Control that uses ScrollBar's to display an area larger than itself. This is a Base from which other Controls like TextBox derive. |
| ScrollBar | A bar with two buttons and a thumbnail slider. Generally used by the ScrollArea type of Controls. |
| TextBox | Derives from ScrollArea. Displays lines of text that can be wrapped or displayed as is. |
| Window | Basic Window object. Provides a Client area which new Controls are added to and additional handling of events like Drags. Also provides a Close button to close said Window. |







