From d8f3e9da0200c375c5ca6977bc36369886e2195d Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 20 Nov 2007 08:02:56 +0000 Subject: [PATCH] cleanup mac git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50103 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/textctrl.cpp | 132 +++++++++--------------------------- 1 file changed, 33 insertions(+), 99 deletions(-) diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp index b447b8ee36..9acdf06d40 100644 --- a/src/mac/carbon/textctrl.cpp +++ b/src/mac/carbon/textctrl.cpp @@ -174,23 +174,14 @@ public : virtual bool HasOwnContextMenu() const { -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 - if ( UMAGetSystemVersion() >= 0x1040 ) - { - TXNCommandEventSupportOptions options ; - TXNGetCommandEventSupport( m_txn , & options ) ; - return options & kTXNSupportEditCommandProcessing ; - } -#endif - - return false ; + TXNCommandEventSupportOptions options ; + TXNGetCommandEventSupport( m_txn , & options ) ; + return options & kTXNSupportEditCommandProcessing ; } virtual void CheckSpelling(bool check) { -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 - TXNSetSpellCheckAsYouType( m_txn, (Boolean) check ); -#endif + TXNSetSpellCheckAsYouType( m_txn, (Boolean) check ); } virtual void Clear() ; @@ -1028,52 +1019,6 @@ bool wxTextCtrl::MacSetupCursor( const wxPoint& pt ) return true ; } -#if !TARGET_API_MAC_OSX - -// user pane implementation - -void wxTextCtrl::MacControlUserPaneDrawProc(wxInt16 part) -{ - GetPeer()->MacControlUserPaneDrawProc( part ) ; -} - -wxInt16 wxTextCtrl::MacControlUserPaneHitTestProc(wxInt16 x, wxInt16 y) -{ - return GetPeer()->MacControlUserPaneHitTestProc( x , y ) ; -} - -wxInt16 wxTextCtrl::MacControlUserPaneTrackingProc(wxInt16 x, wxInt16 y, void* actionProc) -{ - return GetPeer()->MacControlUserPaneTrackingProc( x , y , actionProc ) ; -} - -void wxTextCtrl::MacControlUserPaneIdleProc() -{ - GetPeer()->MacControlUserPaneIdleProc( ) ; -} - -wxInt16 wxTextCtrl::MacControlUserPaneKeyDownProc(wxInt16 keyCode, wxInt16 charCode, wxInt16 modifiers) -{ - return GetPeer()->MacControlUserPaneKeyDownProc( keyCode , charCode , modifiers ) ; -} - -void wxTextCtrl::MacControlUserPaneActivateProc(bool activating) -{ - GetPeer()->MacControlUserPaneActivateProc( activating ) ; -} - -wxInt16 wxTextCtrl::MacControlUserPaneFocusProc(wxInt16 action) -{ - return GetPeer()->MacControlUserPaneFocusProc( action ) ; -} - -void wxTextCtrl::MacControlUserPaneBackgroundProc(void* info) -{ - GetPeer()->MacControlUserPaneBackgroundProc( info ) ; -} - -#endif - // ---------------------------------------------------------------------------- // implementation base class // ---------------------------------------------------------------------------- @@ -1251,8 +1196,6 @@ int wxMacTextControl::GetLineLength(long lineNo) const // standard unicode control implementation // ---------------------------------------------------------------------------- -#if TARGET_API_MAC_OSX - // the current unicode textcontrol implementation has a bug : only if the control // is currently having the focus, the selection can be retrieved by the corresponding // data tag. So we have a mirroring using a member variable @@ -1509,8 +1452,6 @@ void wxMacUnicodeTextControl::WriteText( const wxString& str ) } } -#endif - // ---------------------------------------------------------------------------- // MLTE control implementation (common part) // ---------------------------------------------------------------------------- @@ -1748,40 +1689,36 @@ void wxMacMLTEControl::AdjustCreationAttributes(const wxColour &background, tback.bg.color = MAC_WXCOLORREF( background.GetPixel() ); TXNSetBackground( m_txn , &tback ); -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 - if ( UMAGetSystemVersion() >= 0x1040 ) + + TXNCommandEventSupportOptions options ; + if ( TXNGetCommandEventSupport( m_txn, &options ) == noErr ) { - TXNCommandEventSupportOptions options ; - if ( TXNGetCommandEventSupport( m_txn, &options ) == noErr ) - { - options |= - kTXNSupportEditCommandProcessing - | kTXNSupportEditCommandUpdating - | kTXNSupportFontCommandProcessing - | kTXNSupportFontCommandUpdating; - - // only spell check when not read-only - // use system options for the default - bool checkSpelling = false ; - if ( !(m_windowStyle & wxTE_READONLY) ) - { + options |= + kTXNSupportEditCommandProcessing + | kTXNSupportEditCommandUpdating + | kTXNSupportFontCommandProcessing + | kTXNSupportFontCommandUpdating; + + // only spell check when not read-only + // use system options for the default + bool checkSpelling = false ; + if ( !(m_windowStyle & wxTE_READONLY) ) + { #if wxUSE_SYSTEM_OPTIONS - if ( wxSystemOptions::HasOption( wxMAC_TEXTCONTROL_USE_SPELL_CHECKER ) && (wxSystemOptions::GetOptionInt( wxMAC_TEXTCONTROL_USE_SPELL_CHECKER ) == 1) ) - { - checkSpelling = true ; - } -#endif + if ( wxSystemOptions::HasOption( wxMAC_TEXTCONTROL_USE_SPELL_CHECKER ) && (wxSystemOptions::GetOptionInt( wxMAC_TEXTCONTROL_USE_SPELL_CHECKER ) == 1) ) + { + checkSpelling = true ; } - - if ( checkSpelling ) - options |= - kTXNSupportSpellCheckCommandProcessing - | kTXNSupportSpellCheckCommandUpdating; - - TXNSetCommandEventSupport( m_txn , options ) ; +#endif } + + if ( checkSpelling ) + options |= + kTXNSupportSpellCheckCommandProcessing + | kTXNSupportSpellCheckCommandUpdating; + + TXNSetCommandEventSupport( m_txn , options ) ; } -#endif } void wxMacMLTEControl::SetBackground( const wxBrush &brush ) @@ -2985,13 +2922,10 @@ static pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler { case kEventTextInputUnicodeForKeyEvent : { - if ( UMAGetSystemVersion() >= 0x1040 ) - { - TXNOffset from , to ; - TXNGetSelection( focus->GetTXNObject() , &from , &to ) ; - if ( from == to ) - TXNShowSelection( focus->GetTXNObject() , kTXNShowStart ); - } + TXNOffset from , to ; + TXNGetSelection( focus->GetTXNObject() , &from , &to ) ; + if ( from == to ) + TXNShowSelection( focus->GetTXNObject() , kTXNShowStart ); result = CallNextEventHandler(handler,event); break; } -- 2.45.2