[Pyobjc-dev] PyObjC equivalent of ObjC's categories?
Brought to you by:
ronaldoussoren
From: Jacob Kaplan-M. <ja...@ja...> - 2003-10-26 14:23:53
|
Hey all -- For me, one of the most powerful tools that ObjC gives is the ability to create "categories" on existing classes. This allows extending existing classes without actually needing to subclass them. For example (taken from Apple's AnimatedSlider sample code): @interface NSSlider (SliderAnimation) - (IBAction) animateToFloatValueFrom: sender; - (void) animateToFloatValue:(float) newValue; @end The above adds two instance methods to the NSSlider used in the application. How would I go about doing the same thing in PyObjC? Obviously I could subclass NSSlider to add the new methods, but I guess I'm looking for something that's a closer functional match to what the ObjC code does. TIA, Jacob |