gint panel_dialogs_choose_panel (PanelApplication *application) { GtkWidget *dialog; GtkWidget *vbox; GtkWidget *label; GtkWidget *combo; guint i; gint response = -1; gchar *name; panel_return_val_if_fail (PANEL_IS_APPLICATION (application), -1); /* setup the dialog */ dialog = gtk_dialog_new_with_buttons (_("Add New Item"), NULL, GTK_DIALOG_NO_SEPARATOR, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_ADD, GTK_RESPONSE_OK, NULL); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_ADD); gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER); /* create widgets */ vbox = gtk_vbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), vbox, FALSE, FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); gtk_widget_show (vbox); label = gtk_label_new (_("Please choose a panel for the new plugin:")); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); gtk_widget_show (label); combo = gtk_combo_box_new_text (); gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, FALSE, 0); gtk_widget_show (combo); /* insert the panels */ for (i = 0; i < panel_application_get_n_windows (application); i++) { name = g_strdup_printf (_("Panel %d"), i + 1); gtk_combo_box_append_text (GTK_COMBO_BOX (combo), name); g_free (name); } /* select first panel (changed will start marching ants) */ g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (panel_dialogs_choose_panel_combo_changed), application); gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0); /* run the dialog */ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) response = gtk_combo_box_get_active (GTK_COMBO_BOX (combo)); gtk_widget_destroy (dialog); /* unset panel selections */ panel_application_window_select (application, NULL); return response; }
void InitScreen(void) { GtkWidget *notebook; GtkWidget *playbacklabel; GtkWidget *capturelabel; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW(window), "Lightweight Alsa Mixer"); //gtk_container_set_border_width (GTK_CONTAINER (window), 1); gtk_signal_connect (GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(gtk_main_quit), NULL); windowbox = gtk_vbox_new(FALSE,1); InitMenu(); gtk_box_pack_start(GTK_BOX(windowbox), menu_bar, FALSE, TRUE, 0); lamixer_enum_cards(); lamixer_mixer_init(card_id); mixerbox = gtk_table_new(mRows, 1, FALSE); capturebox = gtk_table_new(mRows, 1, FALSE); InitMixer(card_id); playbackscrollwin = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (playbackscrollwin),GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER); gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW (playbackscrollwin), mixerbox); capturescrollwin = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (capturescrollwin),GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER); gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW (capturescrollwin), capturebox); playbacklabel = gtk_label_new("Playback"); capturelabel = gtk_label_new("Capture"); notebook = gtk_notebook_new (); gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), playbackscrollwin, playbacklabel); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), capturescrollwin, capturelabel); switchmixer = gtk_combo_box_new_text(); GList *card_name = g_list_first(SoundCards); while(card_name) { gtk_combo_box_append_text (GTK_COMBO_BOX (switchmixer), card_name->data); card_name = g_list_next(card_name); } gtk_combo_box_set_active(GTK_COMBO_BOX (switchmixer), 0); g_signal_connect(G_OBJECT(switchmixer), "changed", G_CALLBACK(lamixer_mixer_switch), NULL); gtk_notebook_set_action_widget (GTK_NOTEBOOK (notebook), switchmixer, GTK_PACK_END); gtk_widget_show(switchmixer); gtk_box_pack_start(GTK_BOX(windowbox), notebook, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER(window), windowbox); lamixer_window_resize(); gtk_widget_show_all (window); }
static void append_to_combo (gpointer item, gpointer data) { GtkWidget *combo = data; gchar *text = item; gtk_combo_box_append_text (GTK_COMBO_BOX (combo), text); }
void contact_draw(GtkWidget *w, LinphoneProxyConfig *cfg){ GtkWidget *table=lookup_widget(w,"table10"); GtkWidget *combo; combo=proxy_combo_box_new(cfg); gtk_widget_show(combo); gtk_table_attach(GTK_TABLE(table),combo,1,2,2,3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); GLADE_HOOKUP_OBJECT(w,combo,"proxy"); combo=gtk_combo_box_new_text(); gtk_combo_box_append_text(GTK_COMBO_BOX(combo),_("Wait")); gtk_combo_box_append_text(GTK_COMBO_BOX(combo),_("Deny")); gtk_combo_box_append_text(GTK_COMBO_BOX(combo),_("Accept")); gtk_widget_show(combo); gtk_table_attach(GTK_TABLE(table),combo,1,2,3,4, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); GLADE_HOOKUP_OBJECT(w,combo,"pol"); }
void combo_box_append_text (gpointer p, const gchar *s) { #if GTK_MAJOR_VERSION >= 3 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(p), s); #else gtk_combo_box_append_text(GTK_COMBO_BOX(p), s); #endif }
/** This auxiliary function adds a single currency name to the combo * box. It is called as an iterator function when running a list of * currencies. * * @internal * * @param commodity The currency to add to the selection widget. * * @param gce A pointer to the selection widget. */ static void add_item(gnc_commodity *commodity, GNCCurrencyEdit *gce) { const char *string; string = gnc_commodity_get_printname(commodity); gtk_combo_box_append_text(GTK_COMBO_BOX(gce), string); }
void detect_popup_cb( GtkWidget *widget, AnypaperWindow *window ) { if (!g_file_test (wallpapersetterfile, G_FILE_TEST_EXISTS)) anypaper_wallpapersetter_file(wallpapersetterfile); anypaper_wallpapersetter_detect (window->wallpapersetter, wallpapersetterfile); if (window->wallpapersetter->wallpapersetter) { GtkWidget *dialog, *label, *content_area, *box, *halign, *combo; GList *atual=NULL, *atual_com=NULL; dialog = gtk_dialog_new_with_buttons ("Detected wallpapersetters", GTK_WINDOW(window->priv->window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL); content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); box = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (content_area), box); label = gtk_label_new ("Are listed below the wallpapersetter found,\nplease select one:"); gtk_box_pack_start (GTK_BOX(box), label, FALSE, TRUE, 2); halign = gtk_alignment_new(0, 1, 0, 0); combo = gtk_combo_box_new_text (); gtk_container_add(GTK_CONTAINER(halign), combo); atual = g_list_first (window->wallpapersetter->wallpapersetter); atual_com = g_list_first (window->wallpapersetter->command); while (atual) { gtk_combo_box_append_text (GTK_COMBO_BOX (combo), atual->data); atual = g_list_next(atual); } gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0); gtk_box_pack_start (GTK_BOX(box), halign, FALSE, TRUE, 2); gtk_widget_show_all (dialog); if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) { gchar *command; atual = g_list_nth (window->wallpapersetter->wallpapersetter, gtk_combo_box_get_active (GTK_COMBO_BOX (combo))); atual_com = g_list_nth (window->wallpapersetter->command, gtk_combo_box_get_active (GTK_COMBO_BOX (combo))); command = g_strdup_printf("%s %s", (gchar *) atual->data, (gchar *) atual_com->data); gtk_entry_set_text (GTK_ENTRY (window->priv->com_entry), command); g_free(command); } gtk_widget_destroy (dialog); } else { GtkWidget *dialog; dialog = gtk_message_dialog_new (GTK_WINDOW(window->priv->window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE, "No wallpapersetter found. A list of known wallpapersetter can be found in %s. You can install a wallpapersetter from that list, manually add a command to it or use directly a command of your preference", wallpapersetterfile); gtk_window_set_title (GTK_WINDOW(dialog), "Warning"); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } }
/* Load the tag editor */ gboolean gimmix_tag_editor_populate (const gchar *song) { GtkTreeModel *genre_model; gchar *info; gint min; gint sec; gint n; const TagLib_AudioProperties *properties; if (!song) return FALSE; if (!g_file_test (song, G_FILE_TEST_EXISTS)) return FALSE; file = taglib_file_new (song); if (file == NULL) return FALSE; taglib_set_strings_unicode (FALSE); tag = taglib_file_tag (file); properties = taglib_file_audioproperties (file); gtk_spin_button_set_value (GTK_SPIN_BUTTON(tag_year_spin), taglib_tag_year(tag)); gtk_spin_button_set_value (GTK_SPIN_BUTTON(tag_track_spin), taglib_tag_track(tag)); gtk_label_set_text (GTK_LABEL(tag_file), song); gtk_entry_set_text (GTK_ENTRY(tag_title), g_strstrip(taglib_tag_title(tag))); gtk_entry_set_text (GTK_ENTRY(tag_artist), g_strstrip(taglib_tag_artist(tag))); gtk_entry_set_text (GTK_ENTRY(tag_album), g_strstrip(taglib_tag_album(tag))); gtk_entry_set_text (GTK_ENTRY(tag_comment), g_strstrip(taglib_tag_comment(tag))); gtk_combo_box_append_text (GTK_COMBO_BOX(tag_genre), taglib_tag_genre(tag)); genre_model = gtk_combo_box_get_model (GTK_COMBO_BOX(tag_genre)); n = gtk_tree_model_iter_n_children (genre_model, NULL); gtk_combo_box_set_active (GTK_COMBO_BOX(tag_genre), n-1); /* Audio Information */ sec = taglib_audioproperties_length(properties) % 60; min = (taglib_audioproperties_length(properties) - sec) / 60; info = g_strdup_printf ("%02i:%02i", min, sec); gtk_label_set_text (GTK_LABEL(tag_info_length), info); g_free (info); info = g_strdup_printf ("%i Kbps", taglib_audioproperties_bitrate(properties)); gtk_label_set_text (GTK_LABEL(tag_info_bitrate), info); g_free (info); info = g_strdup_printf ("%i", taglib_audioproperties_channels(properties)); gtk_label_set_text (GTK_LABEL(tag_info_channels), info); g_free (info); taglib_tag_free_strings (); return TRUE; }
void nsgtk_combo_box_text_append_text(GtkWidget *combo_box, const gchar *text) { #if GTK_CHECK_VERSION(2,24,0) gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), text); #else gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box), text); #endif }
void populate_new_joysticks(GtkComboBox *box) { char str[255]; JoystickInfo::EnumerateJoysticks(s_vjoysticks); gtk_combo_box_append_text(box, "Keyboard/mouse only"); vector<JoystickInfo*>::iterator it = s_vjoysticks.begin(); // Get everything in the vector vjoysticks. while (it != s_vjoysticks.end()) { sprintf(str, "Keyboard/mouse and %s - but: %d, axes: %d, hats: %d", (*it)->GetName().c_str(), (*it)->GetNumButtons(), (*it)->GetNumAxes(), (*it)->GetNumHats()); gtk_combo_box_append_text(box, str); it++; } }
//___________________________________________________________ uint8_t DIA_videoCodec( SelectCodecType *codec ) { #define CONFIGURE 99 uint8_t ret=0; SelectCodecType old=*codec; uint32_t nb; GtkWidget *widget[30]; const char *name[30]; GtkWidget *dialog; nb=encoderGetNbEncoder(); dialog=create_dialog1(); gtk_register_dialog(dialog); COMPRES_PARAMS *desc=videoCodecGetDescriptor (*codec); if(!desc) return 0; // now set the input one int memo=0; for(uint32_t i=0;i<nb;i++) { name[i]=encoderGetIndexedName(i); gtk_combo_box_append_text (GTK_COMBO_BOX (WID(combobox1)),name[i]); if(videoCodecGetDescriptorByIndex (i)==desc) memo=i; } gtk_combo_box_set_active(GTK_COMBO_BOX (WID(combobox1)),memo); gtk_dialog_add_action_widget (GTK_DIALOG (dialog), WID(buttonConf),CONFIGURE); int running=1; while(running) switch(gtk_dialog_run(GTK_DIALOG(dialog))) { case GTK_RESPONSE_OK: { ret=1; int s=gtk_combo_box_get_active(GTK_COMBO_BOX (WID(combobox1))); COMPRES_PARAMS *nw=videoCodecGetDescriptorByIndex (s); *codec=nw->codec; running=0; break; } case CONFIGURE: { int s=gtk_combo_box_get_active(GTK_COMBO_BOX (WID(combobox1))); COMPRES_PARAMS *nw=videoCodecGetDescriptorByIndex (s); if(nw->configure) nw->configure(nw); break; } default: running=0; break; } gtk_widget_destroy(dialog); gtk_unregister_dialog(dialog); return ret; }
void structGuiOptionMenu:: f_addOption (const wchar_t *text) { #if gtk gtk_combo_box_append_text (GTK_COMBO_BOX (d_widget), Melder_peekWcsToUtf8 (text)); #elif motif GuiMenuItem menuItem = Thing_new (GuiMenuItem); menuItem -> d_widget = XtVaCreateManagedWidget (Melder_peekWcsToUtf8 (text), xmToggleButtonWidgetClass, d_widget, NULL); XtAddCallback (menuItem -> d_widget, XmNvalueChangedCallback, cb_optionChanged, (XtPointer) this); Collection_addItem (d_options, menuItem); #endif }
static GtkWidget * servlist_create_charsetcombo (void) { GtkWidget *cb; int i; cb = gtk_combo_box_entry_new_text (); gtk_combo_box_append_text (GTK_COMBO_BOX (cb), "System default"); i = 0; while (pages[i]) { gtk_combo_box_append_text (GTK_COMBO_BOX (cb), (char *)pages[i]); i++; } g_signal_connect (G_OBJECT (GTK_BIN (cb)->child), "changed", G_CALLBACK (servlist_combo_cb), NULL); return cb; }
void update_port_names(GtkComboBox *combobox) { #if !_PCSIM gdk_threads_enter(); int32_t fd; char port_name[32] = ""; bool comm_trace = get_comm_trace(); set_comm_trace(false); // mask printing errors opening port gtk_list_store_clear(wm->com_port_list); int32_t i = 0; // look for com ports for (i = 0; i < 10; i++) { sprintf(port_name, "/dev/ttyS%d", i); fd = comm_init(port_name); comm_close(); if (0 < fd) gtk_combo_box_append_text(combobox, port_name); } // look for usb com ports for (i = 0; i < 10; i++) { sprintf(port_name, "/dev/ttyUSB%d", i); fd = comm_init(port_name); comm_close(); if (0 < fd) gtk_combo_box_append_text(combobox, port_name); } /// TODO this currently resets com port name. Eventually this should retain value gtk_combo_box_set_active(combobox, 0); com_port_name = gtk_combo_box_get_active_text(combobox); set_comm_trace(comm_trace); // restore comm trace gdk_threads_leave(); #else #endif }
static void create_sorting_section (GtkWidget *sorting_vbox, GUI *appGUI) { GtkWidget *table, *combobox, *label; gchar *str; table = gtk_table_new (1, 5, FALSE); gtk_box_pack_start (GTK_BOX (sorting_vbox), table, FALSE, FALSE, 0); gtk_table_set_row_spacings (GTK_TABLE (table), 4); gtk_table_set_col_spacings (GTK_TABLE (table), 8); label = utl_gui_create_label ("%s:", _("Order")); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL | GTK_EXPAND), (GtkAttachOptions) (0), 0, 0); label = utl_gui_create_label ("%s:", _("Mode")); gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1, (GtkAttachOptions) (GTK_FILL | GTK_EXPAND), (GtkAttachOptions) (0), 0, 0); combobox = gtk_combo_box_new_text (); gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Ascending")); gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Descending")); gtk_combo_box_set_active (GTK_COMBO_BOX(combobox), config.tasks_sorting_order); gtk_table_attach (GTK_TABLE (table), combobox, 1, 2, 0, 1, (GtkAttachOptions) (GTK_FILL | GTK_EXPAND), (GtkAttachOptions) (0), 0, 0); g_signal_connect (G_OBJECT (combobox), "changed", G_CALLBACK (tasks_sort_order_changed_cb), appGUI); appGUI->opt->tasks_sort_order_combobox = combobox; combobox = gtk_combo_box_new_text (); str = g_strdup_printf ("%s, %s, %s", _("Done"), _("Due date"), _("Priority")); gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), str); g_free (str); str = g_strdup_printf ("%s, %s, %s", _("Done"), _("Priority"), _("Due date")); gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), str); g_free (str); str = g_strdup_printf ("%s, %s, %s", _("Priority"), _("Due date"), _("Done")); gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), str); g_free (str); str = g_strdup_printf ("%s, %s, %s", _("Priority"), _("Done"), _("Due date")); gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), str); g_free (str); str = g_strdup_printf ("%s, %s, %s", _("Due date"), _("Priority"), _("Done")); gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), str); g_free (str); str = g_strdup_printf ("%s, %s, %s", _("Due date"), _("Done"), _("Priority")); gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), str); g_free (str); gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), config.tasks_sorting_mode); gtk_table_attach (GTK_TABLE (table), combobox, 3, 4, 0, 1, (GtkAttachOptions) (GTK_FILL | GTK_EXPAND), (GtkAttachOptions) (0), 0, 0); g_signal_connect (G_OBJECT (combobox), "changed", G_CALLBACK (tasks_sort_mode_changed_cb), appGUI); appGUI->opt->tasks_sort_mode_combobox = combobox; }
static void widget_fixups (GtkWidget *widget) { /* post-constructor for widgets that need additional settings to work correctly */ if (GTK_IS_COMBO_BOX_ENTRY (widget)) { GtkListStore *store = gtk_list_store_new (1, G_TYPE_STRING); g_object_set (widget, "model", store, "text-column", 0, NULL); g_object_unref (store); gtk_combo_box_append_text (GTK_COMBO_BOX (widget), "test text"); } else if (GTK_IS_COMBO_BOX (widget)) { GtkListStore *store = gtk_list_store_new (1, G_TYPE_STRING); g_object_set (widget, "model", store, NULL); g_object_unref (store); gtk_combo_box_append_text (GTK_COMBO_BOX (widget), "test text"); } }
/* Add a song name to combo box (+value) */ static int add_song ( char * name, int value ) { int r = g_list_length( songs ); gtk_combo_box_append_text( GTK_COMBO_BOX(combo), name ); songs = g_list_append( songs, (void*)value ); return r; }
static void disasmwin_new(running_machine *machine) { disasmwin_i *dis; int item, cursel; const device_config *curcpu = debug_cpu_get_visible_cpu(machine); const disasm_subview_item *subview; char title[256]; dis = malloc(sizeof(*dis)); memset(dis, 0, sizeof(*dis)); dis->next = disasmwin_list; disasmwin_list = dis; dis->win = create_disasmwin(machine); dis->machine = machine; dis->disasm_w = DVIEW(lookup_widget(dis->win, "disasmview")); dview_set_debug_view(dis->disasm_w, machine, DVT_DISASSEMBLY, &dis->disasm); dis->cpu_w = GTK_COMBO_BOX(lookup_widget(dis->win, "cpu")); edit_init(machine, &dis->ed, lookup_widget(dis->win, "edit"), "curpc", 1, disasmwin_process_string, dis); debug_view_begin_update(dis->disasm); disasm_view_set_expression(dis->disasm, "curpc"); // debug_view_set_property_UINT32(dis->disasm, DVP_DASM_TRACK_LIVE, 1); debug_view_end_update(dis->disasm); // populate the combobox cursel = item = 0; for (subview = disasm_view_get_subview_list(dis->disasm); subview != NULL; subview = subview->next) { gtk_combo_box_append_text(dis->cpu_w, subview->name); if (cursel == 0 && subview->space->cpu == curcpu) cursel = item; item++; } gtk_combo_box_set_active(dis->cpu_w, cursel); disasm_view_set_subview(dis->disasm, cursel); subview = disasm_view_get_current_subview(dis->disasm); sprintf(title, "Disassembly: %s", subview->name); gtk_window_set_title(GTK_WINDOW(dis->win), title); g_signal_connect(dis->cpu_w, "changed", G_CALLBACK(disasmwin_cpu_changed), dis); g_signal_connect(lookup_widget(dis->win, "raw_opcodes"), "activate", G_CALLBACK(disasmwin_raw_opcodes_activate), dis); g_signal_connect(lookup_widget(dis->win, "enc_opcodes"), "activate", G_CALLBACK(disasmwin_enc_opcodes_activate), dis); g_signal_connect(lookup_widget(dis->win, "comments"), "activate", G_CALLBACK(disasmwin_comments_activate), dis); // g_signal_connect(dis->edit_w, "activate", G_CALLBACK(disasmwin_process_string), dis); g_signal_connect(dis->win, "destroy", G_CALLBACK(disasmwin_destroy), dis); gtk_widget_show_all(dis->win); }
GtkWidget *create_pho_sel_area() { hbox_pho_sel = gtk_hbox_new (FALSE, 0); int i; for(i=0; i < bigphoN; i++) { bigpho[i].opt_menu = gtk_combo_box_new_text (); gtk_box_pack_start (GTK_BOX (hbox_pho_sel), bigpho[i].opt_menu, FALSE, FALSE, 0); int j; for(j=0; j < bigpho[i].phokeysN; j++) { char t[128]; char *phostr; if (is_gtab) { int tlen; u_int64_t key64; if (ph_key_sz == 4) { u_int32_t key32; cp_ph_key(bigpho[i].phokeys,j, &key32); key64 = key32; } else cp_ph_key(bigpho[i].phokeys,j, &key64); gtab_key2name(pinmd, key64, t, &tlen); // dbg("%d,%d] %s\n", i,j, t); phostr = t; } else { phokey_t k; cp_ph_key(bigpho[i].phokeys, j, &k); phostr = b_pinyin? phokey2pinyin(k):phokey_to_str(k); } gtk_combo_box_append_text (GTK_COMBO_BOX_TEXT (bigpho[i].opt_menu), phostr); } gtk_combo_box_set_active (GTK_COMBO_BOX(bigpho[i].opt_menu), 0); } GtkWidget *button_ok = gtk_button_new_with_label("OK to add"); gtk_box_pack_start (GTK_BOX (hbox_pho_sel), button_ok, FALSE, FALSE, 20); g_signal_connect (G_OBJECT (button_ok), "clicked", G_CALLBACK (cb_button_ok), NULL); GtkWidget *button_cancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL); gtk_box_pack_start (GTK_BOX (hbox_pho_sel), button_cancel, FALSE, FALSE, 20); g_signal_connect (G_OBJECT (button_cancel), "clicked", G_CALLBACK (cb_button_cancel), NULL); return hbox_pho_sel; }
/* функция для создания виджета GtkComboBox с заданными параметрами и * * необходимыми дополнительными виджетами. * * * * В функцию передаются следующие параметры: * * > GPtrArray *comboboxes - массив указателей на виджеты. В него * * записываются указатели всех создаваемых виджетов для ввода информации * * > gchar *name - указатель на строку с текстом для * * обозначения виджета ввода (метки). * * > gchar *wname - указатель на строку с названием виджета. * * Используется при составлении SQL запроса. * * * * функция возвращает указатель на виджет, содержащий все необходимые * * виджеты */ GtkWidget* createComboBox(GPtrArray *comboboxes, const gchar *name, const gchar *wname) { GtkWidget *_combobox; // Виджет выпадающего списка GtkWidget *_checkButtonWLabel; // GtkCheckButton с меткой GtkWidget *_leftAlign; // Контейнер с форматированием по левому краю GtkWidget *_vbox; // Вертикальный бокс const gchar *textForCombobox[2] = { "Есть", "Нет" }; // Список значений выпадающего списка _combobox = gtk_combo_box_new_text(); // Присваиваем имя виджета wname gtk_widget_set_name(GTK_WIDGET(_combobox), wname); gtk_combo_box_append_text(GTK_COMBO_BOX(_combobox), textForCombobox[0]); gtk_combo_box_append_text(GTK_COMBO_BOX(_combobox), textForCombobox[1]); // Добавляем в массив указателей. g_ptr_array_add(comboboxes, _combobox); // Создаем GtkCheckButton с меткой name _checkButtonWLabel = gtk_check_button_new_with_label(name); // Определяем форматирование по левому краю _leftAlign = gtk_alignment_new(0, 0.5, 0.1, 0); // Создаем вертикальный бокс _vbox = gtk_vbox_new(FALSE, 5); // Добавляем GtkCheckButton в контейнер с форматированием по левому краю gtk_container_add(GTK_CONTAINER(_leftAlign), GTK_WIDGET(_checkButtonWLabel)); // Последовательно добавляем виджеты в вертикальный бокс gtk_container_add(GTK_CONTAINER(_vbox), _leftAlign); gtk_container_add(GTK_CONTAINER(_vbox), _combobox); // Соединяем сигнал снятия галочки для GtkCheckButton с виджетом ввода. g_signal_connect(G_OBJECT(_checkButtonWLabel), "toggled", G_CALLBACK(toggle_action), (gpointer) _combobox); // Вызываем сигнал toggled для виджета _checkButtonWLabel, чтобы сработал // toggle_action. Необходимо для установки виджета _combobox в неактивное // состояние. g_signal_emit_by_name(_checkButtonWLabel, "toggled", (gpointer)_combobox); return _vbox; }
static void fill_combo_box (gpointer data, gpointer user_data) { const gchar *label = ((BabelFile*) data)->label; #if GTK_CHECK_VERSION (2,24,0) GtkComboBoxText *combo = GTK_COMBO_BOX_TEXT (user_data); gtk_combo_box_text_append_text (combo, label); #else GtkComboBox *combo = GTK_COMBO_BOX (user_data); gtk_combo_box_append_text (combo, label); #endif }
static void memorywin_new(running_machine *machine) { memorywin_i *mem; int item, cursel; const device_config *curcpu = debug_cpu_get_visible_cpu(machine); const memory_subview_item *subview; mem = malloc(sizeof(*mem)); memset(mem, 0, sizeof(*mem)); mem->next = memorywin_list; memorywin_list = mem; mem->win = create_memorywin(machine); mem->machine = machine; mem->memory_w = DVIEW(lookup_widget(mem->win, "memoryview")); dview_set_debug_view(mem->memory_w, machine, DVT_MEMORY, &mem->memory); mem->zone_w = GTK_COMBO_BOX(lookup_widget(mem->win, "zone")); edit_init(machine, &mem->ed, lookup_widget(mem->win, "edit"), "0", 1, memorywin_process_string, mem); debug_view_begin_update(mem->memory); memory_view_set_expression(mem->memory, "0"); debug_view_end_update(mem->memory); // populate the combobox if (!memorycombo) { cursel = item = 0; for (subview = memory_view_get_subview_list(mem->memory); subview != NULL; subview = subview->next) { gtk_combo_box_append_text(mem->zone_w, subview->name); if (cursel == 0 && subview->space != NULL && subview->space->cpu == curcpu) cursel = item; item++; } memory_view_set_subview(mem->memory, cursel); gtk_combo_box_set_active(mem->zone_w, cursel); } g_signal_connect(mem->zone_w, "changed", G_CALLBACK(memorywin_zone_changed), mem); g_signal_connect(lookup_widget(mem->win, "chunks_1"), "activate", G_CALLBACK(on_chunks_1_activate), mem); g_signal_connect(lookup_widget(mem->win, "chunks_2"), "activate", G_CALLBACK(on_chunks_2_activate), mem); g_signal_connect(lookup_widget(mem->win, "chunks_4"), "activate", G_CALLBACK(on_chunks_4_activate), mem); g_signal_connect(lookup_widget(mem->win, "reverse"), "activate", G_CALLBACK(on_reverse_activate), mem); g_signal_connect(lookup_widget(mem->win, "ibpl"), "activate", G_CALLBACK(on_ibpl_activate), mem); g_signal_connect(lookup_widget(mem->win, "dbpl"), "activate", G_CALLBACK(on_dbpl_activate), mem); g_signal_connect(mem->win, "destroy", G_CALLBACK(memorywin_destroy), mem); gtk_widget_show_all(mem->win); }
/** @brief Restore the settings for the autonumber text dialog * * @param autotext Pointer to the state struct. */ void autonumber_set_state(AUTONUMBER_TEXT *autotext) { GtkWidget *widget; GtkTreeModel *model; GList *el; /* Scope */ /* Search text history */ widget = lookup_widget(autotext->dialog, "scope_text"); /* Simple way to clear the ComboBox. Owen from #gtk+ says: * * Yeah, it's just slightly "shady" ... if you want to stick to fully * advertised API, you need to remember how many rows you added and * use gtk_combo_box_remove_text() */ model = gtk_combo_box_get_model(GTK_COMBO_BOX(widget)); gtk_list_store_clear(GTK_LIST_STORE(model)); for (el= autotext->scope_text; el != NULL; el=g_list_next(el)) { gtk_combo_box_append_text(GTK_COMBO_BOX(widget), el->data); } widget = gtk_bin_get_child(GTK_BIN(widget)); gtk_entry_set_text(GTK_ENTRY(widget), g_list_first(autotext->scope_text)->data); widget = lookup_widget(autotext->dialog, "scope_skip"); gtk_combo_box_set_active(GTK_COMBO_BOX(widget), autotext->scope_skip); widget = lookup_widget(autotext->dialog, "scope_number"); gtk_combo_box_set_active(GTK_COMBO_BOX(widget), autotext->scope_number); widget = lookup_widget(autotext->dialog, "scope_overwrite"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), autotext->scope_overwrite); /* Options */ widget = lookup_widget(autotext->dialog, "opt_startnum"); gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), autotext->startnum); widget = lookup_widget(autotext->dialog, "sort_order"); gtk_combo_box_set_active(GTK_COMBO_BOX(widget), autotext->order); widget = lookup_widget(autotext->dialog, "opt_removenum"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), autotext->removenum); widget = lookup_widget(autotext->dialog, "opt_slotting"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), autotext->slotting); }
void ConfigDialog::setupRendererParams () { // Remove all existing child widgets gtk_container_forall (GTK_CONTAINER (mParamTable), remove_all_callback, mParamTable); ConfigOptionMap options = mSelectedRenderSystem->getConfigOptions (); // Resize the table to hold as many options as we have gtk_table_resize (GTK_TABLE (mParamTable), options.size (), 2); uint row = 0; for (ConfigOptionMap::iterator i = options.begin (); i != options.end (); i++, row++) { if (i->second.possibleValues.empty()) { continue; } GtkWidget *ro_label = gtk_label_new (i->second.name.c_str ()); gtk_widget_show (ro_label); gtk_table_attach (GTK_TABLE (mParamTable), ro_label, 0, 1, row, row + 1, GtkAttachOptions (GTK_EXPAND | GTK_FILL), GtkAttachOptions (0), 5, 0); gtk_label_set_justify (GTK_LABEL (ro_label), GTK_JUSTIFY_RIGHT); gtk_misc_set_alignment (GTK_MISC (ro_label), 1, 0.5); GtkWidget *ro_cb = gtk_combo_box_new_text (); gtk_widget_show (ro_cb); gtk_table_attach (GTK_TABLE (mParamTable), ro_cb, 1, 2, row, row + 1, GtkAttachOptions (GTK_EXPAND | GTK_FILL), GtkAttachOptions (0), 5, 0); // Set up a link from the combobox to the label g_object_set_data (G_OBJECT (ro_cb), "renderer-option", ro_label); StringVector::iterator opt_it; uint idx = 0; for (opt_it = i->second.possibleValues.begin (); opt_it != i->second.possibleValues.end (); opt_it++, idx++) { gtk_combo_box_append_text (GTK_COMBO_BOX (ro_cb), (*opt_it).c_str ()); if (strcmp (i->second.currentValue.c_str (), (*opt_it).c_str ()) == 0) gtk_combo_box_set_active (GTK_COMBO_BOX (ro_cb), idx); } g_signal_connect (G_OBJECT (ro_cb), "changed", G_CALLBACK (optionChanged), this); } gtk_widget_grab_focus (GTK_WIDGET (mOKButton)); }
void on_create_selection_clicked (GtkButton *button, gpointer user_data) { GtkComboBox* list_selections=GTK_COMBO_BOX(lookup_widget(GTK_WIDGET(button),"list_selections")); GtkComboBox* selection_type=GTK_COMBO_BOX(lookup_widget(GTK_WIDGET(button),"selection_type")); int active_id = gtk_combo_box_get_active(selection_type); printf("activeId: %d\n", active_id); if(active_id == CT_SIMPLE_SELECTION) { currentSelectionSet = new DoubleSet<Point>; lSelections.push_back(currentSelectionSet); gtk_combo_box_append_text(list_selections, currentSelectionSet->name.c_str()); } else { currentGraphCut = new GraphCut<Point>(cube); lGraphCuts.push_back(currentGraphCut); gtk_combo_box_append_text(list_selections, currentGraphCut->graphcut_name.c_str()); } }
GtkWidget *CreateOutputCombobox ( void ) { static GtkWidget *Combobox = NULL; std::string DriveName; Combobox = gtk_combo_box_new_text (); for (int i = 0; i < DriveList->size(); i++){ if (DriveList->IsEntireDisk (i)){ gtk_combo_box_append_text (GTK_COMBO_BOX(Combobox), DriveList->GetDriveName(i).c_str()); }else{ DriveName = " "; DriveName += DriveList->GetDriveName(i); gtk_combo_box_append_text (GTK_COMBO_BOX(Combobox), DriveName.c_str()); } } gtk_combo_box_set_active(GTK_COMBO_BOX(Combobox),0); g_signal_connect (G_OBJECT (GTK_COMBO_BOX (Combobox)), "changed", G_CALLBACK (OutputComboChanged), NULL); return Combobox; }
static void display_fill_combobox (Display* self) { g_return_if_fail (self != NULL); gtk_combo_box_append_text (self->priv->cb, "raw"); gtk_combo_box_append_text (self->priv->cb, "jpeg"); gtk_combo_box_append_text (self->priv->cb, "png"); gtk_combo_box_append_text (self->priv->cb, "bmp"); gtk_combo_box_append_text (self->priv->cb, "gif"); gtk_combo_box_append_text (self->priv->cb, "tga"); gtk_combo_box_append_text (self->priv->cb, "tif"); }
int wxComboBox::DoAppend( const wxString &item ) { wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid combobox") ); #ifdef __WXGTK24__ if (!gtk_check_version(2,4,0)) { GtkComboBox* combobox = GTK_COMBO_BOX( m_widget ); gtk_combo_box_append_text( combobox, wxGTK_CONV( item ) ); } else #endif { DisableEvents(); GtkWidget *list = GTK_COMBO(m_widget)->list; GtkWidget *list_item = gtk_list_item_new_with_label( wxGTK_CONV( item ) ); gtk_container_add( GTK_CONTAINER(list), list_item ); if (GTK_WIDGET_REALIZED(m_widget)) { gtk_widget_realize( list_item ); gtk_widget_realize( GTK_BIN(list_item)->child ); } // Apply current widget style to the new list_item GtkRcStyle *style = CreateWidgetStyle(); if (style) { gtk_widget_modify_style( GTK_WIDGET( list_item ), style ); GtkBin *bin = GTK_BIN( list_item ); GtkWidget *label = GTK_WIDGET( bin->child ); gtk_widget_modify_style( label, style ); gtk_rc_style_unref( style ); } gtk_widget_show( list_item ); EnableEvents(); } const unsigned int count = GetCount(); if ( m_clientDataList.GetCount() < count ) m_clientDataList.Append( (wxObject*) NULL ); if ( m_clientObjectList.GetCount() < count ) m_clientObjectList.Append( (wxObject*) NULL ); InvalidateBestSize(); return count - 1; }
void on_window2_show (GtkWidget *widget, gpointer user_data) { gtk_entry_set_text ((GtkEntry *)entry3,(char *)ip_addr); gtk_entry_set_text ((GtkEntry *)entry4,(char *)host); gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentry1),(char *)mac_addr); gtk_combo_box_set_active(GTK_COMBO_BOX (comboboxentry1),0); }
void ol_lrc_engine_list_init (GtkWidget *list) { ol_assert (list != NULL); int i, nengine; char **download_engine = (char **)ol_lrc_fetch_get_engine_list (&nengine); for (i = 0; i < nengine; i++) { gtk_combo_box_append_text (GTK_COMBO_BOX (list), _(download_engine[i])); } }