Drag. Drop. Connect. Done.
Latest Version: 1.3 - released 5/29/06. More info available in the Version History.
Want to stay up-to-date?
Enter your email address below and I'll let you know when new versions are released.
See it in action:
ALERT: I have not maintained this code or this page for quite some time :-) Please refer to the "maccode" repository at Google Code for more up-to-date developments...
Looking to add a Safari-style tabs implementation to your project? Look no further; all the heavy lifting has been done in PSMTabBarControl. Two download possibilities exist:
Source (348K, .zip)
... in case you want to inspect, tweak, and customize - BSD licensed.
Palette (361K, .zip)
... in case you just want to use it. Drag and Drop easy; comes with instructions and videos.
This control features three available styles: "Metal" (your old friend from Safari), "Aqua" (an even older friend), and "Unified", who is new to the neighborhood, but seems well accepted.
These tabs are drag/drop reorderable across multiple windows, and include sweet eye-candy drag/drop and hide/show animation that is 10.3 compatible.
Guaranteed to cut down on head scratching (as long as you read English, my mother tongue). If you want to RTFM, you can.
At least, that's how I describe them... when a tab is created, it attempts to establish bindings to a controller object that you provide, and will automagically update a progress indicator, an object counter, an icon, and the tab title as changes occur. No glue code on your part if you follow the documented object pattern (which is also present in the demo app). Should you choose not to provide the object pattern, no problem - everything still works as expected.
In addition to the tab style, you can now specify certain behaviors for the control:
- Can close only tab
- Hide for single tab
- Show add tab button
- Min tab width
- Max tab width
- Optimum tab width
- Size tab to fit content
- Allows drag between windows
This is my attempt to give something back to the developer community for all the help I have received... everything is freely available under the BSD source license, which is documented in the read me. Please let me know if you find a use for PSMTabBarControl in your app - I'd love to create a list of apps using it as time goes by!
Version 1.3 (May 29, 2006)
- new feature: Unified tab style, compliments of Keith Blount
- new feature: allow multi-window drag config option (again from Keith).
- fixed bug: Palette installation/usage instructions were wrong.
- enhancement: exposed the representedTabViewItems method, which can be used to retrieve the order of the tabs as displayed in the control, since the underlying NSTabView does not get reordered during drag and drop rearrangement.
Version 1.2 (April 20, 2006)
- new feature: multi-window drag and drop support.
- bug fixed: zombie issue with tabView:didCloseTabViewItem
- bugs fixed: some drawing issues around the progress indicators in tabs, and the add tab button.
- enhancement: the hide/show animation has been improved with less "flickering" of progress indicators during the hide and show.
Version 1.1.2 (April 5, 2006)
- fixed bug: tabs of non-integer width resulted in occasional anti-aliased drawing issues of dividers between tabs in the Metal style (Thanks, Kent).
- added feature: delegate can now respond to -tabView:shouldCloseTabViewItem: and -tabView:willCloseTabViewItem:, and -tabView:didCloseTabViewItem: messages, so your app can take care of any needed setup/cleanup for these actions.
- fixed bug: tab close buttons now show down state when pressed down.
- added documentation: included documentation now lists the delegate methods that a delegate can receive.
Version 1.1.1 (March 16, 2006)
- fixed bug: Palette inspector would not reflect state of previously instantiated control. This has been fixed (Thanks, Guillaume).
- enhancement: Overflow button now highlights when mouse down (Thanks, Kent).
- fixed bug: when set to not close a solo tab, the close button would be hidden for the tab, but could still be closed if you clicked the tab in the right location. This has been fixed (Thanks, malcom).
Version 1.1 (March 10, 2006)
- Bound the "title" of the cell to the "label" of the source tabview item. Just in case you wanted to change the label on the tab during the running of your application.
- PSMTabBarCell factored to support new tab "styles", or appearances in drawing. Now supported are the existing "Metal" style and a new "Aqua" style. Many thanks to David Smith, Seth Willits, and Chris Forsythe for their contributions!
- Control can be configured to "Hide for single tab", so it doesn't appear unless there are more than a single tab view present. Features animated show/hide behavior (that can be called anytime, and is called automatically in the case that a single tab exists). The show/hide behavior can also be set up to resize either the window (default) or a selected "partner view" to compensate for the lost height of the tab bar.
- Control can be configured for "Can close only tab" behavior. If set to NO, no close button will appear on a lone tab.
- Cells can be set to "size to fit", or given uniform min/max/optimum sizes.
- Added support for display of an icon and an object count, if the proper app design pattern is followed.
- Sweet animated drag-and-drop drawing!
- A few drawing bugs surrounding the progress indicators in cells were squished.
- New documentation, in case you found the read me a little pithy.
Version 1.0 (December 2005)
- Initial release of safari-like tab implementation.