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) );
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
}
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
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
}
}
- UpdateWindowUI();
+ if (wxUpdateUIEvent::CanUpdate(this))
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
wxSize wxTextCtrl::DoGetBestSize() const