Re: [MacRuby-devel] HotCocoa subclassing NSView

2009-02-17 Thread Richard Kilmer
They do inherit constants, custom methods, etc (see lib/hotcocoa/ mapper.rb, NOTE: ugly file right now, is a target for refactor) They are modules and those modules are mixed in. Best, Rich On Feb 17, 2009, at 12:46 PM, Matt Aimonetti wrote: Thanks Rich, but if I do what you recommended, I g

Re: [MacRuby-devel] HotCocoa subclassing NSView

2009-02-17 Thread Matt Aimonetti
Thanks Rich, but if I do what you recommended, I guess I would not be able to use all the NSView extra stuff defined by the existing NSView mapping (constants, custom methods etc..). Wouldn't be better to make each mapping a mixin? That would allow us to reuse some default settings and subclassing

Re: [MacRuby-devel] HotCocoa subclassing NSView

2009-02-17 Thread Richard Kilmer
This is how I would do it: class MyNewView < NSView def drawRect(rect) end end HotCocoa::Mappings.map :my_new_view => :"MyNewView" do defaults :frame => DefaultEmptyRect, :layout => {} def init_with_options(view, options) view.initWithFrame options.delete(:frame) end end Then i

[MacRuby-devel] HotCocoa subclassing NSView

2009-02-17 Thread Matt Aimonetti
I'm working on a new HotCocoa sample and I need to subclass NSView to override drawRect and add few more methods. I would like to be able to reuse all the goodies from HotCocoa and the view helper, what's the best way to do that? -Matt ___ MacRuby-devel