Table of contents
Widgets, who can create what?
Panel:
Able to create all widgets, except for Windows, Sheets, and the TitleBar widget.
Window:
Same as Panel, but automatically creates a TitleBar widget.
Sheet:
Same as Panel, but can create Windows.
GUIManager:
Able to create Sheets. A DefaultSheet is created and available upon manager setup.
List:
Creates MenuLabels.
Widget Sizing and positioning
QuickGUI uses Vertical and Horizontal Anchoring to achieve relative position and size. In order to maintain a relative size, you have to anchor left_and_right, as well as top_and_bottom. You can do one, both, left/right/top/bottom only, or none.
One important thing to note is that you have to let the GUIManager know when the viewport has been resized, because the GUI manager cannot really auto detect that change.
What is an Event, EventHandler, and EventArgs?
In QuickGUI, an Event is a defined action that occurs. EventHandlers are user defined functions that are called when a specified Widget receives notification of a specific Event. EventArgs are required
as a parameter of EventHandlers, and can provide useful information such as Mouse and Widget information. The following code shows how to retrieve the name of the Button that is clicked:
// First, we want to register the event handler to our button. // An Event, Function Pointer, and object instance are required. loginButton->addEventHandler(QuickGUI::Widget::EVENT_MOUSE_BUTTON_UP,&SimpleGUIDemoApp::evtHndlr_login, this); // All EventHandlers must return void, and have EventArgs as the only parameter. // Here is the eventHandler we have defined. void evtHndlr_login(const QuickGUI::EventArgs& args) { }
EventArgs also form WidgetEventArgs, MouseEventArgs and others. EventArgs come with an enumerated Type field, which denotes which type of EventArgs it is. Using this, we can safely cast the EventArgs into
a more useful structure.
// Cast EventArgs into WidgetEventArgs. Technically we could cast this to MouseEventArgs, since we // know QuickGUI Mouse Events involve MouseEventArgs. // Or we could just check the EventArgs::type field… const WidgetEventArgs wea = dynamic_cast<const WidgetEventArgs&>(args);
And just for reference, this is how you can retreive MouseEventArgs:
const MouseEventArgs& mouseEventArgs = dynamic_cast<const MouseEventArgs&>(args);
Other Important things to know
QuickGUI does not support use of materials. In the past, QuickGUI made use of Ogre Overlays, but this is no longer the case. QuickGUI does support Ogre::Texture. Whether procedurally created,
render to texture, or via supported Image types, QuickGUI will use these for its rendering of Widgets and GUI.