Hi all,
I have all of the actions of the different window widgets go to various Objective-C controller classes, and I'd like all of those controllers to call function in a single instance of a main controller class written in C++ for the entire window. (I'm writing a Cocoa front-end to some C++.)
What I was thinking was to have a sub-class of NSWindow that has a pointer to a C++ class representing the overall controller for the window. Each of my Objective-C controller classes has an outlet for their respective widgets. I figured I could use the [NSView window] message for each of the outlets to get at that pointer. Is that a reasonable way of doing that? If so, when should I construct the C++ class? Is adding the awakeFromNib message to my NSWindow sub-class the right time? If so, when should I deconstruct it?
Thanks!
I have all of the actions of the different window widgets go to various Objective-C controller classes, and I'd like all of those controllers to call function in a single instance of a main controller class written in C++ for the entire window. (I'm writing a Cocoa front-end to some C++.)
What I was thinking was to have a sub-class of NSWindow that has a pointer to a C++ class representing the overall controller for the window. Each of my Objective-C controller classes has an outlet for their respective widgets. I figured I could use the [NSView window] message for each of the outlets to get at that pointer. Is that a reasonable way of doing that? If so, when should I construct the C++ class? Is adding the awakeFromNib message to my NSWindow sub-class the right time? If so, when should I deconstruct it?
Thanks!