Windows Name Management : Create a bunch of windows
Posted: Fri Jan 20, 2012 10:53
Hello!
My application uses collections of items that I've binded to CEGUI items GUI Elements (that inherits from CEGUI::Window), and browser GUI Element for these collections, using the CEGUI::GridLayoutContainer class.
The thing is that my application creates, destroys and handles the browser GUI Elements and the item GUI Elements directly with their pointers.
When I create the CEGUI elements, I always have to give them explicitly a Window Name, which sometime is very painfull, because it has to be unique in the whole CEGUI System (I know that version 0.8 deals with window names that can be reused in different ''branches'' of the widget hierarchy.
I'm working with the 0.7 version because I need a stable version of CEGUI.
So the solution I've used until yet is to create a static 'int' counter in my class that inherit from CEGUI::Window, and give to the constructor of this class the name of the widget, and an autoincremented index.
This seems very heavy!
My question is: Is it possible to create Windows without having to deal with windows name management, and avoid name collisions ?
My application uses collections of items that I've binded to CEGUI items GUI Elements (that inherits from CEGUI::Window), and browser GUI Element for these collections, using the CEGUI::GridLayoutContainer class.
The thing is that my application creates, destroys and handles the browser GUI Elements and the item GUI Elements directly with their pointers.
When I create the CEGUI elements, I always have to give them explicitly a Window Name, which sometime is very painfull, because it has to be unique in the whole CEGUI System (I know that version 0.8 deals with window names that can be reused in different ''branches'' of the widget hierarchy.
I'm working with the 0.7 version because I need a stable version of CEGUI.
So the solution I've used until yet is to create a static 'int' counter in my class that inherit from CEGUI::Window, and give to the constructor of this class the name of the widget, and an autoincremented index.
Code: Select all
class CustomWidget : public CEGUI::Window
{
static unsigned int s_counter;
const char* kWidgetName;
CustomWidget ();
};
const char* CustomWidget::kWidgetName = "CustomWidget "
unsigned int CustomWidget ::s_counter = 0;
CustomWidget() : CEGUI::Window(CEGUI::String(CustomWidget::kWidgetName) +Ogre::StringConverter::toString(s_counter++))
{
}
This seems very heavy!
My question is: Is it possible to create Windows without having to deal with windows name management, and avoid name collisions ?