X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8c82361c1d8087f81abcc5edac8e523cab5dc5a9..6cd4655bee404d94e1f0eb4d880e24668c842dfd:/src/mac/textctrl.cpp diff --git a/src/mac/textctrl.cpp b/src/mac/textctrl.cpp index 3b664ca789..f69d2f0e9e 100644 --- a/src/mac/textctrl.cpp +++ b/src/mac/textctrl.cpp @@ -185,6 +185,7 @@ static pascal void TPPaneDrawProc(ControlRef theControl, ControlPartCode thePart char state; Rect bounds; /* set up our globals */ + tpvars = (STPTextPaneVars **) GetControlReference(theControl); if (tpvars != NULL) { state = HGetState((Handle) tpvars); @@ -352,7 +353,7 @@ static pascal ControlPartCode TPPaneKeyDownProc(ControlHandle theControl, memset( &ev , 0 , sizeof( ev ) ) ; ev.what = keyDown ; ev.modifiers = modifiers ; - ev.message = (( keyCode & keyCodeMask ) << 8 ) + ( charCode & charCodeMask ) ; + ev.message = (( keyCode << 8 ) & keyCodeMask ) + ( charCode & charCodeMask ) ; TXNKeyDown( (**tpvars).fTXNRec, &ev); } } @@ -517,7 +518,7 @@ OSStatus mUPOpenControl(ControlHandle theControl, bool multiline) ( multiline ? kTXNWantVScrollBarMask : 0 ) | kTXNDontDrawCaretWhenInactiveMask | kTXNDontDrawSelectionWhenInactiveMask | - kTXNAlwaysWrapAtViewEdgeMask, + kTXNAlwaysWrapAtViewEdgeMask , kTXNTextEditStyleFrameType, kTXNTextensionFile, kTXNSystemDefaultEncoding, @@ -1330,23 +1331,55 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) break; } - EventRecord *ev = (EventRecord*) wxTheApp->MacGetCurrentEvent(); - short keychar = short(ev->message & charCodeMask); if (!eat_key) { - short keycode = short(ev->message & keyCodeMask) >> 8 ; - ::HandleControlKey( (ControlHandle) m_macControl , keycode , keychar , ev->modifiers ); + // default handling + event.Skip() ; } - if ( keychar >= 0x20 || - event.KeyCode() == WXK_RETURN || - event.KeyCode() == WXK_DELETE || - event.KeyCode() == WXK_BACK) + if ( key >= 0x20 || + key == WXK_RETURN || + key == WXK_DELETE || + key == WXK_BACK) { wxCommandEvent event1(wxEVT_COMMAND_TEXT_UPDATED, m_windowId); event1.SetString( GetValue() ) ; event1.SetEventObject( this ); - GetEventHandler()->ProcessEvent(event1); + wxPostEvent(GetEventHandler(),event1); + } +} + +void wxTextCtrl::MacSuperShown( bool show ) +{ + bool former = m_macControlIsShown ; + wxControl::MacSuperShown( show ) ; + if ( (former != m_macControlIsShown) && m_macUsesTXN ) + { + if ( m_macControlIsShown ) + TXNSetFrameBounds( (TXNObject) m_macTXN, (**(STPTextPaneVars **)m_macTXNvars).fRTextArea.top, (**(STPTextPaneVars **)m_macTXNvars).fRTextArea.left, + (**(STPTextPaneVars **)m_macTXNvars).fRTextArea.bottom,(**(STPTextPaneVars **)m_macTXNvars).fRTextArea.right, (**(STPTextPaneVars **)m_macTXNvars).fTXNFrame); + else + TXNSetFrameBounds( (TXNObject) m_macTXN, (**(STPTextPaneVars **)m_macTXNvars).fRTextArea.top + 30000, (**(STPTextPaneVars **)m_macTXNvars).fRTextArea.left, + (**(STPTextPaneVars **)m_macTXNvars).fRTextArea.bottom + 30000, (**(STPTextPaneVars **)m_macTXNvars).fRTextArea.right, (**(STPTextPaneVars **)m_macTXNvars).fTXNFrame); + } +} + +bool wxTextCtrl::Show(bool show) +{ + bool former = m_macControlIsShown ; + + bool retval = wxControl::Show( show ) ; + + if ( former != m_macControlIsShown ) + { + if ( m_macControlIsShown ) + TXNSetFrameBounds( (TXNObject) m_macTXN, (**(STPTextPaneVars **)m_macTXNvars).fRTextArea.top, (**(STPTextPaneVars **)m_macTXNvars).fRTextArea.left, + (**(STPTextPaneVars **)m_macTXNvars).fRTextArea.bottom,(**(STPTextPaneVars **)m_macTXNvars).fRTextArea.right, (**(STPTextPaneVars **)m_macTXNvars).fTXNFrame); + else + TXNSetFrameBounds( (TXNObject) m_macTXN, (**(STPTextPaneVars **)m_macTXNvars).fRTextArea.top + 30000, (**(STPTextPaneVars **)m_macTXNvars).fRTextArea.left, + (**(STPTextPaneVars **)m_macTXNvars).fRTextArea.bottom + 30000, (**(STPTextPaneVars **)m_macTXNvars).fRTextArea.right, (**(STPTextPaneVars **)m_macTXNvars).fTXNFrame); } + + return retval ; } // ----------------------------------------------------------------------------