Copying window trees

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
cippyboy
Quite a regular
Quite a regular
Posts: 51
Joined: Wed Jul 30, 2008 13:23

Copying window trees

Postby cippyboy » Fri Oct 03, 2008 12:43

Is there a way to copy a whole window tree ? Like, I have this window, with tons of widgets on it and I want to duplicate it and don't wanna copy-paste tons of XML with just a single position changed for each copy. Besides, I need a certain number of them so code is preferable.

I'm thinking I could recurs the whole tree and make copies of windows & properties, but that involves tons of renaming.

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Sat Oct 04, 2008 09:55

Hi,

you need a recursive copy, and you have to deal with naming issue ;)

The layout editor does the exact thing when it copies & pastes though. The code should be pretty straightforward and can be found in this file:
http://crayzedsgui.svn.sourceforge.net/ ... iew=markup

I think that -besides the pieces of wxWidgets code- the CopiedSelection class can be reused easily, so feel free to use it :)

There's one line which i didn't understand myself anymore: the check for "_TabPane_". I think that the if-statement is wrong, and should also have "!= npos" behind it. I'll look into this.

HTH.
Check out my released snake game using Cegui!

User avatar
cippyboy
Quite a regular
Quite a regular
Posts: 51
Joined: Wed Jul 30, 2008 13:23

Postby cippyboy » Mon Oct 06, 2008 16:30

Thanks, I thought it was built-in or something. As for the copied selection class, it looked pretty weird, like that map that I don't see why it's there, so i decided to write my own function today because I would have to intervene with a different naming scheme than it was presented there, but anyways, I managed to solve it, so thanks again :D

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Mon Oct 06, 2008 18:08

Hi,

not sure which map you mean, but glad that you have a working solution now :)

Maybe that one day, this copying should be part of Cegui itself...
Check out my released snake game using Cegui!

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Thu Oct 09, 2008 07:27

scriptkid wrote:Maybe that one day, this copying should be part of Cegui itself...

I think this is a good thing to add to the TODO list :) We should also probably have a deep and a shallow 'mode' to copy either all the child content also, or just a given window.

CE.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 6 guests