Hello All,
this place has now the shape of a developer's vlog, don't know if you like this
This week many things have changed and the revision 0.58 & 0.59 have been published. This means we are very close to rev 0.60, but not fully reached the objective yet, there are still some little bugs hidden in the code and now some time is needed to fix them all.
The main achievements for this week are :
- first some new widgets are now available :
1- SpacerWidget : a fully "blank" widget that do nothing except using space, very helpful for optimizing the layout of some forms
2- ListBoxWidget : a list of items that can be navigated with Up and Down, escaped with ESC and validated with ENTER
3- DropBoxWidget : a dropbox list (works in connection with a MiniButtonWidget and a ListBoxWidget), and I am very happy with this new widget cause the development was not a piece of cake and the main widget class has been significantly improved to support this new DropBoxWidget. Up to now it was not possible to have some Widgets or some parts of Widget "poping up" on the screen, now it can be done and is applied with the DropBoxWidget when the ListBox is dropped/undropped.
- second, many work has been done on making the GUI Toolkit fully "themable". A new class as been added (ThemeEngine) which works in agreement with the ColorEngine and FontEngine classes and the rendering methods. Not so difficult, but damn long to update all the widgets accordingly.
As usual, some pictures are following, with a DropBoxWidget used to change the theme of the interface. 3 themes are available (I need to admit I have to check more accurately if the colors are fully OK in each theme config file) :
- Normal theme (=default one) : note this one is in a CFG file and is also hardcoded in the Theme/Color/FontEngine (just in case of problem)
- Dark theme : as explicitely said by its name, uses dark color pattern
- Hyrule : this is a transcription of the theme I used for the Link-SDL/GUI Toolkit integration (see some post above).
Default theme: DropBoxWidget demo:

Dark theme:

Hyrule theme:

And back to default theme (using the hard coded version of the Normal theme)

The code for this little example is the following one :
- Code: Select all
#include "Toolkit/GUIToolkit.h"
int main ( void )
{
bool done = false;
WidgetApplication *MyApp = new WidgetApplication();
MyApp->setuniformbackgroundcolor(100, 100, 100);
DesktopWidget *desktop1 = new DesktopWidget( (char*) "First Desktop", 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, nullptr );
WindowWidget *window = new WindowWidget( (char*) "Examples of DropBox & Themes", 5, 5, 310, 160, desktop1 );
ContainerVWidget *containervert = new ContainerVWidget( (char*) "container", 1, 1, 1, 1, window );
// this is the new DropBow Widget
DropBoxWidget *mydropbox = new DropBoxWidget( (char*) "Test Drop", 1, 1, 1, 1, containervert );
// this is a spacer widget (blank one, do nothing, jsut for the layout)
// note , this may disappear if contraint layout is implemented in later revisions
SpacerWidget *spacer1 = new SpacerWidget( (char*) "Spacer1", 1, 1, 1, 1, containervert );
SpacerWidget *spacer2 = new SpacerWidget( (char*) "Spacer2", 1, 1, 1, 1, containervert );
SpacerWidget *spacer3 = new SpacerWidget( (char*) "Spacer3", 1, 1, 1, 1, containervert );
ContainerHWidget *containerH = new ContainerHWidget( (char*) "containerH", 1, 1, 1, 1, containervert );
SpacerWidget *spacer1H = new SpacerWidget( (char*) "Spacer1", 1, 1, 1, 1, containerH );
ButtonWidget *buttonQuit = new ButtonWidget( (char*) "Quit !!", 1, 1, 1, 1, containerH );
SpacerWidget *spacer2H = new SpacerWidget( (char*) "Spacer2", 1, 1, 1, 1, containerH );
// We ask for an automatic positioning of the widgets in the grid
// Note : this will fully override the dimensions given to the Widgets manually
window->adjust();
MyApp->addchild( desktop1 );
// We fill the list of the dropbox with items to be selectable by the user
mydropbox->additem( (char*) "Default GUI Toolkit Theme" );
mydropbox->additem( (char*) "Bright GUI Toolkit Theme" );
mydropbox->additem( (char*) "Dark GUI Toolkit Theme" );
mydropbox->additem( (char*) "Hyrule GUI Toolkit Theme" );
// We need to init the theme engine, by default, this is not done at startup to save memory
MyApp->initthemeengine();
// We apply the default theme while using theme (this is for safe use and avoid any risk of crash)
MyApp->setdefaulttheme();
KeyboardTask *keyboard = MyApp->getkeyboardhandler();
// We render the app for the first time so what we can see what's happening on the screen
MyApp->render();
while (!done)
{
MyApp->logic();
// Check if the dropbox has been updated by the user and if there is actually something selected (-1 means no selection yet
if (mydropbox->isupdated() && (mydropbox->getselected()!=-1))
{
if (mydropbox->getselected() == 0)
{
// We reset the theme to default
MyApp->setdefaulttheme();
}
if (mydropbox->getselected() == 1)
{
// We load a theme file and aply it on-the-fly
// the theme NrmClr.CFG.tns is the default theme
MyApp->loadtheme( (char*) "/documents/widget/Themes/NrmClr.CFG.tns" );
}
if (mydropbox->getselected() == 2)
{
// We load a theme file and aply it on-the-fly
// the theme DrkClr.CFG.tns is the dark theme
MyApp->loadtheme( (char*) "/documents/widget/Themes/DrkClr.CFG.tns" );
}
if (mydropbox->getselected() == 3)
{
// We load a theme file and aply it on-the-fly
// the theme Hyrule.CFG.tns is the theme used is the LinkSDL example (put in a theme file)
MyApp->loadtheme( (char*) "/documents/widget/Themes/Hyrule.CFG.tns" );
}
}
// As usual, Quit is pressed or the magic keyboard shortcut is activated (CTRL+ESC)
if ((keyboard->kbCTRL && keyboard->kbESC) || buttonQuit->ispressed()) done = true;
}
return 0;
}
Everything has been uploaded on the GitHub repository. Please note that the documentation has not been updated yet (this is still ongoing and new stuff has not been put into Doxygen format yet). This is Damn long to write a (I hope) good and clear documentation.
As always, please feel free to give your comments/suggestion and to report bugs.
Ciao
Sly