Re: Utility/Floating window with titlebar on left side
Re: Utility/Floating window with titlebar on left side
- Subject: Re: Utility/Floating window with titlebar on left side
- From: Dave Jewell <email@hidden>
- Date: Sat, 20 Sep 2008 10:23:15 +0100
On Thu, 18 Sep 2008 17:30:27 -0700, Nick Beadman said:
Interface Builder does have "Side Title" checkbox in the Appearance
section of the window attributes inspector when working on Carbon
window. IB2 is slightly more intelligent in that it knows it should
only be enabled for certain window types (e.g. utility windows).
I would still be interested in sample code showing a sub-class of
NSWindow or NSPanel....
Nick
Hi Nick. If you want to pursue this, there is an undocumented style
bit which gives you a left-edged titlebar. As you mention, IB is
smart enough to stop you doing what doesn't make sense, but its
possible to override the sanity. ;-) If you subclass your window/
panel, you can then override
initWithContentRect:styleMask:backing:defer inside your subclass, and
OR the existing stylemask with (1<<9) before calling the super method.
The code below shows how (without IB) to do this programmatically:
NSWindow * weirdWindow = [[NSWindow alloc] initWithContentRect:
NSMakeRect (50, 50, 500, 300) styleMask: NSTitledWindowMask | (1 << 9)
backing: NSBackingStoreBuffered defer: NO];
[weirdWindow orderFront: self];
However, as others have pointed out, it's not that simple. In the
above code, for example, I've not made the window closable (no close
box) 'cos if you try, the close box will end up half on and half off
the vertical titlebar! Not great! If you really want to do this, and
make it look good then (a) it's probably quite a bit of work and (b)
you'll very likely need to give your window a custom frame class.
Cheers,
Dave
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden