• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Subclassing NSToolBar.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subclassing NSToolBar.


  • Subject: Re: Subclassing NSToolBar.
  • From: "John C. Randolph" <email@hidden>
  • Date: Fri, 5 Oct 2001 13:35:19 -0700

On Friday, October 5, 2001, at 01:08 PM, Ali Ozer wrote:

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.

Sigh, those bits are private and definitely likely to move in a future
release...

But that's what we love about Obj-C!

When Don and I wanted to round off the bottom corners of the game window in BabelBloX, I was able to class-dump the appkit, find NSThemeFrame and the -shapeWindow method of NSDrawer, and I was off to the races!

Being able to do things like this:

- changeClassToClass:(Class) newClass
{
self->isa = newClass;
return self;
}

and this:

- (void) shapeWindow
{
static void (*shapeMethodIMP) (id,SEL);
if (! shapeMethodIMP)
shapeMethodIMP = (void (*)(id, SEL)) [NSDrawerFrame instanceMethodForSelector:@selector(shapeWindow)];
shapeMethodIMP(self, _cmd);
}

is one of the reasons why I'll fight for Obj-C any day of the week.

-jcr
(Now, if I could just find -_reallySecretIconSlidingMethod, I'd save myself a couple of hours.)



"I fear all we have done is to awaken a sleeping giant and fill him with a terrible resolve." -Admiral Isoroku Yamamoto, Dec 7, 1941.


  • Follow-Ups:
    • retainCount
      • From: Rosyna <email@hidden>
References: 
 >Re: Subclassing NSToolBar. (From: Ali Ozer <email@hidden>)

  • Prev by Date: progressView
  • Next by Date: Re: Subclassing NSToolBar.
  • Previous by thread: Re: Subclassing NSToolBar.
  • Next by thread: retainCount
  • Index(es):
    • Date
    • Thread