[gtkmm/gtkmm-2-24] ComboBoxEntryText: Deprecate in favour of ComboBoxText.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm/gtkmm-2-24] ComboBoxEntryText: Deprecate in favour of ComboBoxText.
- Date: Thu, 25 Nov 2010 16:14:11 +0000 (UTC)
commit d66c1b27d916f87b9d014bb2c8daa3fd5bffe636
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Nov 25 17:14:04 2010 +0100
ComboBoxEntryText: Deprecate in favour of ComboBoxText.
* gtk/gtkmm/comboboxtext.[h|cc]: Added a constructor with a bool has_entry
parameter.
* gtk/gtkmm/comboboxentrytext.[h|cc]: Deprecate this whole class, telling
peopel to use ComboBoxText with has_entry=true, just as we have deprecated
ComboBoxEntry for Combobox with has_entry=true.
ChangeLog | 10 ++++++++++
gtk/gtkmm/comboboxentrytext.cc | 9 +++++++--
gtk/gtkmm/comboboxentrytext.h | 10 +++++++---
gtk/gtkmm/comboboxtext.cc | 7 +++++++
gtk/gtkmm/comboboxtext.h | 9 ++++++++-
5 files changed, 39 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f144c52..b6c35fb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2010-11-25 Murray Cumming <murrayc murrayc com>
+ ComboBoxEntryText: Deprecate in favour of ComboBoxText.
+
+ * gtk/gtkmm/comboboxtext.[h|cc]: Added a constructor with a bool has_entry
+ parameter.
+ * gtk/gtkmm/comboboxentrytext.[h|cc]: Deprecate this whole class, telling
+ peopel to use ComboBoxText with has_entry=true, just as we have deprecated
+ ComboBoxEntry for Combobox with has_entry=true.
+
+2010-11-25 Murray Cumming <murrayc murrayc com>
+
Fix gtk_methods.defs.
* gtk/src/gtk_methods.defs: Add back the gtk-unix-print-2.0 stuff that
diff --git a/gtk/gtkmm/comboboxentrytext.cc b/gtk/gtkmm/comboboxentrytext.cc
index 671ca45..5331d87 100644
--- a/gtk/gtkmm/comboboxentrytext.cc
+++ b/gtk/gtkmm/comboboxentrytext.cc
@@ -20,12 +20,18 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#ifndef GTKMM_DISABLE_DEPRECATED
+
#include <gtkmm/comboboxentrytext.h>
#include <gtkmm/liststore.h>
#include <gtkmm/cellrenderertext.h>
#include <gtk/gtk.h>
+//Allow us to use deprecated GTK+ API.
+//This whole C++ class is deprecated anyway.
+#undef GTK_DISABLE_DEPRECATED
+
namespace Gtk
{
@@ -112,7 +118,6 @@ void ComboBoxEntryText::remove_text(const Glib::ustring& text)
}
}
-#ifndef GTKMM_DISABLE_DEPRECATED
Glib::ustring ComboBoxEntryText::get_active_text() const
{
Glib::ustring result;
@@ -155,8 +160,8 @@ void ComboBoxEntryText::clear()
{
clear_items();
}
-#endif //GTKMM_DISABLE_DEPRECATED
+#endif //GTKMM_DISABLE_DEPRECATED
} // namespace Gtk
diff --git a/gtk/gtkmm/comboboxentrytext.h b/gtk/gtkmm/comboboxentrytext.h
index ed55f9e..1067d4d 100644
--- a/gtk/gtkmm/comboboxentrytext.h
+++ b/gtk/gtkmm/comboboxentrytext.h
@@ -21,6 +21,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#ifndef GTKMM_DISABLE_DEPRECATED
+
#include <gtkmm/comboboxentry.h>
namespace Gtk
@@ -29,13 +31,16 @@ namespace Gtk
//This is a C++ convenience class that is equivalent to the gtk_combo_box_entry_new_text() C convenience function.
//This is copy/paste/search/replaced from ComboBoxText, but the only alternative I see is to use multiple inheritance.
//murrayc.
+//In gtkmm-3.0 we simply wrap GtkComboBoxText, which is also in GTK+ 2.24.
+//But this C++ class was created before GtkComboBoxText existed and we want to avoid changing the ABI.
/** This is a specialisation of the ComboBoxEntry which has one column of text (a simple list),
* and appropriate methods for setting and getting the text.
*
+ * @deprecated Instead use ComboBoxText with has_entry = true.
+ *
* @ingroup Widgets
*/
-
class ComboBoxEntryText
: public ComboBoxEntry
{
@@ -66,7 +71,6 @@ public:
*/
void prepend_text(const Glib::ustring& text);
-#ifndef GTKMM_DISABLE_DEPRECATED
//@deprecated Use get_entry()->get_text() to get the actual entered text.
Glib::ustring get_active_text() const;
@@ -77,7 +81,6 @@ public:
//TODO: Remove this when we can break API.
/// @deprecated See clear_items(). Since 2.8.
void clear();
-#endif //GTKMM_DISABLE_DEPRECATED
/** Remove all items from the drop-down menu.
*/
@@ -107,6 +110,7 @@ protected:
} // namespace Gtk
+#endif //GTKMM_DISABLE_DEPRECATED
#endif /* _GTKMM_COMBOBOXENTRYTEXT_H */
diff --git a/gtk/gtkmm/comboboxtext.cc b/gtk/gtkmm/comboboxtext.cc
index b2b0de1..ed4368b 100644
--- a/gtk/gtkmm/comboboxtext.cc
+++ b/gtk/gtkmm/comboboxtext.cc
@@ -35,6 +35,13 @@ ComboBoxText::ComboBoxText()
pack_start(m_text_columns.m_column);
}
+ComboBoxText::ComboBoxText(bool has_model)
+: ComboBox(has_model)
+{
+ set_model( Gtk::ListStore::create(m_text_columns) );
+ pack_start(m_text_columns.m_column);
+}
+
ComboBoxText::ComboBoxText(GtkComboBox* castitem)
: Gtk::ComboBox(castitem)
{
diff --git a/gtk/gtkmm/comboboxtext.h b/gtk/gtkmm/comboboxtext.h
index edc6b49..631b9f5 100644
--- a/gtk/gtkmm/comboboxtext.h
+++ b/gtk/gtkmm/comboboxtext.h
@@ -40,7 +40,6 @@ namespace Gtk
*
* @ingroup Widgets
*/
-
class ComboBoxText
: public ComboBox
{
@@ -57,7 +56,15 @@ protected:
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
public:
+
+ /** Creates a new empty ComboBoxText, without an entry.
+ */
ComboBoxText();
+
+ /** 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); //In gtkmm 3.0 has_entry has a default value but we already have a default constructor here.
/** Add an item to the end of the drop-down list.
* @param text The text for the item.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]