Widget

From CEGUI Wiki - Crazy Eddie's GUI System (Open Source)
Jump to: navigation, search

Written for CEGUI 0.8


Works with versions 0.8.x (stable)

Works with latest CEGUI stable!

All the widget articles are under heavy development. Feel free to edit them but don't rely on their accuracy!

Widget
C++ classCEGUI::Widget
C++ Superclass[[]]

Widgets series

This page is part of a series, use links above to easily navigate through all chapters of the series.

CEGUI::Widget is the base class of all CEGUI widgets.

Properties

CEGUI implements a simplistic property introspection via CEGUI::PropertySet. You can set/get properties as strings or even as native types for added speed (added in 0.8). This is used when loading/saving layouts as well.

// ... wdt is a non-const widget pointer (Widget*)
// using strings
wdt->setProperty("SomeProperty", "True");
// or native types
wdt->setProperty<bool>("SomeProperty", true);

Events

Events are fired by most of the widgets. You can subscribe to them via:

// ... wdt is a non-const widget pointer (Widget*)
// subscription to a class method
wdt->subscribeEvent("EventName", Event::Subscriber(&ClassType::classMethod, instanceOfTheClass));
// subscription to a free function
wdt->subscribeEvent("EventName", Event::Subscriber(&freeFunction));

Instead of putting event names as string literals, you might want to use static constants for added safety.

wdt->subscribeEvent(SomeWidgetSomewhere::EventName, Event::Subscriber(&freeFunction));

Positioning

All widgets utilise Unified_Positions_and_Sizes_System so they can be sized in absolute, relative values or combinations of both.

Enabled/Disabled

When a widget is disabled, it usually doesn't allow any interaction with it and may employ a different rendering. File:Enabled vs Disabled FrameWindow.png

Activated/Deactivated

When a window is deactivated, no inputs are processed by it until it's activated.