17 #ifndef COMBOBOXTEXT_H_ 18 #define COMBOBOXTEXT_H_ 35 #if GTK_MAJOR_VERSION==2 && GTK_MINOR_VERSION<24 36 GtkListStore *model = gtk_list_store_new (1, G_TYPE_STRING);
37 widget = gtk_combo_box_new_with_model(GTK_TREE_MODEL (model));
38 GtkCellRenderer *cell_renderer = gtk_cell_renderer_text_new ();
39 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (
widget), cell_renderer, TRUE);
40 gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (
widget), cell_renderer,
"text", 0, NULL);
42 widget = gtk_combo_box_text_new();
67 return g_signal_connect( G_OBJECT(
widget ),
"changed" ,G_CALLBACK(callBack), data);
74 return g_signal_handler_disconnect( G_OBJECT(
widget ),
id);
81 value=gtk_combo_box_get_active(GTK_COMBO_BOX(
widget));
88 #if GTK_MAJOR_VERSION==2 && GTK_MINOR_VERSION<24 89 gchar *val=gtk_combo_box_get_active_text(GTK_COMBO_BOX(
widget));
91 gchar *val=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(
widget));
101 #if GTK_MAJOR_VERSION==2 && GTK_MINOR_VERSION<24 102 gchar *val=gtk_combo_box_get_active_text(GTK_COMBO_BOX(
widget));
104 gchar *val=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(
widget));
115 #if GTK_MAJOR_VERSION==2 && GTK_MINOR_VERSION<24 116 gchar *val=gtk_combo_box_get_active_text(GTK_COMBO_BOX(wid));
118 gchar *val=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(wid));
128 gtk_combo_box_set_active(GTK_COMBO_BOX(
widget), which);
144 GtkTreeModel *model=gtk_combo_box_get_model(GTK_COMBO_BOX(
widget));
146 cerr<<
"ComboBoxText::setSelection : A value GtkTreeModel is not associated with this GtkComboBoxText"<<endl;
149 valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter);
154 gtk_tree_model_get(model, &iter, 0, &val, -1);
156 if (strcmp(text.c_str(),val)==0) {
160 valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter);
176 #if GTK_MAJOR_VERSION==2 && GTK_MINOR_VERSION<24 177 gtk_combo_box_append_text(GTK_COMBO_BOX(
widget), text);
179 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(
widget), text);
193 #if GTK_MAJOR_VERSION==2 && GTK_MINOR_VERSION<24 194 gtk_combo_box_append_text(GTK_COMBO_BOX(
widget), text.c_str());
196 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(
widget), text.c_str());
201 #endif //COMBOBOXTEXT_H_
static void getSelection(GtkWidget *wid, string &value)
int setSelection(const char *text)
void removeChangedCallback(gulong id)
ComboBoxText & operator<<(const char *text)
void getSelection(string &value)
void setSelection(int which)
ComboBoxText & operator<<(string text)
ComboBoxText(GCallback callBack, void *data)
int setSelection(string text)
gulong setChangedCallback(GCallback callBack, void *data)
void getSelection(int &value)
void getSelection(char *value)