There is a way to use templates in CEGUI? . I mean, load several windows from a .layout file, and duplicate these windows for several purposes.
For example, I want to reutilize a ok-cancel dialog (with two buttons on it), But I would like to have several dialogs, each one with it's own purpose and linked also to different events in my application.
Using templates as a way to duplicate
Moderators: CEGUI MVP, CEGUI Team
Sounds like you want to copy a CEGUI window? Try this thread: http://www.cegui.org.uk/phpBB2/viewtopic.php?t=3584
Re: Using templates as a way to duplicate
arn wrote:For example, I want to reutilize a ok-cancel dialog (with two buttons on it), But I would like to have several dialogs, each one with it's own purpose and linked also to different events in my application.
Yes this is something I do with these sort of dialog boxes.
The layout just has the ok/cancel button and a text box attached to a window and the class which wraps it:
The constructor
-loads the layout
-attaches two functors, one for ok and one for cancel.(these are not CEGUI event functors yet a functor to another class instance)
-sets the window message text
-registers the events
-attaches the window to the root
The destructor.
-detaches the window from the root
-de-registers the events
-unloads the layout
As there is ever only one instance of the window there is no problems with window duplicate names and this window is ok to load and unload as it is never shown in time critical situations (it is in essence a blocking operation)
Yes, I want to copy a whole tree, Unfortunately I have to deal also with the naming issue, because I want several copies working at the same time. I think it is not so difficult to do an appropiate algorithm for it.
While that kind of copying is not part of CEGUI itself, I have to code by myself.
Thanks anyway
While that kind of copying is not part of CEGUI itself, I have to code by myself.
Thanks anyway
-
- Quite a regular
- Posts: 74
- Joined: Mon Apr 28, 2008 23:21
- Location: Australia
Window* loadWindowLayout(const String& filename, bool generateRandomPrefix);
You can use that function of the window manager to load the same layout with different prefixes. The only problem is that you then cant rely on the names defined within the layout file cause they could now have a random prefix.
ER.
You can use that function of the window manager to load the same layout with different prefixes. The only problem is that you then cant rely on the names defined within the layout file cause they could now have a random prefix.
ER.
- scriptkid
- Home away from home
- Posts: 1178
- Joined: Wed Jan 12, 2005 12:06
- Location: The Hague, The Netherlands
- Contact:
Hi,
you might want to check this post: http://www.cegui.org.uk/phpBB2/viewtopi ... =deep+copy
It explains a little about deep copying of widget trees.
Thas would be the WindowManager.
HTH.
you might want to check this post: http://www.cegui.org.uk/phpBB2/viewtopi ... =deep+copy
It explains a little about deep copying of widget trees.
In any case, which class loadWindowLayout method belongs to?
Thas would be the WindowManager.
HTH.
Check out my released snake game using Cegui!
Who is online
Users browsing this forum: No registered users and 16 guests