[Solved] Nested DimOperator or Equivalent Function?

Help and discussion regarding skinning, themes, and other artistic content.

Moderators: CEGUI MVP, CEGUI Team

mithryanna
Just popping in
Just popping in
Posts: 13
Joined: Fri Jun 25, 2010 15:00
Location: USA

[Solved] Nested DimOperator or Equivalent Function?

Postby mithryanna » Mon Sep 27, 2010 18:38

First of all, I'd like to take a moment to thank both CEGUI and everyone else on the forums who has helped answer several questions our dev team has had regarding CEGUI. We're all hoping you can help us again with this little quirk that we can't get working right...

The problem is a very simple one that I'm sure has a very simple solution. However, what we thought should work does not and we are unsure why.

The problem is with our frame windows. Besides the title bar, we have a decorative border on our windows (goes under the title bar and along the left, right, and bottom edge). This is just defined in the looknfeel, and the images are showing up fine. However, the client area is drawing itself overtop of the top decorative frame. It's easiest to show the problem rather than try to describe it; and it's most apparent when you see an opaque version and a transparent version.


Image

Image


Now, we've isolated the section of the looknfeel that is doing this; it was originally:

Code: Select all

<Dim type="TopEdge">
            <WidgetDim widget="__auto_titlebar__" dimension="Height" />
</Dim>


(That was leftover from the WindowsLook, which we've been modifying for our skin.)

So we thought, 'Ok, we get it, we need it to account for both the height of the titlebar AND the height of our image.' We've been trying to do just that, and so far Mr. DimOperator tag is not cooperating. At first we were trying to use the WidgetDim code from above, and just slapped a DimOperator Add after that with the ImageDim inside of it, resulting in the WidgetDim being ignored entirely and only the ImageDim being recognized. We finally realized that every example of DimOperator uses the tag in conjunction with a UnifiedDim tag and changed our code accordingly. The following looknfeel code works:

Code: Select all

<Dim type="TopEdge">
   <UnifiedDim scale="1" type="TopEdge"/>
   <DimOperator op="Subtract">
      <WidgetDim widget="__auto_titlebar__" dimension="Height" />
   </DimOperator>
</Dim>


But that is only accounting for one variable dim, while we want to account for the variable dimensions of the titlebar height and image height. We tried nesting a DimOperator inside of the first, so that the value that is subtracted equals height of the titlebar widget and height of the image added together. Like so:

Code: Select all

<Dim type="TopEdge">
   <UnifiedDim scale="1" type="TopEdge"/>
   <DimOperator op="Subtract">
      <WidgetDim widget="__auto_titlebar__" dimension="Height" />
      <DimOperator op="Add">
         <ImageDim imageset="IsLook" image="ISWindowTop" dimension="Height" />
      </DimOperator>
   </DimOperator>
</Dim>


This doesn't work--I think because we can't use DimOperator with WidgetDim, since it's not a UnifiedDim. Either way, we also tried using two separate DimOperator tags instead of nesting them:

Code: Select all

<Dim type="TopEdge">
   <UnifiedDim scale="1" type="TopEdge"/>
   <DimOperator op="Subtract">
      <WidgetDim widget="__auto_titlebar__" dimension="Height" />
   </DimOperator>
        <DimOperator op="Subtract">
      <ImageDim imageset="IsLook" image="ISWindowTop" dimension="Height" />
   </DimOperator>
</Dim>


No go. This resulted in the top edge being 1 - height of the image; titlebar was ignored. This can only be observed when the window is transparent, since titlebar is drawn over top of the background.

Image

What is the proper way to do what we are trying to do? We want topedge = 1 - (titlebarHeight + imageHeight), aka topedge = 1 - titlebarHeight - imageHeight, so that the top edge of our frame isn't being covered up by the background. Since it looks like DimOperator doesn't work in series or nested (unless we are doing it wrong) there must be another approach!
Last edited by mithryanna on Tue Sep 28, 2010 14:06, edited 1 time in total.

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

Re: Nested DimOperator or Equivalent Function?

Postby CrazyEddie » Tue Sep 28, 2010 10:29

Your images don't show up :cry:

You were almost there, try this:

Code: Select all

<Dim type="TopEdge">
   <UnifiedDim scale="1" type="TopEdge"/>
   <DimOperator op="Subtract">
      <WidgetDim widget="__auto_titlebar__" dimension="Height" >
         <DimOperator op="Add">
            <ImageDim imageset="IsLook" image="ISWindowTop" dimension="Height" />
         </DimOperator>
      </WidgetDim>
   </DimOperator>
</Dim>


HTH

CE.

mithryanna
Just popping in
Just popping in
Posts: 13
Joined: Fri Jun 25, 2010 15:00
Location: USA

Re: Nested DimOperator or Equivalent Function?

Postby mithryanna » Tue Sep 28, 2010 14:06

Sorry about the images.

Your solution worked perfectly! Thanks a bunch!


Return to “Skins and Themes”

Who is online

Users browsing this forum: No registered users and 4 guests