diff --git a/cocoa/widgets/col.h b/cocoa/widgets/col.h index 9a729c0..b51f620 100644 --- a/cocoa/widgets/col.h +++ b/cocoa/widgets/col.h @@ -93,13 +93,19 @@ - (BOOL)isFlipped; @end - @interface CocoaWindow : NSWindow + @interface AppDelegate : NSObject + + - (void)applicationDidFinishLaunching: (NSNotification *)notification; + - (BOOL)applicationShouldTerminateAfterLastWindowClosed: (NSNotification *)notification; + + @end + + @interface CocoaWindow : NSWindow { // NOT USED } - - (void)applicationDidFinishLaunching: (NSNotification *)notification; - - (BOOL)applicationShouldTerminateAfterLastWindowClosed: (NSNotification *)notification; + - (id) initFormWithTitle:(NSString*)title width:(NSInteger)width height:(NSInteger)height windowStyle: (NSWindowStyleMask) style; - (void)createApplicationMenu; @end @@ -622,6 +628,7 @@ id getTab(id parent, const char *name); void eventAction(id widget, EVENT_ACTION callback); + void setDelegate(id widget); #ifdef __cplusplus } diff --git a/cocoa/widgets/functions.m b/cocoa/widgets/functions.m index e734204..8d7f9ae 100644 --- a/cocoa/widgets/functions.m +++ b/cocoa/widgets/functions.m @@ -119,6 +119,7 @@ void LB_Clear(id widget) { void Cocoa_Init() { [NSApplication sharedApplication]; + [NSApp setDelegate: [[AppDelegate new] autorelease]]; [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; } @@ -181,3 +182,7 @@ void setSystemAction(id widget, const char *Title, const char *actionName) { [menuItem setAction: @selector(selector)]; } } + +void setDelegate(id widget) { + [NSApp setDelegate: widget]; +}