Page 1 of 1

*solved* getting window metrics

Posted: Sun Sep 11, 2011 14:37
by Curtaoa
using

Code: Select all

11/09/2011 00:32:46 (Std)    ---- Version 0.7.5 (Build: Aug 23 2011 Debug Microsoft Windows MSVC++ 8.0 32 bit) ----
11/09/2011 00:32:46 (Std)    ---- Renderer module is: CEGUI::OgreRenderer - Official OGRE based 2nd generation renderer module. ----
11/09/2011 00:32:46 (Std)    ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
11/09/2011 00:32:46 (Std)    ---- Image Codec module is: OgreImageCodec - Integrated ImageCodec using the Ogre engine. ----
11/09/2011 00:32:46 (Std)    ---- Scripting module is: None ----


I am trying to get the screen metrics for the renderable part of a FrameWindow, so I created a dummy window (as a StaticImage) within it. At run-time I grab that window and get its position (left scale = 0, top scale = 0) and then recursively figure out its screen coordinates.

Works fine I can drag it around and re-size and everything, except the window claims to be at 0,0 when in fact it is below the title bar. Which is a problem because the parent window claims to have an origin at the upper-left of the title bar (thus "0,0" draws on top of the title bar). I get it, the title bar is not part of the "working" area of the window, but I have not figured out how I am supposed to compute how tall the title bar is, in pixels, to offset the draw area. I tried the look/feel but it only defines corners since the actual height is determined by the font of the label.

So I grabbed the font, and get a height on that, which is a start, but it wasn't the correct offset (and I didn't expect it to be, I would need the framing overhead as well).

So bottom line, what is the proper way to determine the screen position of the renderable area of a frame window? Specifically the top-most visible pixel. Any help would be appreciated

-Curt

Re: getting window metrics

Posted: Sun Sep 11, 2011 15:49
by Kulik
see Window::getOuterRect and InnerRect.