GtkWidget* create_label_in_table(GtkWidget *table, int row, int col, const char *text) { GtkWidget *label = gtk_label_new_with_mnemonic(text); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); return add_widget_to_table(table, row, col, label); }
GtkWidget* create_radio_button_in_table(GtkWidget *table, GSList *group, int row, int col, const char *text) { GtkWidget *button = gtk_radio_button_new_with_mnemonic(group, text); return add_widget_to_table(table, row, col, button); }
GtkWidget* create_check_button_in_table(GtkWidget *table, int row, int col, const char *text) { GtkWidget *button = gtk_check_button_new_with_mnemonic(text); return add_widget_to_table(table, row, col, button); }
static void MergeDialogSetup(GtkWidget *wi, void *data, int makewidget) { GtkWidget *w, *frame, *table; struct MergeDialog *d; char title[64]; int i; d = (struct MergeDialog *) data; snprintf(title, sizeof(title), _("Merge %d"), d->Id); gtk_window_set_title(GTK_WINDOW(wi), title); if (makewidget) { #if GTK_CHECK_VERSION(3, 4, 0) table = gtk_grid_new(); #else table = gtk_table_new(1, 2, FALSE); #endif i = 0; w = create_file_entry(d->Obj); add_widget_to_table(table, w, _("_File:"), TRUE, i++); d->file = w; w = create_spin_entry_type(SPIN_BUTTON_TYPE_POSITION, TRUE, TRUE); add_widget_to_table(table, w, _("_Top Margin:"), FALSE, i++); d->topmargin = w; w = create_spin_entry_type(SPIN_BUTTON_TYPE_POSITION, TRUE, TRUE); add_widget_to_table(table, w, _("_Left Margin:"), FALSE, i++); d->leftmargin = w; w = create_spin_entry_type(SPIN_BUTTON_TYPE_PERCENT, TRUE, TRUE); add_widget_to_table(table, w, _("_Zoom:"), FALSE, i++); d->zoom = w; frame = gtk_frame_new(NULL); gtk_container_add(GTK_CONTAINER(frame), table); gtk_box_pack_start(GTK_BOX(d->vbox), frame, TRUE, TRUE, 4); add_copy_button_to_box(GTK_WIDGET(d->vbox), G_CALLBACK(MergeDialogCopy), d, "merge"); gtk_widget_show_all(GTK_WIDGET(d->vbox)); } MergeDialogSetupItem(d, TRUE, d->Id); }
GtkWidget* create_entry_in_table(GtkWidget *table, GtkWidget *label, int row, int col) { GtkWidget *entry = gtk_entry_new(); if (label) gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); return add_widget_to_table(table, row, col, entry); }
static void DriverDialogSetup(GtkWidget *wi, void *data, int makewidget) { GtkWidget *w, *table; struct DriverDialog *d; struct extprinter *pcur; int i, j; d = (struct DriverDialog *) data; if (makewidget) { #if GTK_CHECK_VERSION(3, 4, 0) table = gtk_grid_new(); #else table = gtk_table_new(1, 2, FALSE); #endif i = 0; w = combo_box_create(); d->driver = w; add_widget_to_table(table, w, _("_Driver:"), FALSE, i++); g_signal_connect(d->driver, "changed", G_CALLBACK(DriverDialogSelectCB), d); w = create_text_entry(FALSE, TRUE); d->option = w; add_widget_to_table(table, w, _("_Option:"), TRUE, i++); w = create_file_entry_with_cb(G_CALLBACK(DriverDialogBrowseCB), d); d->file = w; add_widget_to_table(table, w, _("_File:"), TRUE, i++); gtk_box_pack_start(GTK_BOX(d->vbox), table, FALSE, FALSE, 4); gtk_widget_show_all(GTK_WIDGET(d->vbox)); } combo_box_clear(d->driver); pcur = Menulocal.extprinterroot; while (pcur != NULL) { combo_box_append_text(d->driver, pcur->name); pcur = pcur->next; j++; } combo_box_set_active(d->driver, 0); }
GtkWidget* create_spin_button_in_table(GtkWidget *table, GtkWidget *label, int row, int col, int value, int min, int max) { GtkObject *adj = gtk_adjustment_new(value, min, max, 1, 1, 1); GtkWidget *button = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 1, 0); gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(button), TRUE); if (label) gtk_label_set_mnemonic_widget(GTK_LABEL(label), button); return add_widget_to_table(table, row, col, button); }