Re: How should windowWillUseStandardFrame:defaultFrame: work? With a WebView?
Re: How should windowWillUseStandardFrame:defaultFrame: work? With a WebView?
- Subject: Re: How should windowWillUseStandardFrame:defaultFrame: work? With a WebView?
- From: Ken Thomases <email@hidden>
- Date: Mon, 11 Aug 2014 14:11:23 -0500
On Aug 11, 2014, at 1:38 PM, Daryle Walker <email@hidden> wrote:
> I’m thinking of implementing the (optimized) zoom green button. I need to provide a windowWillUseStandardFrame:defaultFrame: method to do that. I’ve read that the trial frame space given takes out room for the menu bar and the dock. Does it also remove space for the window’s chrome?
No. A window has a "frame" which is its outside size, and a "content rect" which is the size of the content view, which excludes the title bar and, if the window has one, the (standard) toolbar. You can convert between them using -[NSWindow frameRectForContentRect:] and -[NSWindow contentRectForFrameRect:]. (There are also class methods that do something similar, but they can't take a toolbar into account.)
The -windowWillUseStandardFrame:defaultFrame: method operates in terms of the frame, not the content rect.
None of these methods will take into account the content border size. That's considered to be inside the content rect.
> How can the optimized space for a WebView be determined? (In other words, given an infinite screen size, how much space would a WebView need to show the entirety of its current page?) I read that you need some difficult internal calculation with JavaScript; I hope not.
I don't know. It seems that most modern browsers don't make any particular effort to pick a zoom size that's optimized for the currently-displayed page.
Regards,
Ken
_______________________________________________
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