Automatic Layouting (horizontal, vertical, grid, ...)
Posted: Tue Jul 27, 2010 20:44
Hi,
I need some sort of automatic layouting container like the ones in Qt, Java, gtk, etc... I can't find it in CEGUI itself, I could have missed something but I think it isn't there.
Why do I need it:
I am creating an ingame material editor with instant preview for our Ogre based engine for artists to play with (they hate text editing, lazy bastards). And Ogre materials are pretty complex, you have the material with some basic properties, then techniques, inside techniques there are passes and inside passes there are texture units... Hope I haven't missed anything My idea is that I will have collapsible boxes for each layer of complexity, so you can show/hide techniques, passes inside them, etc... This should allow me to fit a material to one FrameWindow that won't overlay the whole screen.
Going around this by popping up a new FrameWindow each time (one window for material, you click on any Technique and another window just for the technique is created, etc) would really hurt usability (plus I need to make the artists believe that materials are easy so I don't have to do them )
It could be implemented as a descendant of CEGUI::Window. If I created something like CEGUI::LayoutingContainer and derived CEGUI::VerticalLayoutingContainer and CEGUI::HorizontalLayoutingContainer from it. The container would subscribe to EventSized of every new window that is added to it (via addChild_impl and removeChild_impl). For the sake of simplicity, the layouting will only alter positions of widgets inside it, handling sizing and rotation could be implemented later.
Possible problems:
1) where do I store margins for each CEGUI::Window inside a layouting container?
2) where do I store the "position" of the window inside the layout? what comes first, what comes last. CEGUI stores child windows inside a vector, this could get messy when rearranging windows inside a container.
3) performance? I am planning to do an unclever approach, I will get all child windows, sort them (for vertical layout, top most window comes first) and then move from the first to the last, altering each windows position so that they fit next to each other.
4) the name clashes with .layout files and CELayoutEditor
I could solve problem 1 and 2 by creating something like CEGUI::LayoutingItem that would store margin of it's inside widget and it would store something like weight to represent "position" inside the layout. But this is another layer of complexity.
I found an old topic but there is no recent activity there, so instead of ressurecting, I created my own - http://www.cegui.org.uk/phpBB2/viewtopic.php?f=1&t=1275
Could somebody provide some insights/ideas? Would like a little discussion before I start the patch. I think this feature would really push CEGUI forward, because it would allow very complex and dynamic UIs with less effort.
I need some sort of automatic layouting container like the ones in Qt, Java, gtk, etc... I can't find it in CEGUI itself, I could have missed something but I think it isn't there.
Why do I need it:
I am creating an ingame material editor with instant preview for our Ogre based engine for artists to play with (they hate text editing, lazy bastards). And Ogre materials are pretty complex, you have the material with some basic properties, then techniques, inside techniques there are passes and inside passes there are texture units... Hope I haven't missed anything My idea is that I will have collapsible boxes for each layer of complexity, so you can show/hide techniques, passes inside them, etc... This should allow me to fit a material to one FrameWindow that won't overlay the whole screen.
Going around this by popping up a new FrameWindow each time (one window for material, you click on any Technique and another window just for the technique is created, etc) would really hurt usability (plus I need to make the artists believe that materials are easy so I don't have to do them )
It could be implemented as a descendant of CEGUI::Window. If I created something like CEGUI::LayoutingContainer and derived CEGUI::VerticalLayoutingContainer and CEGUI::HorizontalLayoutingContainer from it. The container would subscribe to EventSized of every new window that is added to it (via addChild_impl and removeChild_impl). For the sake of simplicity, the layouting will only alter positions of widgets inside it, handling sizing and rotation could be implemented later.
Possible problems:
1) where do I store margins for each CEGUI::Window inside a layouting container?
2) where do I store the "position" of the window inside the layout? what comes first, what comes last. CEGUI stores child windows inside a vector, this could get messy when rearranging windows inside a container.
3) performance? I am planning to do an unclever approach, I will get all child windows, sort them (for vertical layout, top most window comes first) and then move from the first to the last, altering each windows position so that they fit next to each other.
4) the name clashes with .layout files and CELayoutEditor
I could solve problem 1 and 2 by creating something like CEGUI::LayoutingItem that would store margin of it's inside widget and it would store something like weight to represent "position" inside the layout. But this is another layer of complexity.
I found an old topic but there is no recent activity there, so instead of ressurecting, I created my own - http://www.cegui.org.uk/phpBB2/viewtopic.php?f=1&t=1275
Could somebody provide some insights/ideas? Would like a little discussion before I start the patch. I think this feature would really push CEGUI forward, because it would allow very complex and dynamic UIs with less effort.