[gtkmm/2.91.1_fixes: 1/3] Added missing files
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm/2.91.1_fixes: 1/3] Added missing files
- Date: Thu, 21 Oct 2010 09:45:35 +0000 (UTC)
commit 559419c6d3683760de910adbf705d6cff051f59b
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Oct 19 11:22:37 2010 +0200
Added missing files
gtk/src/comboboxtext.ccg | 67 ++++++++++++++++++++++++++++++++++++++++++++++
gtk/src/comboboxtext.hg | 67 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 134 insertions(+), 0 deletions(-)
---
diff --git a/gtk/src/comboboxtext.ccg b/gtk/src/comboboxtext.ccg
new file mode 100644
index 0000000..ce65f49
--- /dev/null
+++ b/gtk/src/comboboxtext.ccg
@@ -0,0 +1,67 @@
+/*
+ *
+ * Copyright 2010 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gtk/gtk.h>
+
+namespace Gtk
+{
+
+ComboBoxText::ComboBoxText(bool has_entry)
+:
+ _CONSTRUCT("has-entry", gboolean(has_entry))
+{}
+
+ComboBoxText::ComboBoxText(const Glib::RefPtr<TreeModel>& model, bool has_entry)
+:
+ _CONSTRUCT("model", Glib::unwrap(model), "has-entry", gboolean(has_entry))
+{}
+
+void ComboBoxText::clear_items()
+{
+ //TODO: //TODO: Use a C function: https://bugzilla.gnome.org/show_bug.cgi?id=324899
+ GtkTreeModel* model = gtk_combo_box_get_model(GTK_COMBO_BOX(gobj()));
+ g_return_if_fail (GTK_IS_LIST_STORE(model));
+ GtkListStore* store = GTK_LIST_STORE(model);
+ gtk_list_store_clear(store);
+}
+
+void ComboBoxText::set_active_text(const Glib::ustring& text)
+{
+ //Look for the row with this text, and activate it:
+ Glib::RefPtr<Gtk::TreeModel> model = get_model();
+ if(model)
+ {
+ for(Gtk::TreeModel::iterator iter = model->children().begin(); iter != model->children().end(); ++iter)
+ {
+ Glib::ustring this_text;
+ iter->get_value(0, this_text);
+
+ if(this_text == text)
+ {
+ set_active(iter);
+ return; //success
+ }
+ }
+ }
+
+ //Not found, so mark it as blank:
+ unset_active();
+}
+
+} // namespace Gtk
diff --git a/gtk/src/comboboxtext.hg b/gtk/src/comboboxtext.hg
new file mode 100644
index 0000000..fb25f21
--- /dev/null
+++ b/gtk/src/comboboxtext.hg
@@ -0,0 +1,67 @@
+/* comboboxtext.h
+ *
+ * Copyright (C) 2010 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gtkmm/combobox.h>
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(gtkmm/private/combobox_p.h)
+
+
+namespace Gtk
+{
+
+/** This is a simple variant of ComboBox that hides the model-view complexity for simple text-only use cases.
+ * You can add items to a ComboBoxText with append_text(), insert_text() or prepend_text() and remove items with remove_text().
+ *
+ * @ingroup Widgets
+ */
+class ComboBoxText
+: public ComboBox
+{
+ _CLASS_GTKOBJECT(ComboBoxText, GtkComboBoxText, GTK_COMBO_BOX_TEXT, ComboBox, GtkComboBox)
+public:
+
+ /** Creates a new empty ComboBoxText, optionally with an entry.
+ * @param has_entry If this is true then this will have an Entry widget.
+ */
+ explicit ComboBoxText(bool has_entry = false);
+ _IGNORE(gtk_combo_box_text_new_with_entry)
+
+ /** Creates a new ComboBoxText with the model initialized to @a model.
+ * @param model The model containing data to display in the ComboBoxText.
+ * @param has_entry If this is true then this will have an Entry widget.
+ */
+ explicit ComboBoxText(const Glib::RefPtr<TreeModel>& model, bool has_entry = false);
+ _IGNORE(gtk_combo_box_text_new_with_model)
+
+ _WRAP_METHOD(void append_text(const Glib::ustring& text), gtk_combo_box_text_append_text)
+ _WRAP_METHOD(void insert_text(int position, const Glib::ustring& text), gtk_combo_box_text_insert_text)
+ _WRAP_METHOD(void prepend_text(const Glib::ustring& text), gtk_combo_box_text_prepend_text)
+ _WRAP_METHOD(void remove_text(int position), gtk_combo_box_text_remove)
+ _WRAP_METHOD(Glib::ustring get_active_text() const, gtk_combo_box_text_get_active_text)
+
+ //TODO: Use a C function: https://bugzilla.gnome.org/show_bug.cgi?id=324899
+ void clear_items();
+
+ //TODO: Add a C function
+ void set_active_text(const Glib::ustring& text);
+};
+
+
+} // namespace Gtk
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]