Re: Safari-like padlock button in window title bar
Re: Safari-like padlock button in window title bar
- Subject: Re: Safari-like padlock button in window title bar
- From: Jerry Krinock <email@hidden>
- Date: Wed, 21 May 2008 22:45:59 -0700
On 2008 May, 20, at 17:08, Gary L. Wade wrote:
I'm planning on doing something like this myself with one of my
projects, and the way I plan on trying it out is by using:
-(NSButton *)standardWindowButton:(NSWindowButton)b;
for each NSWindowButton of the NSWindow, find a reasonable visual
gap to the left/right of one of the buttons, and then add my own to
their superview.
Yes, you can find this in the list archives in the context of adding
an icon to a title bar. But that method you're referring to takes a
constant and returns one of the Apple-provided buttons. For example:
NSButton* button = [window
standardWindowButton:NSWindowCloseButton] ;
Some other lines that might come in handy:
NSView* wholeWindow = [button superview] ;
float titleBarHeight = [window
frameRectForContentRect:NSZeroRect].size.height ;
NSFont* titleBarFont = [NSFont titleBarFontOfSize:0.0] ; // 0.0
gives default font size (13.0)
[wholeWindow addSubview:myButton] ;
And you're lucky if you're going to add that button on the left,
because then you won't have write code to move it when the window
resizes ;)
_______________________________________________
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