Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocoa NSWindow with 2 toolbars

Is there any way to have 2 toolbars in one NSWindow. Something like Pages. With one large on at the top, and a smaller one below that.

like image 418
Tristan Avatar asked Feb 11 '10 23:02

Tristan


1 Answers

NSWindow only supports one NSToolbar.

If you want to have a "second level" like Pages, you'll need to create your own non-NSToolbar-based solution.

Note that in Pages, the smaller "toolbar" isn't really a toolbar (as in NSToolbar), and is not editable. You should be able to recreate this with a simple custom view to draw the top and bottom lines, but let the window background through. Just position the view and set its autosizing as appropriate, then add your controls to the view.

Update: I believe NSBox can be configured to draw specific edges as of Leopard or Snow Leopard. Just a thought.

like image 161
Joshua Nozzi Avatar answered Oct 13 '22 02:10

Joshua Nozzi