]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/textctrl.cpp
Added implementations for two cases of wxSystemSettingsNative::GetMetric to
[wxWidgets.git] / src / gtk1 / textctrl.cpp
index 007c09107395249e5da4d3529305767802ff9e8c..23b5a380f2d98c7fd23ebe4ffc382d87cb71f336 100644 (file)
@@ -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