diff options
author | Bill Meier <wmeier@newsguy.com> | 2010-07-20 14:30:41 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2010-07-20 14:30:41 +0000 |
commit | 4f48117483ce4531dffc4e11f8abe7612bd28417 (patch) | |
tree | 59a738d3ec1e31f8328cf72330e662782fc989e9 /gtk/gui_utils.c | |
parent | 5a2ca22658ffcd2fc8b6c94619d4a4641c7fbcb7 (diff) |
Add ws_combo_box_new_text_and_pointer_full() to allow returning
the cell renderer associated with the ComboBox.
svn path=/trunk/; revision=33591
Diffstat (limited to 'gtk/gui_utils.c')
-rw-r--r-- | gtk/gui_utils.c | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/gtk/gui_utils.c b/gtk/gui_utils.c index d24373bf59..311e60a5a8 100644 --- a/gtk/gui_utils.c +++ b/gtk/gui_utils.c @@ -1447,21 +1447,29 @@ str_ptr_sort_func(GtkTreeModel *model, */ /** - * ws_combo_box_new_text_and_pointer: + * ws_combo_box_new_text_and_pointer_full: * * Convenience function which constructs a new "text and pointer" combo box, which * is a #GtkComboBox just displaying strings and storing a pointer associated with * each combo_box entry; The pointer can be retrieved when an entry is selected. + * Also: optionally returns the cell renderer for the combo box. * If you use this function to create a text_and_pointer combo_box, * you should only manipulate its data source with the * following convenience functions: * ws_combo_box_append_text_and_pointer() * ws_combo_box_append_text_and_pointer_full() * + * @param cell_p pointer to return the 'GtkCellRenderer *' for the combo box (or NULL). * @return A pointer to a new text_and_pointer combo_box. */ + +/* Note: + * GtkComboBox style property: "appears-as-list": + * Default: 0: ie: displays as menus + * Wireshark Windows gtkrc: 1: ie: displays as lists (treeview) + */ GtkWidget * -ws_combo_box_new_text_and_pointer(void) { +ws_combo_box_new_text_and_pointer_full(GtkCellRenderer **cell_p) { GtkWidget *combo_box; GtkCellRenderer *cell; GtkTreeStore *store; @@ -1480,10 +1488,34 @@ ws_combo_box_new_text_and_pointer(void) { gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo_box), cell, "text", 0, "sensitive", 2, NULL); + if (cell_p != NULL) { + *cell_p = cell; + } return combo_box; } /** + * ws_combo_box_new_text_and_pointer: + * + * Convenience function which constructs a new "text and pointer" combo box, which + * is a #GtkComboBox just displaying strings and storing a pointer associated with + * each combo_box entry; The pointer can be retrieved when an entry is selected. + * If you use this function to create a text_and_pointer combo_box, + * you should only manipulate its data source with the + * following convenience functions: + * ws_combo_box_append_text_and_pointer() + * ws_combo_box_append_text_and_pointer_full() + * + * @return A pointer to a new text_and_pointer combo_box. + */ + +GtkWidget * +ws_combo_box_new_text_and_pointer(void) { + return ws_combo_box_new_text_and_pointer_full(NULL); +} + + +/** * ws_combo_box_clear_text_and_pointer: * @param combo_box A #GtkComboBox constructed using ws_combo_box_new_text_and_pointer() * |