Re: mavericks style tabs
Re: mavericks style tabs
- Subject: Re: mavericks style tabs
- From: Lee Ann Rucker <email@hidden>
- Date: Mon, 19 May 2014 12:07:34 -0700
On May 18, 2014, at 3:30 PM, SevenBits wrote:
> On May 18, 2014, at 6:22 PM, Uli Kusterer <email@hidden> wrote:
>
>> On 18 May 2014, at 23:06, Luther Baker <email@hidden> wrote:
>>> Trying my hand at some Cocoa development ... is there an SDK around the
>>> tabs used in Finder or Safari?
>>>
>>> If not, is there a popular library that folks are using (
>>> https://urldefense.proofpoint.com/v1/url?u=https://github.com/rsms/chromium-tabs&k=oIvRg1+dGAgOoM1BIlLLqw==
&r=yJFJhaNnTZDfFSSz1U9TSNMmxGyib3KjZGuKfIhHLxA=
&m=ihAq/9sYJx0uRRRknJog+z76/WSI/eU0Eg+Zkq4RS/A=
&s=022b4bc75bb38cf30d3fe81e00ca46eb0d052c5950ac9d933cc67fd0ce296837 ?) or is this something folks are
>>> generally building from ground up?
>>
>> Which of the features do you need? Do you need to be able to drag/drop/re-arrange tabs? In any event, it may be helpful to know that NSTabView can be used without a border and without actual tabs at the top, as an invisible, generic paging view. So you could let that take care of correctly doing display, focus-switching etc. and just create a control that draws the actual tabs to click at.
>
> Of course, if you want the tabs to be on your title bar, like what Chrome and the new Firefox do, you’ll need some NSWindow trickery.
Not really - that part's easy enough with
[newWindow setStyleMask:[newWindow styleMask] | NSTexturedBackgroundWindowMask];
[newWindow setAutorecalculatesContentBorderThickness:NO forEdge:NSMaxYEdge];
[[newWindow toolbar] setShowsBaselineSeparator:NO];
>
> What I would personally do? I would create a view subclass and draw the tabs myself with Core Graphics, and then add that view as a subview of the target window’s theme view.
Now *that's* trickery. My tabView is in the window's contentView, no need to poke around in the theme view:
NSRect tabFrame = [tabView bounds];
NSWindow *window = [tabView window];
/*
* Make the border extend to just below the top of the contentFrame.
* This will draw a line and will be where the sheet appears.
* If we don't set it, we'll get a random one.
*/
NSRect windowRect = [[window contentView] bounds];
CGFloat delta = windowRect.size.height - tabFrame.size.height + 2;
[window setContentBorderThickness:delta forEdge:NSMaxYEdge];
_______________________________________________
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