Update of /cvsroot/htoolkit/port/src/cbits/GTK
In directory sc8-pr-cvs1:/tmp/cvs-serv5205/src/cbits/GTK
Modified Files:
PopUp.c
Log Message:
Use the new GtkComboBox widget instead of the deprecated GtkCombo
Index: PopUp.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/PopUp.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** PopUp.c 12 Oct 2003 22:20:23 -0000 1.9
--- PopUp.c 14 Dec 2003 11:11:26 -0000 1.10
***************
*** 3,24 ****
#include "Handlers_stub.h"
- static void handleLBoxClick(GtkList *list, gpointer user_data)
- {
- handleControlCommand((GtkWidget *) user_data);
- };
-
WindowHandle osCreatePopUp(WindowHandle window)
{
GtkWidget *popup;
! popup = gtk_combo_new();
! gtk_entry_set_editable (GTK_ENTRY(GTK_COMBO(popup)->entry), gtk_false());
! gtk_combo_set_use_arrows_always(GTK_COMBO(popup), gtk_true());
! gtk_signal_connect(GTK_OBJECT(GTK_COMBO(popup)->entry),
"changed",
! GTK_SIGNAL_FUNC(handleLBoxClick),
! popup);
port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), popup);
!
return popup;
};
--- 3,19 ----
#include "Handlers_stub.h"
WindowHandle osCreatePopUp(WindowHandle window)
{
GtkWidget *popup;
! popup = gtk_combo_box_new_text();
! //gtk_entry_set_editable (GTK_ENTRY(GTK_COMBO(popup)->entry), gtk_false());
! //gtk_combo_set_use_arrows_always(GTK_COMBO(popup), gtk_true());
! gtk_signal_connect(GTK_OBJECT(popup),
"changed",
! GTK_SIGNAL_FUNC(handleControlCommand),
! NULL);
port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), popup);
!
return popup;
};
***************
*** 26,55 ****
void osAppendPopUpItem(WindowHandle popup, char *title)
{
! GtkWidget *lbox = GTK_COMBO(popup)->list;
! GtkWidget *li = gtk_list_item_new_with_label(title);
! gtk_list_append_items(GTK_LIST(lbox), g_list_append(NULL,li));
! gtk_widget_show(li);
};
void osInsertPopUpItem(WindowHandle popup, int index, char *title)
{
! GtkWidget *lbox = GTK_COMBO(popup)->list;
! GtkWidget *li = gtk_list_item_new_with_label(title);
! gtk_list_insert_items(GTK_LIST(lbox), g_list_append(NULL,li), index);
! gtk_widget_show(li);
};
void osRemovePopUpItem(WindowHandle popup, int index)
{
! GtkWidget *lbox = GTK_COMBO(popup)->list;
! GList *tmp_list = g_list_append(NULL, g_list_nth(GTK_LIST(lbox)->children, index)->data);
! gtk_list_remove_items (GTK_LIST(lbox),tmp_list);
! g_list_free(tmp_list);
};
void osRemoveAllPopUpItems(WindowHandle popup)
{
! GtkWidget *lbox = GTK_COMBO(popup)->list;
! gtk_list_remove_items (GTK_LIST(lbox),GTK_LIST(lbox)->children);
};
--- 21,40 ----
void osAppendPopUpItem(WindowHandle popup, char *title)
{
! gtk_combo_box_append_text(GTK_COMBO_BOX(popup), title);
};
void osInsertPopUpItem(WindowHandle popup, int index, char *title)
{
! gtk_combo_box_insert_text(GTK_COMBO_BOX(popup), index, title);
};
void osRemovePopUpItem(WindowHandle popup, int index)
{
! gtk_combo_box_remove_text(GTK_COMBO_BOX(popup), index);
};
void osRemoveAllPopUpItems(WindowHandle popup)
{
! gtk_list_store_clear(GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(popup))));
};
***************
*** 66,82 ****
int osGetPopUpSelection(WindowHandle popup)
{
! GtkWidget *lbox = GTK_COMBO(popup)->list;
! if (!GTK_LIST(lbox)->selection)
! return -1;
!
! return gtk_list_child_position(GTK_LIST(lbox), (GtkWidget *) GTK_LIST(lbox)->selection->data);
};
void osSetPopUpSelection(WindowHandle popup, int index)
{
! GtkWidget *lbox = GTK_COMBO(popup)->list;
! if (index > 0)
! gtk_list_select_item(GTK_LIST(lbox),index);
! else
! gtk_list_unselect_all(GTK_LIST(lbox));
};
--- 51,59 ----
int osGetPopUpSelection(WindowHandle popup)
{
! return gtk_combo_box_get_active(GTK_COMBO_BOX(popup));
};
void osSetPopUpSelection(WindowHandle popup, int index)
{
! gtk_combo_box_set_active(GTK_COMBO_BOX(popup), index);
};
|