Re: Subclassing NSToolBar.
Re: Subclassing NSToolBar.
- Subject: Re: Subclassing NSToolBar.
- From: Greg Titus <email@hidden>
- Date: Fri, 5 Oct 2001 11:35:32 -0700
On Thursday, October 4, 2001, at 12:12 AM, John C. Randolph wrote:
>
I'd like to have a custom view that behaves like NSToolBarView, so that
>
when you drag its items around, you get that nice smooth animation as
>
things shift to make room for what you're dragging. I'm trying to get
>
an idea of whether it's quicker to re-implement or to subclass
>
NSToolBar to do what I want.
On Friday, October 5, 2001, at 10:33 AM, Scott Anguish wrote:
>
BTW.. the current OmniWeb SP has the functionality that John is
>
looking for.. now the question is if the source for this has been
>
released to the OmniFrameworks yet or not.
Nope, I'm afraid it hasn't been released yet. The old behavior we had
(dragging items up into a list of icons, et cetera, but without the nice
animation) is currently public code in OmniAppKit. However, in 10.1
OmniWeb's preferences uses an NSToolbar instead of the custom view we
had before. We haven't published the changed preferences implementation
in OmniAppKit yet.
So, it looks like Apple uses NSToolbar for System Preferences now, and
if you look at the header for NSToolbar you'll find that it has some
interesting new flags like "clickAndDragPerformsCustomization",
"showsNoContextMenu", and "firstMoveableItemIndex". If you set those up
appropriately by adding category methods to NSToolbar, and then you
figure out that the toolbar view accepts drags of the
"NSToolbarItemIdentiferPboardType", so you can implement your own
equivalent to the customization sheet, you can do quite a bit without
having to even subclass NSToolbar.
Is that enough customization to do what you are looking for, John?
Hope this helps,
--Greg