Re: Calculating screen UI metrics in advance
Re: Calculating screen UI metrics in advance
- Subject: Re: Calculating screen UI metrics in advance
- From: Clark Cox <email@hidden>
- Date: Sat, 18 Dec 2004 12:01:09 -0500
On Fri, 17 Dec 2004 16:22:05 +0000, Ken Tabb <email@hidden> wrote:
> Hi folks,
> is there any way to get screen metrics (eg. the height of an NSPanel's
> titlebar (utility window mode, small titlebar)), ahead of actually
> creating an instance of the NSPanel?
>
> So for instance I have an NSPanel that I'd like to position initially 8
> pixels below the bottom of the menu bar. I create it with
> NSUtilityWindowMask, giving me a thin titlebar at the top. I need to
> set it's contentRect as part of the init process, yet I need to know
> how big it's titlebar is, to factor that into the contentRect's origin.
>
> So what I'm currently doing is:
> [1] figure out size of contentRect that I want inside the panel
> [2] set the origin of that contentRect, factoring in [[NSScreen
> mainScreen] visibleFrame] so that I don't end up behind the dock etc.,
> but not factoring in the window's title bar (as I don't know this yet
> until the window is init'ed)
> [3] init the window with the contentRect from [2]
> [4] adjust the window's contentRect's frame down a bit to now factor in
> the window's titlebar (which I can determine now the window has been
> initialised), so that there is an 8 pixel gap between the top of the
> titlebar and the bottom of the menu bar..
>
> I can't help but feel I'm missing something painfully obvious to most
> of you, but I'm scratching my head like an idiot (cunning use of the
> word "like"...)
NSWindow has these methods:
+frameRectForContentRect:styleMask:
+contentRectForFrameRect:styleMask:
> Another great thing would be to be able to calculate the thickness of
> the NSButtonCell bezel types (i.e. 1 pixel thick, 2 pixels thick etc.),
> as different bezel types invade the frame by different amounts
File a bug report requesting such a method.
--
Clark S. Cox III
email@hidden
http://www.livejournal.com/users/clarkcox3/
http://homepage.mac.com/clarkcox3/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden