New convenience API to construct simple text combos, implemented by Damon

Thu Feb 26 22:20:44 2004  Matthias Clasen  <maclas@gmx.de>

	* gtk/gtkcomboboxentry.h:
	* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_new_text): New
	convenience API to construct simple text combos, implemented by
	Damon Chaplin.

	* tests/testcombo.c: Use gtk_combo_box_entry_new_text.
This commit is contained in:
Matthias Clasen 2004-02-26 21:40:09 +00:00 committed by Matthias Clasen
parent 0459484caa
commit 1637a9c55b
11 changed files with 122 additions and 29 deletions

View File

@ -1,3 +1,16 @@
Thu Feb 26 22:20:44 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcomboboxentry.h:
* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_new_text): New
convenience API to construct simple text combos, implemented by
Damon Chaplin.
* tests/testcombo.c: Use gtk_combo_box_entry_new_text.
Thu Feb 26 22:19:29 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcombobox.c (gtk_combo_box_new_text): Improve the docs.
Thu Feb 26 15:43:43 2004 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.[ch]: Export insertion cursor drawing functionality

View File

@ -1,3 +1,16 @@
Thu Feb 26 22:20:44 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcomboboxentry.h:
* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_new_text): New
convenience API to construct simple text combos, implemented by
Damon Chaplin.
* tests/testcombo.c: Use gtk_combo_box_entry_new_text.
Thu Feb 26 22:19:29 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcombobox.c (gtk_combo_box_new_text): Improve the docs.
Thu Feb 26 15:43:43 2004 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.[ch]: Export insertion cursor drawing functionality

View File

@ -1,3 +1,16 @@
Thu Feb 26 22:20:44 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcomboboxentry.h:
* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_new_text): New
convenience API to construct simple text combos, implemented by
Damon Chaplin.
* tests/testcombo.c: Use gtk_combo_box_entry_new_text.
Thu Feb 26 22:19:29 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcombobox.c (gtk_combo_box_new_text): Improve the docs.
Thu Feb 26 15:43:43 2004 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.[ch]: Export insertion cursor drawing functionality

View File

@ -1,3 +1,16 @@
Thu Feb 26 22:20:44 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcomboboxentry.h:
* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_new_text): New
convenience API to construct simple text combos, implemented by
Damon Chaplin.
* tests/testcombo.c: Use gtk_combo_box_entry_new_text.
Thu Feb 26 22:19:29 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcombobox.c (gtk_combo_box_new_text): Improve the docs.
Thu Feb 26 15:43:43 2004 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.[ch]: Export insertion cursor drawing functionality

View File

@ -1,3 +1,16 @@
Thu Feb 26 22:20:44 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcomboboxentry.h:
* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_new_text): New
convenience API to construct simple text combos, implemented by
Damon Chaplin.
* tests/testcombo.c: Use gtk_combo_box_entry_new_text.
Thu Feb 26 22:19:29 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcombobox.c (gtk_combo_box_new_text): Improve the docs.
Thu Feb 26 15:43:43 2004 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.[ch]: Export insertion cursor drawing functionality

View File

@ -1,3 +1,7 @@
Thu Feb 26 22:18:21 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtk-sections.txt: Add gtk_combo_box_entry_new_text.
Thu Feb 26 21:41:25 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtk-sections.txt: Add gtk_rc_reset_styles.

View File

@ -705,6 +705,7 @@ gtk_combo_box_get_type
GtkComboBoxEntry
gtk_combo_box_entry_new
gtk_combo_box_entry_new_with_model
gtk_combo_box_entry_new_text
gtk_combo_box_entry_set_text_column
gtk_combo_box_entry_get_text_column
<SUBSECTION Standard>

View File

@ -2842,9 +2842,10 @@ gtk_combo_box_get_model (GtkComboBox *combo_box)
*
* Convenience function which constructs a new text combo box, which is a
* #GtkComboBox just displaying strings. If you use this function to create
* a text combo box, you only want to manipulate it's data source with the
* a text combo box, you should only manipulate its data source with the
* following convenience functions: gtk_combo_box_append_text(),
* gtk_combo_box_insert_text() and gtk_combo_box_prepend_text().
* gtk_combo_box_insert_text(), gtk_combo_box_prepend_text() and
* gtk_combo_box_remove_text().
*
* Return value: A new text combo box.
*

View File

@ -337,3 +337,33 @@ gtk_combo_box_entry_mnemonic_activate (GtkWidget *widget,
return TRUE;
}
/* convenience API for simple text combos */
/**
* gtk_combo_box_entry_new_text:
*
* Convenience function which constructs a new editable text combo box, which
* is a #GtkComboBoxEntry just displaying strings. If you use this function to
* create a text combo box, you should only manipulate its data source with
* the following convenience functions: gtk_combo_box_append_text(),
* gtk_combo_box_insert_text(), gtk_combo_box_prepend_text() and
* gtk_combo_box_remove_text().
*
* Return value: A new text #GtkComboBoxEntry.
*
* Since: 2.4
*/
GtkWidget *
gtk_combo_box_entry_new_text (void)
{
GtkWidget *entry_box;
GtkListStore *store;
store = gtk_list_store_new (1, G_TYPE_STRING);
entry_box = gtk_combo_box_entry_new_with_model (GTK_TREE_MODEL (store), 0);
return entry_box;
}

View File

@ -65,6 +65,9 @@ void gtk_combo_box_entry_set_text_column (GtkComboBoxEntry *entry_box,
gint text_column);
gint gtk_combo_box_entry_get_text_column (GtkComboBoxEntry *entry_box);
/* convenience -- text */
GtkWidget *gtk_combo_box_entry_new_text (void);
G_END_DECLS

View File

@ -165,33 +165,21 @@ create_blaat ()
return GTK_TREE_MODEL (store);
}
static GtkTreeModel *
create_text_store ()
static void
setup_combo_entry (GtkWidget *entry_box)
{
GtkTreeIter iter;
GtkListStore *store;
store = GTK_LIST_STORE (gtk_list_store_new (1, G_TYPE_STRING));
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, "dum de dum", -1);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, "la la la", -1);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, "la la la dum de dum la la la la la la boom de da la la", -1);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, "bloop", -1);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, "bleep", -1);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, "klaas", -1);
return GTK_TREE_MODEL (store);
gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
"dum de dum");
gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
"la la la");
gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
"la la la dum de dum la la la la la la boom de da la la");
gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
"bloop");
gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
"bleep");
gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
"klaas");
}
int
@ -302,7 +290,8 @@ main (int argc, char **argv)
gtk_container_set_border_width (GTK_CONTAINER (boom), 5);
gtk_container_add (GTK_CONTAINER (tmp), boom);
comboboxtext = gtk_combo_box_entry_new_with_model (create_text_store (), 0);
comboboxtext = gtk_combo_box_entry_new_text ();
setup_combo_entry (comboboxtext);
gtk_container_add (GTK_CONTAINER (boom), comboboxtext);
/* done */