From 395506ea99d9bb1f8e255b6b48fea9d547f02797 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Fri, 23 Nov 2012 19:02:01 +0000 Subject: [PATCH] support for custom app controllers, override OSXCreateAppController in wxApp subclass git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72999 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/osx/app.h | 9 ++++++++- src/osx/cocoa/utils.mm | 8 ++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/wx/osx/app.h b/include/wx/osx/app.h index 5145328d27..5e79828ca2 100644 --- a/include/wx/osx/app.h +++ b/include/wx/osx/app.h @@ -83,14 +83,21 @@ public: // TODO change semantics to be in line with cocoa (make autrelease NOT increase the count) void MacAddToAutorelease( void* cfrefobj ); void MacReleaseAutoreleasePool(); + public: static wxWindow* s_captureWindow ; static long s_lastModifiers ; int m_nCmdShow; -private: // mac specifics +protected: +#if wxOSX_USE_COCOA + // override for support of custom app controllers + virtual WX_NSObject OSXCreateAppController(); +#endif + +private: virtual bool DoInitGui(); virtual void DoCleanUp(); diff --git a/src/osx/cocoa/utils.mm b/src/osx/cocoa/utils.mm index 8b80a601b1..f4702bb185 100644 --- a/src/osx/cocoa/utils.mm +++ b/src/osx/cocoa/utils.mm @@ -259,10 +259,14 @@ void wxBell() @end -wxNSAppController* appcontroller = nil; +WX_NSObject appcontroller = nil; NSLayoutManager* gNSLayoutManager = nil; +WX_NSObject wxApp::OSXCreateAppController() +{ + return [[wxNSAppController alloc] init]; +} bool wxApp::DoInitGui() { @@ -272,7 +276,7 @@ bool wxApp::DoInitGui() { [wxNSApplication sharedApplication]; - appcontroller = [[wxNSAppController alloc] init]; + appcontroller = OSXCreateAppController(); [NSApp setDelegate:appcontroller]; // calling finishLaunching so early before running the loop seems to trigger some 'MenuManager compatibility' which leads