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
This commit is contained in:
Václav Slavík
2013-09-21 10:11:08 +00:00
parent d10fdec4b7
commit 1c2704fe7b
4 changed files with 12 additions and 2 deletions

View File

@@ -104,7 +104,7 @@ public:
#if wxOSX_USE_COCOA_OR_IPHONE #if wxOSX_USE_COCOA_OR_IPHONE
// override the base class method to return an NSWindow instead of NSView // override the base class method to return an NSWindow instead of NSView
virtual void *OSXGetViewOrWindow() const { return GetWXWindow(); } virtual void *OSXGetViewOrWindow() const;
#endif // Cocoa #endif // Cocoa
// osx specific event handling common for all osx-ports // osx specific event handling common for all osx-ports

View File

@@ -277,7 +277,7 @@ public:
// //
// this is useful for a few Cocoa function which can work with either views // this is useful for a few Cocoa function which can work with either views
// or windows indiscriminately, e.g. for setting NSViewAnimationTargetKey // or windows indiscriminately, e.g. for setting NSViewAnimationTargetKey
virtual void *OSXGetViewOrWindow() const { return GetHandle(); } virtual void *OSXGetViewOrWindow() const;
#endif // Cocoa #endif // Cocoa
void * MacGetCGContextRef() { return m_cgContextRef ; } void * MacGetCGContextRef() { return m_cgContextRef ; }

View File

@@ -496,6 +496,11 @@ WXWindow wxNonOwnedWindow::GetWXWindow() const
return m_nowpeer ? m_nowpeer->GetWXWindow() : NULL; return m_nowpeer ? m_nowpeer->GetWXWindow() : NULL;
} }
void *wxNonOwnedWindow::OSXGetViewOrWindow() const
{
return GetWXWindow();
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Shape implementation // Shape implementation
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -2545,6 +2545,11 @@ bool wxWindowMac::OSXHandleClicked( double WXUNUSED(timestampsec) )
return false; return false;
} }
void *wxWindowMac::OSXGetViewOrWindow() const
{
return GetHandle();
}
wxInt32 wxWindowMac::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF event ) wxInt32 wxWindowMac::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF event )
{ {
#if wxOSX_USE_COCOA_OR_CARBON #if wxOSX_USE_COCOA_OR_CARBON