*** Update ***The new properties system has just been applied to SFGUI's mainline. Some flaws are still present (not all widgets are 100% compatible), but in general it works very good and convenient.
So, what's the new property system all about?Previously you were able to set widget properties in the rendering engine AND in each widget. This was not acceptable, because properties only affect rendering in the most cases, so there's no reason to store them in widgets.
Also it was not possible to select special widgets for custom properties very easily. SFGUI lacked a nice selection feature. That's now included.
Imagine you want to change the text color of a label that's on a button. You do:
SetProperty<sf::Color>( "Button > Label", "Color", sf::Color::Red )
Those who wrote/read CSS will like the syntax of the selector.
Widgets can now also be identified by IDs and classes. Say we have a special quit button that we want to style differenty:
SetProperty<sf::Color>( "Button#quit", "BackgroundColor", sf::Color::Black );
SetProperty<sf::Color>( "Button#quit > Label", "Color", sf::Color::Red );
SetProperty<sf::Color>( "Button#quit:Prelight", "BackgroundColor", sf::Color::White );
SetProperty<sf::Color>( "Button#quit:Prelight > Label", "Color", sf::Color::Black );
Those 4 lines do the following:
- Set background color of button with ID "quit" to black.
- Set label color of button with ID "quit" to red.
- Set background color of button with ID "quit" that's in prelight state to white.
- Set label color of button with ID "quit" that's in prelight state to black.
Those rules can be applied to
all available widgets. Btw., the "prelight state" is usually the state when the user moves his mouse pointer over the proper widget.
Here's a screenshot (using BREW as the rendering engine):