X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/739e366ac91d526da389d01bb230cb628b16450a..68a2e005a51a87df6cc445345f27443e57ab3608:/src/gtk1/textctrl.cpp diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index 007c091073..23b5a380f2 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -1086,7 +1086,7 @@ void wxTextCtrl::Remove( long from, long to ) wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") ); #ifdef __WXGTK20__ - if ( m_windowStyle & wxTE_MULTILINE ) + if (m_windowStyle & wxTE_MULTILINE) { GtkTextBuffer * text_buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW(m_text) ); @@ -1187,7 +1187,9 @@ void wxTextCtrl::GetSelection(long* fromOut, long* toOut) const gint from, to; #ifdef __WXGTK20__ - if ( !gtk_editable_get_selection_bounds(GTK_EDITABLE(m_text), &from, &to) ) + GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (m_text)); + GtkTextIter ifrom, ito; + if (!gtk_text_buffer_get_selection_bounds(buffer, &ifrom, &ito)) #else if ( !(GTK_EDITABLE(m_text)->has_selection) ) #endif @@ -1197,7 +1199,10 @@ void wxTextCtrl::GetSelection(long* fromOut, long* toOut) const } else // got selection { -#ifndef __WXGTK20__ +#ifdef __WXGTK20__ + from = gtk_text_iter_get_offset(&ifrom); + to = gtk_text_iter_get_offset(&ito); +#else from = (long) GTK_EDITABLE(m_text)->selection_start_pos; to = (long) GTK_EDITABLE(m_text)->selection_end_pos; #endif @@ -1222,7 +1227,14 @@ bool wxTextCtrl::IsEditable() const wxCHECK_MSG( m_text != NULL, FALSE, wxT("invalid text ctrl") ); #ifdef __WXGTK20__ - return gtk_editable_get_editable(GTK_EDITABLE(m_text)); + if (m_windowStyle & wxTE_MULTILINE) + { + return gtk_text_view_get_editable(GTK_TEXT_VIEW(m_text)); + } + else + { + return gtk_editable_get_editable(GTK_EDITABLE(m_text)); + } #else return GTK_EDITABLE(m_text)->editable; #endif @@ -1579,7 +1591,8 @@ void wxTextCtrl::OnInternalIdle() } } - UpdateWindowUI(); + if (wxUpdateUIEvent::CanUpdate(this)) + UpdateWindowUI(wxUPDATE_UI_FROMIDLE); } wxSize wxTextCtrl::DoGetBestSize() const