Adding custom footer to FrameWindow?

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Savail
Quite a regular
Quite a regular
Posts: 50
Joined: Wed Jul 04, 2012 07:54

Adding custom footer to FrameWindow?

Postby Savail » Sun Jan 20, 2013 17:42

Hey!
Recently I have felt the urge to create a footer in my FrameWindow. The problem is, that I don't want all my FrameWindows to contain a footer but only some of them and I wonder if I can somehow specify in my lookNFeel new NamedArea and ImagerySection for it when the window contains a footer. Then I would like to decide if given FrameWindow should have a footer in my code using something like this CEGUI::FrameWindow::setProperty("ContainsFooter", "TRUE");. Is that possible?
CEGUI.log

Code: Select all

20/01/2013 18:20:08 (Std)    * -------- START OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM       -------- *
20/01/2013 18:20:08 (Std)    ********************************************************************************
20/01/2013 18:20:08 (Std)    ---- Version 0.7.8 (Build: Dec 24 2012 Microsoft Windows MSVC++ 9.0 32 bit) ----
20/01/2013 18:20:08 (Std)    ---- Renderer module is: CEGUI::Direct3D9Renderer - Official Direct3D 9 based 2nd generation renderer module. ----
20/01/2013 18:20:08 (Std)    ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
20/01/2013 18:20:08 (Std)    ---- Image Codec module is: SILLYImageCodec - Official SILLY based image codec ----
20/01/2013 18:20:08 (Std)    ---- Scripting module is: None ----
20/01/2013 18:20:08 (Std)    ********************************************************************************
20/01/2013 18:20:08 (Std)    * -------- END OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM         -------- *

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

Re: Adding custom footer to FrameWindow?

Postby CrazyEddie » Tue Jan 22, 2013 09:47

Well, the dirtiest solution would be to have two frame window types - one with a footer and one without. Not very flexible, for sure :)

Adding named areas is always possible, but you have to consider that the code side of the system has no knowledge of them - so whether you call it "ClientAreaWithFooter" or "GeorgeOrwell", stock CEGUI will not use them. But you are free to add them and to look them up and make use of them in your own code.

If you're using ImagerySections and what not that are all defined in XML and adding properties to control the content of those (so text strings and images and what have you) then yes, that's absolutely possible. Just do that and add references to them in the appropriate StateImagery definitions.

What you describe with the control property is theoretically possible (or something like what you describe, anyway). Essentially, in 0.7, rather than using a bool, you use a number and set it to either 0 or 1 (for false and true respectively). You then use this in conjunction with DimOperator elements in the LookNFeel to multiply other dimensions - when the value is 0, the thing you multiply with is essentially 'removed'. This technique is actually already used in the tab control definitions (e.g. TaharezLook/TabContentPane) to manipulate areas according to whether the tabs are at the top or at the bottom. Yes, this is slightly hacky - especially when combined with the clunky DimOperator implementation up to and including the 0.7.x releases (which makes this really, really difficult in certain cases).

Hopefully this gives some pointers. Good luck with it.

CE

Savail
Quite a regular
Quite a regular
Posts: 50
Joined: Wed Jul 04, 2012 07:54

Re: Adding custom footer to FrameWindow?

Postby Savail » Tue Jan 22, 2013 15:29

Thanks a lot for answer! Yeah, I considered creating second type of FrameWindow :P but ah well it's like 1/3 of my current LookNfeel so I searched for something more efficient. Now as I see your ideas, they seem to be really interesting solutions but I decided on the easy way :P. I created such a function:

Code: Select all

void Gui::CreateFooter(CEGUI::FrameWindow *handle)
{
   CEGUI::Window * CloseButton;

   CloseButton = CEGUI::WindowManager::getSingleton().createWindow("Game/Button2", "FooterCloseButton");

   CloseButton->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 5), CEGUI::UDim(1, -35)));

   CloseButton->setSize(CEGUI::UVector2(CEGUI::UDim(0, 100), CEGUI::UDim(0, 35)));

   CloseButton->setText("Cancel");

   CloseButton->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&Gui::ClickDestroyParent, this));

   handle->addChildWindow(CloseButton);
}

and every FrameWindow I want to have footer in, I'm passing its handle here. Nevertheless, I'll surely make use of these ideas in the future :). Thanks for your time.


Return to “Help”

Who is online

Users browsing this forum: Google [Bot] and 13 guests