Re: How to calculate NSToolbar height in fullscreen mode
Re: How to calculate NSToolbar height in fullscreen mode
- Subject: Re: How to calculate NSToolbar height in fullscreen mode
- From: Lee Ann Rucker <email@hidden>
- Date: Wed, 26 Sep 2012 14:36:31 -0700
On Sep 26, 2012, at 2:14 PM, Nava Carmon wrote:
>
> I don't use default NSApplicationPresentationOptions. An the requirement is to leave the toolbar in place, since it has necessary functional buttons. I tried to use willUseFullScreenContentSize, but you cannot change the size there, because basically it's calculated properly by cocoa. The only time I need to calculate it by myself (because of customized animation) in window:
> startCustomAnimationToEnterFullScreenWithDuration:
>
> fullScreenAccessoryView might be a good idea… Are there any examples of usage?
Not that I've seen, but it's pretty simple: just make an NSView and call [toolbar setFullScreenAccessoryView:] in your awakeFromNib.
> Thanks!
>
> On Sep 25, 2012, at 11:43 PM, Lee Ann Rucker wrote:
>
>>
>> On Sep 25, 2012, at 5:07 AM, Nava Carmon wrote:
>>
>>> It's good to know that I'm not alone in this ordeal :), though it doesn't solve the problem.
>>> The height of toolbar (as it returned by the function, that I took from Apple's example) before entering the FS is some 50 pix.
>>> Measured height of the same toolbar in FS is 63 pix (both are without title bar). So I cannot use the cached toolbar height. That's what I'm asking whether there is an API, that returns it?
>>> Because if i set the frame of the window in FS mode to be as NSScreen's frame the detached toolbar will cover the upper part of the window (even before sliding down with the menu bar), which I want to prevent.
>>
>> Are you using the default NSApplicationPresentationOptions? I implement the window delegate method to return AutoHideToolbar and I make my FS windows cover the whole screen. I haven't used the visible toolbar option but it does seem odd to me that you'd have to do the window size adjustment yourself; the FS side of window handling seems pretty good in that respect.
>>
>> One thing you might experiment with is adding a fullScreenAccessoryView, then looking at its position onscreen when you're in FS. There's also window:willUseeFullScreenContentSize: which I haven't looked at because I don't need it.
>>
>> But no, there are no APIs because NSToolbar is older than fullscreen and we didn't need them before now.
>>
>>>
>>>
>>>
>>>
>>> On Sep 24, 2012, at 9:07 PM, Lee Ann Rucker wrote:
>>>
>>>>
>>>> On Sep 24, 2012, at 5:50 AM, Nava Carmon wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I have to perform custom animation for NSWindow transition to full screen mode. The window have a NSToolbar in icons-only mode with custom items.
>>>>> How to calculate properly the final frame of such a window in full screen? Seems, that the height of the toolbar in the fullscreen is not the same as in regular mode (not including title).
>>>>>
>>>>> Thanks
>>>>>
>>>>> Best Regards,
>>>>>
>>>>> Nava Carmon,
>>>>>
>>>>
>>>>
>>>> rdar://12144703
>>>>
>>>> http://openradar.appspot.com/12144703
>>>>
>>>> In window:startCustomAnimationToExitFullScreenWithDuration:, I know the target contentRect but I can't use -frameRectForContentRect: to find the target frameRect because the window style is still fullscreen, and can't use +frameRectForContentRect:styleMask: because it doesn't know about the toolbar.
>>>> Because all the windows using the same toolbar get updated when the toolbar style changes, I can't just save the window and/or toolbar size before going into fullscreen because it may not be valid when I exit.
>>>>
>>>> Though if you always keep the same toolbar style and size you should be able to cache the toolbar height from before you enter FS and restore it coming out; even if it is different in FS (something I've never seen) it's the standard window you care about. The FS window always covers the entire screen; the toolbar slides down over it and you don't need to worry about it. It's not even a child of your window at that point, it's got a special window it lives in.
>>>
>>
>
_______________________________________________
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