From: Václav Slavík Date: Sat, 21 Sep 2013 10:11:08 +0000 (+0000) Subject: Make public headers compatible with Objective-C++ with ARC. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/1c2704fe7b25f8f0b1f92b33280adc3c63d2dcab Make public headers compatible with Objective-C++ with ARC. OSXGetViewOrWindow() virtual methods were defined in headers and were casting NSView*/NSWindow* to void*, which the compiler complains about with ARC enabled. Rather than writing conditional code in the header, move the implementations into .cpp files. They were virtual anyway, so this is no less efficient, and doesn't leave any problematic code in public headers. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74855 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/osx/nonownedwnd.h b/include/wx/osx/nonownedwnd.h index c7b75b085f..edc3f04e62 100644 --- a/include/wx/osx/nonownedwnd.h +++ b/include/wx/osx/nonownedwnd.h @@ -104,7 +104,7 @@ public: #if wxOSX_USE_COCOA_OR_IPHONE // override the base class method to return an NSWindow instead of NSView - virtual void *OSXGetViewOrWindow() const { return GetWXWindow(); } + virtual void *OSXGetViewOrWindow() const; #endif // Cocoa // osx specific event handling common for all osx-ports diff --git a/include/wx/osx/window.h b/include/wx/osx/window.h index b98107e049..623493aa1e 100644 --- a/include/wx/osx/window.h +++ b/include/wx/osx/window.h @@ -277,7 +277,7 @@ public: // // this is useful for a few Cocoa function which can work with either views // or windows indiscriminately, e.g. for setting NSViewAnimationTargetKey - virtual void *OSXGetViewOrWindow() const { return GetHandle(); } + virtual void *OSXGetViewOrWindow() const; #endif // Cocoa void * MacGetCGContextRef() { return m_cgContextRef ; } diff --git a/src/osx/nonownedwnd_osx.cpp b/src/osx/nonownedwnd_osx.cpp index 0828348eb1..9e7f1e185c 100644 --- a/src/osx/nonownedwnd_osx.cpp +++ b/src/osx/nonownedwnd_osx.cpp @@ -496,6 +496,11 @@ WXWindow wxNonOwnedWindow::GetWXWindow() const return m_nowpeer ? m_nowpeer->GetWXWindow() : NULL; } +void *wxNonOwnedWindow::OSXGetViewOrWindow() const +{ + return GetWXWindow(); +} + // --------------------------------------------------------------------------- // Shape implementation // --------------------------------------------------------------------------- diff --git a/src/osx/window_osx.cpp b/src/osx/window_osx.cpp index cb3e871efd..afbf5a0a32 100644 --- a/src/osx/window_osx.cpp +++ b/src/osx/window_osx.cpp @@ -2545,6 +2545,11 @@ bool wxWindowMac::OSXHandleClicked( double WXUNUSED(timestampsec) ) return false; } +void *wxWindowMac::OSXGetViewOrWindow() const +{ + return GetHandle(); +} + wxInt32 wxWindowMac::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF event ) { #if wxOSX_USE_COCOA_OR_CARBON