Remove Cocoa code and precompiler defines targeting OS X versions prior to OS X 10.7.

This commit is contained in:
Tobias Taschner 2015-08-07 16:25:28 +02:00
parent 3f63ad5c61
commit 8bd14648cd
15 changed files with 30 additions and 80 deletions

View File

@ -249,7 +249,7 @@ private:
// owned by the set. Furthermore, children of the last parent are stored
// in a linear list.
//
@interface wxCocoaOutlineDataSource : NSObject wxOSX_10_6_AND_LATER(<NSOutlineViewDataSource>)
@interface wxCocoaOutlineDataSource : NSObject <NSOutlineViewDataSource>
{
// descriptors specifying the sorting (currently the array only holds one
// object only)
@ -395,7 +395,7 @@ private:
// wxCocoaOutlineView
// ============================================================================
@interface wxCocoaOutlineView : NSOutlineView wxOSX_10_6_AND_LATER(<NSOutlineViewDelegate>)
@interface wxCocoaOutlineView : NSOutlineView <NSOutlineViewDelegate>
{
@private
// column and row of the cell being edited or -1 if none

View File

@ -336,7 +336,7 @@ public:
- (void) setTextField:(NSTextField*) field;
@end
@interface wxNSTextField : NSTextField wxOSX_10_6_AND_LATER(<NSTextFieldDelegate>)
@interface wxNSTextField : NSTextField <NSTextFieldDelegate>
{
wxNSTextFieldEditor* fieldEditor;
}
@ -346,14 +346,14 @@ public:
@end
@interface wxNSSecureTextField : NSSecureTextField wxOSX_10_6_AND_LATER(<NSTextFieldDelegate>)
@interface wxNSSecureTextField : NSSecureTextField <NSTextFieldDelegate>
{
}
@end
@interface wxNSTextView : NSTextView wxOSX_10_6_AND_LATER(<NSTextViewDelegate>)
@interface wxNSTextView : NSTextView <NSTextViewDelegate>
{
}
@ -432,7 +432,7 @@ public:
#ifdef __LP64__
WXEXPORT
#endif // 64 bit builds
@interface wxNSAppController : NSObject wxOSX_10_6_AND_LATER(<NSApplicationDelegate>)
@interface wxNSAppController : NSObject <NSApplicationDelegate>
{
}

View File

@ -20,17 +20,6 @@
#include "wx/osx/core/cfstring.h"
#include "wx/osx/core/cfdataref.h"
// Define helper macros allowing to insert small snippets of code to be
// compiled for high enough OS X version only: this shouldn't be abused for
// anything big but it's handy for e.g. specifying OS X 10.6-only protocols in
// the Objective C classes declarations when they're not supported under the
// previous versions
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
#define wxOSX_10_6_AND_LATER(x) x
#else
#define wxOSX_10_6_AND_LATER(x)
#endif
// platform specific Clang analyzer support
#ifndef NS_RETURNS_RETAINED
# if WX_HAS_CLANG_FEATURE(attribute_ns_returns_retained)

View File

@ -41,7 +41,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog);
// wxCPWCDelegate - Window Closed delegate
// ---------------------------------------------------------------------------
@interface wxCPWCDelegate : NSObject wxOSX_10_6_AND_LATER(<NSWindowDelegate>)
@interface wxCPWCDelegate : NSObject <NSWindowDelegate>
{
bool m_bIsClosed;
}

View File

@ -494,12 +494,7 @@ CGContextRef WXDLLIMPEXP_CORE wxOSXCreateBitmapContextFromNSImage( WX_NSImage ns
double wxOSXGetMainScreenContentScaleFactor()
{
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
if ( [ [NSScreen mainScreen] respondsToSelector:@selector(backingScaleFactor)] )
return [[NSScreen mainScreen] backingScaleFactor];
else
#endif
return 1.0;
return [[NSScreen mainScreen] backingScaleFactor];
}
CGImageRef wxOSXCreateCGImageFromNSImage( WX_NSImage nsimage, double *scaleptr )

View File

@ -24,7 +24,7 @@
// work in progress
@interface wxNSTableDataSource : NSObject wxOSX_10_6_AND_LATER(<NSComboBoxDataSource>)
@interface wxNSTableDataSource : NSObject <NSComboBoxDataSource>
{
wxNSComboBoxControl* impl;
}

View File

@ -52,7 +52,7 @@
// then the delegate method - (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename will have to
// be implemented
@interface wxOpenPanelDelegate : NSObject wxOSX_10_6_AND_LATER(<NSOpenSavePanelDelegate>)
@interface wxOpenPanelDelegate : NSObject <NSOpenSavePanelDelegate>
{
wxFileDialog* _dialog;
}

View File

@ -30,7 +30,7 @@
class wxListWidgetCocoaImpl;
@interface wxNSTableDataSource : NSObject wxOSX_10_6_AND_LATER(<NSTableViewDataSource>)
@interface wxNSTableDataSource : NSObject <NSTableViewDataSource>
{
wxListWidgetCocoaImpl* impl;
}
@ -50,7 +50,7 @@ class wxListWidgetCocoaImpl;
@end
@interface wxNSTableView : NSTableView wxOSX_10_6_AND_LATER(<NSTableViewDelegate>)
@interface wxNSTableView : NSTableView <NSTableViewDelegate>
{
}

View File

@ -58,7 +58,7 @@
// and under 10.4, we are not getting a 'close' event however...
#define wxOSX_USE_NEEDSUPDATE_HOOK 1
@interface wxNSMenuController : NSObject wxOSX_10_6_AND_LATER(<NSMenuDelegate>)
@interface wxNSMenuController : NSObject <NSMenuDelegate>
{
}

View File

@ -91,19 +91,11 @@ bool shouldHandleSelector(SEL selector)
}
#define wxHAS_FULL_SCREEN_API (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
#if wxHAS_FULL_SCREEN_API
static bool IsUsingFullScreenApi(WXWindow macWindow)
{
return [macWindow respondsToSelector:@selector(toggleFullScreen:)]
&& ([macWindow collectionBehavior] & NSWindowCollectionBehaviorFullScreenPrimary);
return ([macWindow collectionBehavior] & NSWindowCollectionBehaviorFullScreenPrimary);
}
#endif
//
// wx category for NSWindow (our own and wrapped instances)
//
@ -313,7 +305,7 @@ static NSResponder* s_formerFirstResponder = NULL;
// controller
//
@interface wxNonOwnedWindowController : NSObject wxOSX_10_6_AND_LATER(<NSWindowDelegate>)
@interface wxNonOwnedWindowController : NSObject <NSWindowDelegate>
{
}
@ -326,9 +318,7 @@ static NSResponder* s_formerFirstResponder = NULL;
- (void)windowDidDeminiaturize:(NSNotification *)notification;
- (BOOL)windowShouldClose:(id)window;
- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame;
#if wxHAS_FULL_SCREEN_API
- (void)windowWillEnterFullScreen:(NSNotification *)notification;
#endif
@end
@ -585,8 +575,6 @@ extern int wxOSXGetIdFromSelector(SEL action );
return true;
}
#if wxHAS_FULL_SCREEN_API
// work around OS X bug, on a secondary monitor an already fully sized window
// (eg maximized) will not be correctly put to full screen size and keeps a 22px
// title band at the top free, therefore we force the correct content size
@ -607,8 +595,6 @@ extern int wxOSXGetIdFromSelector(SEL action );
}
}
#endif
@end
wxIMPLEMENT_DYNAMIC_CLASS(wxNonOwnedWindowCocoaImpl , wxNonOwnedWindowImpl);
@ -1000,44 +986,32 @@ typedef struct
bool wxNonOwnedWindowCocoaImpl::IsFullScreen() const
{
#if wxHAS_FULL_SCREEN_API
if ( IsUsingFullScreenApi(m_macWindow) )
{
return [m_macWindow styleMask] & NSFullScreenWindowMask;
}
#endif
return m_macFullScreenData != NULL ;
}
bool wxNonOwnedWindowCocoaImpl::EnableFullScreenView(bool enable)
{
#if wxHAS_FULL_SCREEN_API
if ( [ m_macWindow respondsToSelector:@selector(setCollectionBehavior:) ] )
NSUInteger collectionBehavior = [m_macWindow collectionBehavior];
if (enable)
{
NSUInteger collectionBehavior = [m_macWindow collectionBehavior];
if (enable)
{
collectionBehavior |= NSWindowCollectionBehaviorFullScreenPrimary;
}
else
{
collectionBehavior &= ~NSWindowCollectionBehaviorFullScreenPrimary;
}
[m_macWindow setCollectionBehavior: collectionBehavior];
return true;
collectionBehavior |= NSWindowCollectionBehaviorFullScreenPrimary;
}
#else
wxUnusedVar(enable);
#endif
else
{
collectionBehavior &= ~NSWindowCollectionBehaviorFullScreenPrimary;
}
[m_macWindow setCollectionBehavior: collectionBehavior];
return false;
return true;
}
bool wxNonOwnedWindowCocoaImpl::ShowFullScreen(bool show, long WXUNUSED(style))
{
#if wxHAS_FULL_SCREEN_API
if ( IsUsingFullScreenApi(m_macWindow) )
{
if ( show != IsFullScreen() )
@ -1047,7 +1021,6 @@ bool wxNonOwnedWindowCocoaImpl::ShowFullScreen(bool show, long WXUNUSED(style))
return true;
}
#endif
if ( show )
{

View File

@ -29,7 +29,7 @@
// controller
//
@interface wxTabViewController : NSObject wxOSX_10_6_AND_LATER(<NSTabViewDelegate>)
@interface wxTabViewController : NSObject <NSTabViewDelegate>
{
}

View File

@ -827,7 +827,7 @@ wxNSTextFieldControl::wxNSTextFieldControl(wxWindow *wxPeer,
void wxNSTextFieldControl::Init(WXWidget w)
{
NSTextField wxOSX_10_6_AND_LATER(<NSTextFieldDelegate>) *tf = (NSTextField wxOSX_10_6_AND_LATER(<NSTextFieldDelegate>)*) w;
NSTextField <NSTextFieldDelegate> *tf = (NSTextField <NSTextFieldDelegate>*) w;
m_textField = tf;
[m_textField setDelegate: tf];
m_selStart = m_selEnd = 0;

View File

@ -301,7 +301,7 @@ private:
@end
@interface wxNSToolbarDelegate : NSObject wxOSX_10_6_AND_LATER(<NSToolbarDelegate>)
@interface wxNSToolbarDelegate : NSObject <NSToolbarDelegate>
{
bool m_isSelectable;
}

View File

@ -412,7 +412,7 @@ bool wxApp::DoInitGui()
}
appcontroller = OSXCreateAppController();
[[NSApplication sharedApplication] setDelegate:(id wxOSX_10_6_AND_LATER(<NSApplicationDelegate>))appcontroller];
[[NSApplication sharedApplication] setDelegate:(id <NSApplicationDelegate>)appcontroller];
[NSColor setIgnoresAlpha:NO];
// calling finishLaunching so early before running the loop seems to trigger some 'MenuManager compatibility' which leads

View File

@ -1755,9 +1755,7 @@ void wxOSXCocoaClassAddWXMethods(Class c)
wxOSX_CLASS_ADD_METHOD(c, @selector(mouseEntered:), (IMP) wxOSX_mouseEvent, "v@:@" )
wxOSX_CLASS_ADD_METHOD(c, @selector(mouseExited:), (IMP) wxOSX_mouseEvent, "v@:@" )
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
wxOSX_CLASS_ADD_METHOD(c, @selector(magnifyWithEvent:), (IMP)wxOSX_mouseEvent, "v@:@")
#endif
wxOSX_CLASS_ADD_METHOD(c, @selector(cursorUpdate:), (IMP) wxOSX_cursorUpdate, "v@:@" )
@ -1870,13 +1868,8 @@ void wxWidgetCocoaImpl::SetVisibility( bool visible )
double wxWidgetCocoaImpl::GetContentScaleFactor() const
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
NSWindow* tlw = [m_osxView window];
if ( [ tlw respondsToSelector:@selector(backingScaleFactor) ] )
return [tlw backingScaleFactor];
else
#endif
return 1.0;
return [tlw backingScaleFactor];
}
// ----------------------------------------------------------------------------
@ -1884,7 +1877,7 @@ double wxWidgetCocoaImpl::GetContentScaleFactor() const
// ----------------------------------------------------------------------------
// define a delegate used to refresh the window during animation
@interface wxNSAnimationDelegate : NSObject wxOSX_10_6_AND_LATER(<NSAnimationDelegate>)
@interface wxNSAnimationDelegate : NSObject <NSAnimationDelegate>
{
wxWindow *m_win;
bool m_isDone;