On May 18, 2014, at 3:30 PM, SevenBits wrote:

> On May 18, 2014, at 6:22 PM, Uli Kusterer <witness.of.teacht...@gmx.net> 
> wrote:
> 
>> On 18 May 2014, at 23:06, Luther Baker <lutherba...@gmail.com> 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%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=yJFJhaNnTZDfFSSz1U9TSNMmxGyib3KjZGuKfIhHLxA%3D%0A&m=ihAq%2F9sYJx0uRRRknJog%2Bz76%2FWSI%2FeU0Eg%2BZkq4RS%2FA%3D%0A&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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to