[gtkmm] ComboBox: Added get_entry() and get_entry_text().



commit 417f5a98e4667f3423b4b38f7254855229c399ee
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Oct 14 13:35:50 2010 +0200

    ComboBox: Added get_entry() and get_entry_text().
    
    * gtk/src/combobox.[hg|ccg]: Added our custom get_entry() method that was
      previously in ComboBoxEntry. It avoids the need to call get_child() and
      dynamic_cast<>. Added get_entry_text(), wrappping get_active_text(), which
      was previously only in ComboBoxEntry.

 ChangeLog            |   31 +++++++++++++++++++++++++++++++
 gtk/src/combobox.ccg |   13 +++++++++++++
 gtk/src/combobox.hg  |   13 +++++++++++++
 3 files changed, 57 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index cf4578a..dd5873d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,34 @@
+<<<<<<< HEAD
+=======
+2010-10-14  Murray Cumming  <murrayc murrayc com>
+
+	ComboBox: Added get_entry() and get_entry_text().
+
+	* gtk/src/combobox.[hg|ccg]: Added our custom get_entry() method that was
+  previously in ComboBoxEntry. It avoids the need to call get_child() and
+  dynamic_cast<>. Added get_entry_text(), wrappping get_active_text(), which
+  was previously only in ComboBoxEntry.
+
+2010-10-11  Murray Cumming  <murrayc murrayc com>
+
+	SpreadTable: Add get_child_line().
+
+	* gtk/src/gtk_methods.defs: Added the generated part for the new function.
+	* gtk/src/spreadtable.hg: Added get_child_line().
+
+2010-10-08  Murray Cumming  <murrayc murrayc com>
+
+	Add SpreadTable
+
+	* tools/extra_defs_gen/generate_defs_gtk.cc: Use GTK_SPREAD_TABLE.
+  * gtk/src/gtk_signas.defs: Add the generated GtkSpreadTable parts.
+
+	* gtk/src/gtk_methods.defs: Added parts for GtkSpreadTable, from h2defs.py.
+	* gtk/gtkmm.h: Include gtkmm/spreadtable.h.
+  * gtk/src/spreadtable.[hg|ccg]: New files, wrapping GtkSpreadTable.
+	* gtk/src/filelist.am: Mention the new files.
+
+>>>>>>> 18f0632... ComboBox: Added get_entry() and get_entry_text().
 2010-10-14  Murray Cumming  <murrayc murrayc com>
 
 	Move resize_grip methods from Statusbar to Window.
diff --git a/gtk/src/combobox.ccg b/gtk/src/combobox.ccg
index dd2292d..64244bf 100644
--- a/gtk/src/combobox.ccg
+++ b/gtk/src/combobox.ccg
@@ -98,4 +98,17 @@ void ComboBox::unset_row_separator_func()
   gtk_combo_box_set_row_separator_func(gobj(), 0, 0, 0 /* See C docs. */);
 }
 
+Entry* ComboBox::get_entry()
+{
+  Gtk::Widget* widget = Glib::wrap(gtk_bin_get_child(GTK_BIN(gobj())));
+  return dynamic_cast<Gtk::Entry*>(widget);
+}
+
+const Entry* ComboBox::get_entry() const
+{
+  const Gtk::Widget* widget = Glib::wrap(gtk_bin_get_child(GTK_BIN(gobj())));
+  return dynamic_cast<const Gtk::Entry*>(widget);
+}
+
+
 } // namespace Gtk
diff --git a/gtk/src/combobox.hg b/gtk/src/combobox.hg
index 1ffc062..47bcdc0 100644
--- a/gtk/src/combobox.hg
+++ b/gtk/src/combobox.hg
@@ -115,6 +115,10 @@ public:
   _WRAP_METHOD(void set_active(int index), gtk_combo_box_set_active)
   _WRAP_METHOD(void set_active(const TreeModel::iterator& iter), gtk_combo_box_set_active_iter)
 
+  //This can be used with either a text-based model (see ComboBoxText) or one that uses has_entry=true,
+  //which is awkward. So we rename it.
+  _WRAP_METHOD(Glib::ustring get_entry_text() const, gtk_combo_box_get_active_text)
+
   /** Causes no item to be active. See also set_active().
    */
   void unset_active();
@@ -162,6 +166,15 @@ public:
 
   _IGNORE(gtk_combo_box_append_text, gtk_combo_box_insert_text, gtk_combo_box_prepend_text, gtk_combo_box_remove_text, gtk_combo_box_get_active_text) //These are in ComboBoxText.
 
+  /** @see Bin::get_child().
+   */
+  Entry* get_entry();
+
+  /** @see Bin::get_child().
+   */
+  const Entry* get_entry() const;
+
+
   _WRAP_PROPERTY("model", Glib::RefPtr<TreeModel>)
   _WRAP_PROPERTY("wrap_width", int)
   _WRAP_PROPERTY("row_span_column", int)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]