gtkmm r1017 - in trunk: . gtk/src



Author: murrayc
Date: Sat Jul 26 12:31:19 2008
New Revision: 1017
URL: http://svn.gnome.org/viewvc/gtkmm?rev=1017&view=rev

Log:
2008-07-26  Murray Cumming  <murrayc murrayc com>

* gtk/src/comboboxentry.ccg:
* gtk/src/comboboxentry.hg: Added get_active_text(), wrapping the 
special (stupid) use of combo_box_get_active_text() for 
GtkComboBoxEntry.
Class documentation: Added the new advice from the C documentation, 
about using get_active() to check if the changed signal is 
is really signalling a selection change.:


Modified:
   trunk/ChangeLog
   trunk/gtk/src/comboboxentry.ccg
   trunk/gtk/src/comboboxentry.hg

Modified: trunk/gtk/src/comboboxentry.ccg
==============================================================================
--- trunk/gtk/src/comboboxentry.ccg	(original)
+++ trunk/gtk/src/comboboxentry.ccg	Sat Jul 26 12:31:19 2008
@@ -37,6 +37,14 @@
   return Glib::wrap((GtkEntry*)(gtk_bin_get_child(base)));
 }
 
+Glib::ustring ComboBoxEntry::get_active_text() const
+{
+  //gtk_combo_box_get_active_text() can be used with text-comboboxes, 
+  //or GtkComboBoxEntry, which is quite stupid. murrayc:
+  return Glib::convert_return_gchar_ptr_to_ustring (gtk_combo_box_get_active_text(GTK_COMBO_BOX(gobj())));
+}
+
+
 
 } // namespace Gtk
 

Modified: trunk/gtk/src/comboboxentry.hg
==============================================================================
--- trunk/gtk/src/comboboxentry.hg	(original)
+++ trunk/gtk/src/comboboxentry.hg	Sat Jul 26 12:31:19 2008
@@ -29,16 +29,24 @@
 namespace Gtk
 {
 
-/** A text entry field with a dropdown list
+/** A text entry field with a dropdown list.
  * A ComboBoxEntry is a widget that allows the user to choose from a list of valid choices or enter a different 
  * value. It is very similar to a ComboBox, but it displays the selected value in an entry to allow modifying it.
  *
  * In contrast to a ComboBox, the underlying model of a ComboBoxEntry must always have a text column (see 
- * set_text_column()), and the entry will show the content of the text column in the selected row.
+ * set_text_column()), and the entry will show the content of the text column in the selected row. To get the text from the entry, use get_active_text().
  *
- * See also ComboBoxEntryText, , which is specialised for a single text column.
+ * The changed signal will be emitted while typing into a ComboBoxEntry, as well as when selecting an item from the 
+ * ComboBoxEntry's list. Use get_active() to discover whether an item was actually selected from 
+ * the list. 
  *
- * To add and remove strings from the list, just modify the model using its data manipulation API. You can get the * Entry by using get_child().
+ * See also ComboBoxEntryText, which is specialised for a single text column.
+ *
+ * To add and remove strings from the list, just modify the model using its data manipulation API. You can get the 
+ * Entry by using get_child().
+ *
+ * If you have special needs that go beyond a simple entry (e.g. input validation), it is possible to replace the 
+ * child entry by a different widget using Gtk::Container::remove() and Gtk::Container::add(). 
  *
  * The ComboBoxEntry widget looks like this:
  * @image html comboboxentry1.png
@@ -74,6 +82,13 @@
   _WRAP_METHOD(void set_text_column(int text_column) const, gtk_combo_box_entry_set_text_column) 
   _WRAP_METHOD(int get_text_column() const, gtk_combo_box_entry_get_text_column) 
 
+  /** Returns the currently active string.
+   * @result The currently active text.
+   *
+   * @newin2p14
+   */
+  Glib::ustring get_active_text() const;
+
   //The child is always an entry:
 
   /** @see Bin::get_child().



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