converte code in XML

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

Hronos
Just popping in
Just popping in
Posts: 3
Joined: Tue Jan 01, 2008 12:45

converte code in XML

Postby Hronos » Wed Jan 02, 2008 10:58

How this write in XML file:
myFrameWindow = createWindow();
myTitlebar = myFrameWindow->getChildItem("TitleBar");
URect titlebarArea= myTitlebar->getArea();
myFirstWidget = createWindow();
myFirstWidget->setPosition( the Y coordinate is based on URect.yBottom or URect.height);

?

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

Postby CrazyEddie » Wed Jan 02, 2008 13:37

Hi

Is myFirstWidget to be a child of myFrameWindow? Or is it on some other part of the window hierarchy?

In the case of the former, you'll have to basically create a customised window type via XML using the Falagard system - it can't be done in a layout. If this is kind of solution is acceptable, examples can be found in the existing looknfeels (look at <Child> elements in FrameWindow and the way it positions the titlebar and close buttons) - if you can't work it out, post back and hopefully an example can be provided.

In the case of the latter, I'm not sure it's possible off of the top of my head ;)

CE

Hronos
Just popping in
Just popping in
Posts: 3
Joined: Tue Jan 01, 2008 12:45

Postby Hronos » Wed Jan 02, 2008 14:05

I work with framewindow and I want that coordinates began after titlebar and I wish to realise that not at code, I wanna realise that in a file.

Excuse for my bad English

And please show me example... :)

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

Postby CrazyEddie » Thu Jan 03, 2008 09:45

I think I understand where you're coming from, and the issue of positioning within FrameWindow is actually a common one and a confirmed weakness in that widget.

I'll try to come up with some funky solution which I can post as an example of a possible work-around :)

Watch this space...

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

Postby CrazyEddie » Thu Jan 03, 2008 10:51

This is an example of how you can add a "Client Area" to the FrameWindow type. The main advantage of having a seperate client area window is that this allows you to use relative co-ordinates for your content but have the certainty that the content will never disappear behind the title bar. The trade off is that you add a layer of complexity in accessing the content - maining that you can't query the FrameWindow directly about its content, but rather you have to first obtain access to the 'client area' window and query that instead. Another limitation is that the area for the client region will not update if you turn off the window frame or title bar - so you'd need a new window type for each possibility, but such is life when dealing with workarounds.

Anyhow, the example consists of a modified TaharezLook FrameWindow, what you need is a new client area window part such as in the snippet below, this snippet can be inserted before the other <Child> tags in the WigetLook for TahareaLook/FrameWindow:

Code: Select all

...
        <!--
        ***************************************************
            This is where we add in the new child component
            for a client area window.  Note that the area
            defined for this is the same as the named area
            ClientWithTitleWithFrame above.  We basically
            keep the top edge of the client area glued
            to the bottom edge of the titlebar - this
            way we can ensure that content added to the
            client area will never be obscured by the
            title bar.
        ***************************************************
        -->
        <Child type="DefaultWindow" nameSuffix="__auto_clientarea__">
            <Area>
                <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="WindowTopLeft" dimension="Width" /></Dim>
                <Dim type="TopEdge" ><WidgetDim widget="__auto_titlebar__" dimension="BottomEdge" /></Dim>
                <Dim type="RightEdge" >
                    <UnifiedDim scale="1" type="RightEdge">
                        <DimOperator op="Subtract">
                            <ImageDim imageset="TaharezLook" image="WindowTopRight" dimension="Width" />
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
                <Dim type="BottomEdge" >
                    <UnifiedDim scale="1" type="BottomEdge">
                        <DimOperator op="Subtract">
                            <ImageDim imageset="TaharezLook" image="WindowBottomEdge" dimension="Height" />
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
            </Area>
        </Child>
...


And here is a simple layout XML that shows how you add your content to the new FrameWindow type. Note the use of the AutoWindow tag to target the content into a component of the compound FrameWindow.

Code: Select all

<GUILayout>
<Window Type="DefaultGUISheet" Name="root">

    <Window Type="TaharezLook/FrameWindow" Name="ATestWindow">
        <Property Name="UnifiedPosition" Value="{{0.1,0},{0.1,0}}" />
        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
        <Property Name="UnifiedMinSize" Value="{{0,128},{0,128}}" />
        <Property Name="UnifiedSize" Value="{{0.4,0},{0.5,0}}" />
        <Property Name="Text" Value="Demo of seperate client area." />

        <!--
        ***************************************************
            Notice that the content of this window actually
            go inside a child component of the compound
            type FrameWindow - this is achieved by the
            use of the AutoWindow tag and supplying the
            name suffix used when we defined the new
            client area component above.
        ***************************************************
        -->
        <AutoWindow NameSuffix="__auto_clientarea__" >
            <Window Type="TaharezLook/Button" Name="ATestWindow/Button">
                <Property Name="UnifiedAreaRect" Value="{{0.02,0},{0.01,0},{0.98,0},{0.15,0}}" />
                <Property Name="Text" Value="Don't push me!" />
            </Window>

            <Window Type="TaharezLook/Button" Name="ATestWindow/Button2">
                <Property Name="UnifiedAreaRect" Value="{{0.04,0},{0.6,0},{0.96,0},{0.75,0}}" />
                <Property Name="Text" Value="Another button" />
            </Window>
        </AutoWindow>

    </Window>
</Window>
</GUILayout>


Once it's up and running you can see that positions are now based upon the actual client area of the window and that we can use relative co-ords without fear of obscuring the content with the title bar.

This should probably be tidied up, expanded, and put on the main wiki as a tutorial, since most people will not be aware that you can do this type of thing.

HTH

CE.

Hronos
Just popping in
Just popping in
Posts: 3
Joined: Tue Jan 01, 2008 12:45

Postby Hronos » Thu Jan 03, 2008 13:01

Big thanks. And add this to wiki))) This is actual problem)

Pompei2
Home away from home
Home away from home
Posts: 489
Joined: Tue May 23, 2006 16:31

Postby Pompei2 » Thu Jan 10, 2008 17:39

yes, this is GREAT, still it is a workaround, I already love it :D very very usefull !

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

Postby CrazyEddie » Thu Jan 10, 2008 19:40

Hi,

It is my intention to expand this a little and write up a Wiki article this coming weekend.

CE.

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

Postby CrazyEddie » Sat Jan 12, 2008 14:33

I have written a more generalised article that basically contains this same content: here

Pompei2
Home away from home
Home away from home
Posts: 489
Joined: Tue May 23, 2006 16:31

Postby Pompei2 » Sat Jan 12, 2008 15:12

very nice article ! i learned a lot of it!


Return to “Help”

Who is online

Users browsing this forum: No registered users and 17 guests