[gtkmm/gtkmm-2-24] ComboBox: Make the API more like the one in gtkmm 3.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm/gtkmm-2-24] ComboBox: Make the API more like the one in gtkmm 3.
- Date: Thu, 27 Jan 2011 15:07:49 +0000 (UTC)
commit 027b3395cd0574f09d22c3829fc922be76771591
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Jan 27 16:07:39 2011 +0100
ComboBox: Make the API more like the one in gtkmm 3.
* gtk/src/combobox.[hg|ccg]: Added get_entry() and get_entry_text(), which
were already in gtkmm 3.
ChangeLog | 7 +++++++
gtk/src/combobox.ccg | 21 +++++++++++++++++++++
gtk/src/combobox.hg | 17 +++++++++++++++++
3 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3a90ebc..15af14d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2011-01-27 Murray Cumming <murrayc murrayc com>
+ ComboBox: Make the API more like the one in gtkmm 3.
+
+ * gtk/src/combobox.[hg|ccg]: Added get_entry() and get_entry_text(), which
+ were already in gtkmm 3.
+
+2011-01-27 Murray Cumming <murrayc murrayc com>
+
Allow discovery of the installed m4 files.
* gtk/gtkmm.pc.in: Add gmmprocm4dir, as we do in gtkmm 3,
diff --git a/gtk/src/combobox.ccg b/gtk/src/combobox.ccg
index 67e84c3..534c6c4 100644
--- a/gtk/src/combobox.ccg
+++ b/gtk/src/combobox.ccg
@@ -98,5 +98,26 @@ 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);
+}
+
+Glib::ustring ComboBox::get_entry_text() const
+{
+ const Gtk::Entry* entry = get_entry();
+ if(!entry)
+ return Glib::ustring();
+ else
+ return entry->get_text();
+}
+
} // namespace Gtk
diff --git a/gtk/src/combobox.hg b/gtk/src/combobox.hg
index 6a3fa5f..b44ff43 100644
--- a/gtk/src/combobox.hg
+++ b/gtk/src/combobox.hg
@@ -124,6 +124,13 @@ 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)
+ //TODO: See https://bugzilla.gnome.org/show_bug.cgi?id=612396#c30
+ /** Get the text in the entry, if there is an entry.
+ *
+ * @newin{2,24}
+ */
+ Glib::ustring get_entry_text() const;
+
/** Causes no item to be active. See also set_active().
*/
void unset_active();
@@ -172,6 +179,16 @@ 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().
+ * @newin{2,24}
+ */
+ Entry* get_entry();
+
+ /** @see Bin::get_child().
+ * @newin{2,24}
+ */
+ 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]