From ab065e1ad9a478dbd7798f7330242914d177892b Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Sat, 1 Aug 2015 21:40:59 +0200 Subject: [PATCH] Removed OS X code targeted at versions prior to OS X 10.7. At least 10.7 is required in 3.1 anyhow, so don't check for it needlessly. See https://github.com/wxWidgets/wxWidgets/pull/55 --- src/osx/cocoa/filedlg.mm | 30 +++++------------------------- src/osx/cocoa/textctrl.mm | 2 -- src/osx/cocoa/toolbar.mm | 14 ++------------ src/osx/cocoa/window.mm | 34 +++++----------------------------- 4 files changed, 12 insertions(+), 68 deletions(-) diff --git a/src/osx/cocoa/filedlg.mm b/src/osx/cocoa/filedlg.mm index 33f5e8fecf..bdfa9c9be0 100644 --- a/src/osx/cocoa/filedlg.mm +++ b/src/osx/cocoa/filedlg.mm @@ -485,16 +485,6 @@ void wxFileDialog::SetupExtraControls(WXWindow nativeWindow) { m_filterPanel = CreateFilterPanel(extracontrol); accView = m_filterPanel->GetHandle(); - if( HasFlag(wxFD_OPEN) ) - { - if ( UMAGetSystemVersion() < 0x1060 || !HasAppKit_10_6() ) - { - wxOpenPanelDelegate* del = [[wxOpenPanelDelegate alloc]init]; - [del setFileDialog:this]; - [panel setDelegate:del]; - m_delegate = del; - } - } } else { @@ -642,21 +632,11 @@ int wxFileDialog::ShowModal() [oPanel setMessage:cf.AsNSString()]; [oPanel setAllowsMultipleSelection: (HasFlag(wxFD_MULTIPLE) ? YES : NO )]; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 - if ( UMAGetSystemVersion() >= 0x1060 && HasAppKit_10_6() ) - { - [oPanel setAllowedFileTypes: (m_delegate == nil ? types : nil)]; - if ( !m_dir.IsEmpty() ) - [oPanel setDirectoryURL:[NSURL fileURLWithPath:dir.AsNSString() - isDirectory:YES]]; - returnCode = [oPanel runModal]; - } - else -#endif - { - returnCode = [oPanel runModalForDirectory:m_dir.IsEmpty() ? nil : dir.AsNSString() - file:file.AsNSString() types:(m_delegate == nil ? types : nil)]; - } + [oPanel setAllowedFileTypes: (m_delegate == nil ? types : nil)]; + if ( !m_dir.IsEmpty() ) + [oPanel setDirectoryURL:[NSURL fileURLWithPath:dir.AsNSString() + isDirectory:YES]]; + returnCode = [oPanel runModal]; ModalFinishedCallback(oPanel, returnCode); } diff --git a/src/osx/cocoa/textctrl.mm b/src/osx/cocoa/textctrl.mm index 3602eea161..22fc4e7681 100644 --- a/src/osx/cocoa/textctrl.mm +++ b/src/osx/cocoa/textctrl.mm @@ -1099,8 +1099,6 @@ wxWidgetImplType* wxWidgetImpl::CreateTextControl( wxTextCtrl* wxpeer, // we have to emulate this [v setBezeled:NO]; [v setBordered:NO]; - if ( UMAGetSystemVersion() < 0x1070 ) - c->SetNeedsFocusRect( true ); } else { diff --git a/src/osx/cocoa/toolbar.mm b/src/osx/cocoa/toolbar.mm index 4df984e1e9..243b0c4d42 100644 --- a/src/osx/cocoa/toolbar.mm +++ b/src/osx/cocoa/toolbar.mm @@ -1185,12 +1185,7 @@ bool wxToolBar::Realize() if ( tool->IsStretchable() ) nsItemId = NSToolbarFlexibleSpaceItemIdentifier; else - { - if ( UMAGetSystemVersion() < 0x1070 ) - nsItemId = NSToolbarSeparatorItemIdentifier; - else - nsItemId = NSToolbarSpaceItemIdentifier; - } + nsItemId = NSToolbarSpaceItemIdentifier; } else { @@ -1443,12 +1438,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase) if ( tool->IsStretchable() ) nsItemId = NSToolbarFlexibleSpaceItemIdentifier; else - { - if ( UMAGetSystemVersion() < 0x1070 ) - nsItemId = NSToolbarSeparatorItemIdentifier; - else - nsItemId = NSToolbarSpaceItemIdentifier; - } + nsItemId = NSToolbarSpaceItemIdentifier; NSToolbarItem* item = [[NSToolbarItem alloc] initWithItemIdentifier:nsItemId]; tool->SetToolbarItemRef( item ); diff --git a/src/osx/cocoa/window.mm b/src/osx/cocoa/window.mm index 6bcfee0f2c..91e02ed9e5 100644 --- a/src/osx/cocoa/window.mm +++ b/src/osx/cocoa/window.mm @@ -683,39 +683,15 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve wxevent.SetEventType( wxEVT_MOUSEWHEEL ) ; - if ( UMAGetSystemVersion() >= 0x1070 ) + if ( [nsEvent hasPreciseScrollingDeltas] ) { - if ( [nsEvent hasPreciseScrollingDeltas] ) - { - deltaX = [nsEvent scrollingDeltaX]; - deltaY = [nsEvent scrollingDeltaY]; - } - else - { - deltaX = [nsEvent scrollingDeltaX] * 10; - deltaY = [nsEvent scrollingDeltaY] * 10; - } + deltaX = [nsEvent scrollingDeltaX]; + deltaY = [nsEvent scrollingDeltaY]; } else { - const EventRef cEvent = (EventRef) [nsEvent eventRef]; - // see http://developer.apple.com/qa/qa2005/qa1453.html - // for more details on why we have to look for the exact type - - bool isMouseScrollEvent = false; - if ( cEvent ) - isMouseScrollEvent = ::GetEventKind(cEvent) == kEventMouseScroll; - - if ( isMouseScrollEvent ) - { - deltaX = [nsEvent deviceDeltaX]; - deltaY = [nsEvent deviceDeltaY]; - } - else - { - deltaX = ([nsEvent deltaX] * 10); - deltaY = ([nsEvent deltaY] * 10); - } + deltaX = [nsEvent scrollingDeltaX] * 10; + deltaY = [nsEvent scrollingDeltaY] * 10; } wxevent.m_wheelDelta = 10;