NSWindow styleMask and full screen
NSWindow styleMask and full screen
- Subject: NSWindow styleMask and full screen
- From: Gideon King <email@hidden>
- Date: Fri, 20 Jul 2012 11:54:22 +1000
I have an application where sometimes I need to go full screen. While in full screen mode, I need to change the presentation mode so that sometimes the menubar and toolbar are autohiding, and sometimes just not shown. Then when I exit full screen, I reset the values to what they were before I started.
This works fine, except that when I return from full screen, the minimize button is disabled on the window.
So I thought I would record the styleMask of the window before going full screen, and then restore it afterwards.
When I ask for the window's styleMask, I get a value of 4111 which according to the documentation would be an impossible value. If I just use that value for setStyleMask: later in my program, my minimize button is still disabled.
I'm suspecting that Apple must be using the value for other things too, so I thought I would use:
oldStyleMask = [window styleMask];
oldStyleMask = oldStyleMask & (NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask|NSTexturedBackgroundWindowMask);
… do stuff …
[window setStyleMask:oldStyleMask];
Now when I use the & statement, I get a value of 15, which matches how the window looks, but setting the style mask back to that value still doesn't enable the minimize button.
I looked around and found a suggestion on stack overflow http://stackoverflow.com/questions/7888308/nswindow-loses-miniaturize-button-on-lion, but the idea there would only be applicable if I was keeping the same application presentation options for the whole time I'm in full screen, which is not the case.
I have the same problem on 10.6, and the proposed workaround linked off stack overflow doesn't work - presumably because I change the application presentation options.
I even thought I would try to be smart and override styleMask with the following:
- (NSUInteger)styleMask {
return [super styleMask]|NSMiniaturizableWindowMask;
}
But even that wouldn't enable the miniaturize button!
Does anyone know of a workaround for this?
TIA
Gideon
_______________________________________________
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