]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied patch [ 705212 ] wxTextCtrl::SetSelection() for wxGTK2
authorJulian Smart <julian@anthemion.co.uk>
Wed, 2 Apr 2003 17:55:42 +0000 (17:55 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Wed, 2 Apr 2003 17:55:42 +0000 (17:55 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19939 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/textctrl.cpp
src/gtk1/textctrl.cpp

index c91af21b5e1ea6f2d57917ffe86b319d2d0a672d..007c09107395249e5da4d3529305767802ff9e8c 100644 (file)
@@ -994,7 +994,14 @@ void wxTextCtrl::SetSelection( long from, long to )
     if (m_windowStyle & wxTE_MULTILINE)
     {
 #ifdef __WXGTK20__
-        // ????
+        GtkTextBuffer *buf = gtk_text_view_get_buffer( GTK_TEXT_VIEW(m_text) );
+
+        GtkTextIter fromi, toi;
+        gtk_text_buffer_get_iter_at_offset( buf, &fromi, from );
+        gtk_text_buffer_get_iter_at_offset( buf, &toi, to );
+
+        gtk_text_buffer_place_cursor( buf, &toi );
+        gtk_text_buffer_move_mark_by_name( buf, "selection_bound", &fromi );
 #else
         gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to );
 #endif
index c91af21b5e1ea6f2d57917ffe86b319d2d0a672d..007c09107395249e5da4d3529305767802ff9e8c 100644 (file)
@@ -994,7 +994,14 @@ void wxTextCtrl::SetSelection( long from, long to )
     if (m_windowStyle & wxTE_MULTILINE)
     {
 #ifdef __WXGTK20__
-        // ????
+        GtkTextBuffer *buf = gtk_text_view_get_buffer( GTK_TEXT_VIEW(m_text) );
+
+        GtkTextIter fromi, toi;
+        gtk_text_buffer_get_iter_at_offset( buf, &fromi, from );
+        gtk_text_buffer_get_iter_at_offset( buf, &toi, to );
+
+        gtk_text_buffer_place_cursor( buf, &toi );
+        gtk_text_buffer_move_mark_by_name( buf, "selection_bound", &fromi );
 #else
         gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to );
 #endif