X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/939fba6c17da245488a77a3f58e983180fc5de91..b4e7f826aff0f60826543bec9e1cb3fbcbeb0589:/src/mac/textctrl.cpp diff --git a/src/mac/textctrl.cpp b/src/mac/textctrl.cpp index e86d3299a3..ad911c3987 100644 --- a/src/mac/textctrl.cpp +++ b/src/mac/textctrl.cpp @@ -460,10 +460,7 @@ static pascal ControlPartCode TPPaneFocusProc(ControlHandle theControl, ControlF kControlFocusNoPart, otherwise return a non-zero part code. kUserClickedToFocusPart - is a constant defined for this example. You should define your own value for handling click-to-focus type events. */ - /* save the drawing state */ - SetPort((**tpvars).fDrawingEnvironment); - wxMacWindowClipper clipper( wxFindControlFromMacControl(theControl ) ) ; - /* calculate the next highlight state */ + /* calculate the next highlight state */ switch (action) { default: case kControlFocusNoPart: @@ -485,6 +482,9 @@ static pascal ControlPartCode TPPaneFocusProc(ControlHandle theControl, ControlF new focus state */ if ( IsControlVisible( theControl ) ) { + /* save the drawing state */ + SetPort((**tpvars).fDrawingEnvironment); + wxMacWindowClipper clipper( wxFindControlFromMacControl(theControl ) ) ; DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive); DrawThemeFocusRect(&varsp->fRFocusOutline, varsp->fIsActive && varsp->fInFocus); } @@ -748,7 +748,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, } wxString st = str ; - st.Replace(wxT("\n"), wxT("\r")); + wxMacConvertNewlines13To10( &st ) ; if ( !m_macUsesTXN ) { m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , "\p" , false , 0 , 0 , 1, @@ -865,7 +865,7 @@ wxString wxTextCtrl::GetValue() const } #endif } - result.Replace(wxT("\r"),wxT("\n")) ; + wxMacConvertNewlines10To13( &result ) ; return result ; } @@ -885,7 +885,7 @@ void wxTextCtrl::GetSelection(long* from, long* to) const void wxTextCtrl::SetValue(const wxString& str) { wxString st = str ; - st.Replace(wxT("\n"), wxT("\r")); + wxMacConvertNewlines13To10( &st ) ; if ( !m_macUsesTXN ) { wxCharBuffer text = st.mb_str(wxConvLocal) ; @@ -1174,7 +1174,7 @@ long wxTextCtrl::GetLastPosition() const void wxTextCtrl::Replace(long from, long to, const wxString& str) { wxString value = str ; - value.Replace(wxT("\n"), wxT("\r")); + wxMacConvertNewlines13To10( &value ) ; if ( !m_macUsesTXN ) { ControlEditTextSelectionRec selection ; @@ -1279,7 +1279,7 @@ bool wxTextCtrl::LoadFile(const wxString& file) void wxTextCtrl::WriteText(const wxString& str) { wxString st = str ; - st.Replace(wxT("\n"), wxT("\r")); + wxMacConvertNewlines13To10( &st ) ; if ( !m_macUsesTXN ) { wxCharBuffer text = st.mb_str(wxConvLocal) ; @@ -1316,10 +1316,6 @@ void wxTextCtrl::AppendText(const wxString& text) void wxTextCtrl::Clear() { - if ( !IsEditable() ) - { - return ; - } if ( !m_macUsesTXN ) { ::SetControlData((ControlHandle) m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , 0 , (char*) ((const char*)NULL) ) ; @@ -1433,7 +1429,12 @@ bool wxTextCtrl::CanRedo() const return FALSE ; } -// Makes 'unmodified' +// Makes modifie or unmodified +void wxTextCtrl::MarkDirty() +{ + m_dirty = true; +} + void wxTextCtrl::DiscardEdits() { m_dirty = false;