How do you add a toolbar to the bottom of an NSTableView? - macos

Check the following image, how can I add this kind of bar to my own NSTableViews? Other uses are in the network preferences app. What's the magic trick to make this work?

I don't think there is any "magic trick." This is something you will have to implement yourself.
It looks like a group of Gradient style NSButtons placed below the table view. An NSSegmentedControl in Small Square style would work too.

Related

Add and remove buttons for NSTableView (Mac Interface Builder) [duplicate]

Check the following image, how can I add this kind of bar to my own NSTableViews? Other uses are in the network preferences app. What's the magic trick to make this work?
I don't think there is any "magic trick." This is something you will have to implement yourself.
It looks like a group of Gradient style NSButtons placed below the table view. An NSSegmentedControl in Small Square style would work too.

How to achieve this interface on interface builder?

i need to have a toolbar similar to this one :
I tried with a NSSegmentedControl with the NSSegmentStyleSmallSquare style but it doesn't look like the Xcode toolbar.
Also, i need to have a split view like in XCode with a very thin border (of one pixel ?) but the NSSplitView hasn't this style (even with NSSplitViewDividerStyleThin).
Is there a way to achieve this in Interface Builder or with another way (override drawRect ?) ?
Thank you
Not really. I mean you could probably use a few UIButtons with images and additional UIImageViews for the gradient background, but considering that this would be completely static (no easy way to rearrange the tabs, add a new tab, etc) I would really recommend writing your own tab control for that.

Finder like coloured labels

OS X Finder has this nice feature to colour-label files. I'm thinking of using a similar feature in my app (that is: use this in an NSTableView/NSOutlineView, not looking to highlight items in Finder from my app). Is this ability somehow available through any of the default user interface classes or would it require a custom implementation?
I have experimented with setting NSTextFieldBezelStyle to NSTextFieldRoundedBezel but this seems to kill the ability to draw a background colour and also defaults to a grey border.
Have a look at the NSURL NSURLLabelColorKey, which is one of the attributes you can set for a URL. You can set these values with setResourceValues:error:
After Edit: Sorry, I misinterpreted the question. I think the easiest way is to use a view based table and put a borderless label inside an NSBox of the custom type. You can give the box rounded corners and a background color with no border, and that looks just like the finder label.
Download the Apple SourceView sample app. It's an NSOutlineView that uses a custom NSTextFieldCell for the drawing; tweak that to draw your custom colors.

Creating NSToolbar style buttons

Is there a bevel style that can replicate NSToolbar style of buttons that are used, for instance, in the Safari's preferences window to switch between different panes?
I need to replicate NSToolbar in an NSView using NSButtons. I understand that I should probably be using NSTabView, but I'd like to implement the look of xcode's left pane. Any tips here would be appreciated greatly.
There's nothing built-in, you'd have to create the images yourself. However, replicating the behaviour is straightforward.
You could simply use a single-row NSMatrix of NSButton objects. Just give the buttons an image and an alternate image (for the highlighted state) and set the matrix mode to NSRadioModeMatrix.

Cocoa : How to make a small toolbar like in Pages or Numbers?

Apples Application like Pages and Numbers always show an additional small Toolbar under the main Toolbar. Is there an object like this in the Interface Builder or do I have to build it from scratch?
I looked in the IB Library but found nothing so far.
You use NSSegmentedControl objects to do that, styled to Capsule. To achieve segmented controls with labels aligned underneath (which are clickable, like in Mail.app and Preview.app), you need to put them into toolbar button groups. That can't be done in IB. See this discussion in the Cocoa mailing list:
http://www.cocoabuilder.com/archive/cocoa/204390-capsule-style-toolbar-controls.html
There is no build-in control for that. You can take a look at the BWToolkit from Brandon Walkin. It has a lot of nice controls to build Apple-like applications. Maybe it can fit your needs...
It's just a simple view containing various controls. You could build most of it directly in Interface Builder. Just create an NSBox, give it a background color and then place "Mini"-sized controls in it.

Resources