Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

Close
SSSelectable Toolbar
--------------------

Copyright (c) 2011 Steve Streeting

Permission is hereby granted, free of charge, to any person obtaining a copy of 
this software and associated documentation files (the "Software"), to deal in 
the Software without restriction, including without limitation the rights to 
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all 
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Why?
----

I needed a preference-pane style selectable toolbar which switched views easily,
allowing different sizes per pane, and not requiring a lot of manual code. I
wanted to do most of the work in Interface Builder still.

I liked the selectable toolbar in BWToolkit, but it had a few issues such as
crashing Interface Builder, getting the vertical position wrong at times, and
also that in XCode 4, Interface Builder plugins are no longer supported. So I
needed a selectable toolbar that worked in IB without any plugins.

How to use
----------

1) Add all the source files in the 'toolbar' subfolder to your XCode project
2) In Interface Builder, drag & drop an NSToolbar on to your window
3) Change the type to 'SSSelectableToolbar'
4) Connect the 'window' outlet of the toolbar to the parent window
5) Drag & drop NSToolbarItem instances on to the toolbar and check the 
   'Selectable' option
6) Change the type of each one to 'SSSelectableToolbarItem'
7) Create a Custom View instance at the root of the document (not in the window)
   for each pane and populate them how you like
8) Connect the 'linkedView' outlet of each toolbar item to the corresponding 
   pane view
9) Connect the 'nextKeyView' outlet of each custom view to the control that
   should become the first responder when switching to that tab (Optional)

And you're ready to go. Each toolbar item will switch to its corresponding pane, 
resizing the window as necessary. You can make the window resizable if you like, 
and the user size will be remembered when switching back and forth.
   
    


Recent activity

Steve Streeting

Commits by Steve Streeting were pushed to sinbad/SSSelectableToolbar

650fb3a - Add utility method to convert from selectable item index to main index This is useful for picking out selectable items in code without worrying about ...
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.