From 4e324a3fbfdac39f15ba0b96b97e1f3035ce8dd7 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Thu, 9 Dec 2004 15:27:54 +0000 Subject: [PATCH] Combobox corrections git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30919 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/combobox.h | 2 +- include/wx/gtk1/combobox.h | 2 +- src/gtk/combobox.cpp | 9 ++++++++- src/gtk1/combobox.cpp | 9 ++++++++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/include/wx/gtk/combobox.h b/include/wx/gtk/combobox.h index c27d532b47..7265f891e5 100644 --- a/include/wx/gtk/combobox.h +++ b/include/wx/gtk/combobox.h @@ -122,7 +122,7 @@ public: bool CanUndo() const; bool CanRedo() const; void SelectAll(); - bool IsEditable() const { return !HasFlag(wxCB_READONLY); } + bool IsEditable() const ; bool HasSelection() const ; // implementation diff --git a/include/wx/gtk1/combobox.h b/include/wx/gtk1/combobox.h index c27d532b47..7265f891e5 100644 --- a/include/wx/gtk1/combobox.h +++ b/include/wx/gtk1/combobox.h @@ -122,7 +122,7 @@ public: bool CanUndo() const; bool CanRedo() const; void SelectAll(); - bool IsEditable() const { return !HasFlag(wxCB_READONLY); } + bool IsEditable() const ; bool HasSelection() const ; // implementation diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index 99e75910c2..9a1c2100bb 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -674,7 +674,7 @@ void wxComboBox::Redo() void wxComboBox::SelectAll() { - Select(0, GetLastPosition()); + SetSelection(0, GetLastPosition()); } bool wxComboBox::CanUndo() const @@ -769,9 +769,16 @@ void wxComboBox::GetSelection( long* from, long* to ) const { if (IsEditable()) { +#ifdef __WXGTK20__ GtkEditable *editable = GTK_EDITABLE(GTK_COMBO(m_widget)->entry); + gint start, end; + gtk_editable_get_selection_bounds(editable, & start, & end); + *from = start; + *to = end; +#else *from = (long) editable->selection_start_pos; *to = (long) editable->selection_end_pos; +#endif } } diff --git a/src/gtk1/combobox.cpp b/src/gtk1/combobox.cpp index 99e75910c2..9a1c2100bb 100644 --- a/src/gtk1/combobox.cpp +++ b/src/gtk1/combobox.cpp @@ -674,7 +674,7 @@ void wxComboBox::Redo() void wxComboBox::SelectAll() { - Select(0, GetLastPosition()); + SetSelection(0, GetLastPosition()); } bool wxComboBox::CanUndo() const @@ -769,9 +769,16 @@ void wxComboBox::GetSelection( long* from, long* to ) const { if (IsEditable()) { +#ifdef __WXGTK20__ GtkEditable *editable = GTK_EDITABLE(GTK_COMBO(m_widget)->entry); + gint start, end; + gtk_editable_get_selection_bounds(editable, & start, & end); + *from = start; + *to = end; +#else *from = (long) editable->selection_start_pos; *to = (long) editable->selection_end_pos; +#endif } } -- 2.47.2