comparison gtk/dw.c @ 571:828e6a66c5c5

Add dw_listbox_list_append()
author mhessling@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 20 Jul 2004 07:36:11 +0000
parents a126f4ec9570
children e72f61a8f492
comparison
equal deleted inserted replaced
570:052e9e4a59bd 571:828e6a66c5c5
8644 gtk_object_set_data(GTK_OBJECT(handle), "_dw_appending", NULL); 8644 gtk_object_set_data(GTK_OBJECT(handle), "_dw_appending", NULL);
8645 DW_MUTEX_UNLOCK; 8645 DW_MUTEX_UNLOCK;
8646 } 8646 }
8647 8647
8648 /* 8648 /*
8649 * Appends the specified text items to the listbox's (or combobox) entry list.
8650 * Parameters:
8651 * handle: Handle to the listbox to be appended to.
8652 * text: Text strings to append into listbox.
8653 * count: Number of text strings to append
8654 */
8655 void dw_listbox_list_append(HWND handle, char **text, int count)
8656 {
8657 GtkWidget *handle2 = handle;
8658 int _locked_by_me = FALSE;
8659
8660 DW_MUTEX_LOCK;
8661 if(GTK_IS_SCROLLED_WINDOW(handle))
8662 {
8663 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle));
8664 if(tmp)
8665 handle2 = tmp;
8666 }
8667 gtk_object_set_data(GTK_OBJECT(handle), "_dw_appending", (gpointer)1);
8668 if(GTK_IS_LIST(handle2))
8669 {
8670 GtkWidget *list_item;
8671 GList *tmp;
8672 char *font = (char *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_font");
8673 GdkColor *fore = (GdkColor *)gtk_object_get_data(GTK_OBJECT(handle2), "_dw_foregdk");
8674 GdkColor *back = (GdkColor *)gtk_object_get_data(GTK_OBJECT(handle2), "_dw_backgdk");
8675
8676 list_item=gtk_list_item_new_with_label(*text);
8677
8678 if(font)
8679 _set_font(GTK_LIST_ITEM(list_item)->item.bin.child, font);
8680 if(fore && back)
8681 _set_color(GTK_LIST_ITEM(list_item)->item.bin.child,
8682 DW_RGB(fore->red, fore->green, fore->blue),
8683 DW_RGB(back->red, back->green, back->blue));
8684
8685 tmp = g_list_append(NULL, list_item);
8686 gtk_widget_show(list_item);
8687 gtk_list_append_items(GTK_LIST(handle2),tmp);
8688 }
8689 else if(GTK_IS_COMBO(handle2))
8690 {
8691 GList *tmp = (GList *)gtk_object_get_user_data(GTK_OBJECT(handle2));
8692 char *addtext;
8693 int i;
8694
8695 for (i=0;i<count;i++)
8696 {
8697 addtext = strdup(text[i]);
8698 tmp = g_list_append(tmp, addtext);
8699 }
8700 gtk_object_set_user_data(GTK_OBJECT(handle2), tmp);
8701 gtk_combo_set_popdown_strings(GTK_COMBO(handle2), tmp);
8702 }
8703 gtk_object_set_data(GTK_OBJECT(handle), "_dw_appending", NULL);
8704 DW_MUTEX_UNLOCK;
8705 }
8706
8707 /*
8649 * Clears the listbox's (or combobox) list of all entries. 8708 * Clears the listbox's (or combobox) list of all entries.
8650 * Parameters: 8709 * Parameters:
8651 * handle: Handle to the listbox to be cleared. 8710 * handle: Handle to the listbox to be cleared.
8652 */ 8711 */
8653 void dw_listbox_clear(HWND handle) 8712 void dw_listbox_clear(HWND handle)