static WIDGET * charprop_get_widget(CharProperty *prop, PropDialog *dialog) { GtkWidget *ret = gtk_entry_new(); prophandler_connect(&prop->common, G_OBJECT(ret), "changed"); return ret; }
static WIDGET * enumprop_get_widget(EnumProperty *prop, PropDialog *dialog) { GtkWidget *ret; if (prop->common.descr->extra_data) { PropEnumData *enumdata = prop->common.descr->extra_data; guint i; #if GTK_CHECK_VERSION(2,24,0) ret = gtk_combo_box_text_new (); #else ret = gtk_combo_box_new_text (); #endif for (i = 0; enumdata[i].name != NULL; i++) #if GTK_CHECK_VERSION(2,24,0) gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (ret), _(enumdata[i].name)); #else gtk_combo_box_append_text (GTK_COMBO_BOX (ret), _(enumdata[i].name)); #endif prophandler_connect(&prop->common, G_OBJECT (ret), "changed"); } else { ret = gtk_entry_new(); /* should use spin button/option menu */ } return ret; }
static GtkWidget * stringprop_get_widget(StringProperty *prop, PropDialog *dialog) { GtkWidget *ret = gtk_entry_new(); gtk_entry_set_activates_default(GTK_ENTRY(ret), TRUE); prophandler_connect(&prop->common, G_OBJECT(ret), "changed"); return ret; }
static GtkWidget * fileprop_get_widget(StringProperty *prop, PropDialog *dialog) { GtkWidget *ret = dia_file_selector_new(); if (prop->common.descr->extra_data) dia_file_selector_set_extensions (DIAFILESELECTOR(ret), prop->common.descr->extra_data); prophandler_connect(&prop->common, G_OBJECT(ret), "value-changed"); return ret; }
static WIDGET * boolprop_get_widget(BoolProperty *prop, PropDialog *dialog) { GtkWidget *ret = gtk_toggle_button_new_with_label(_("No")); g_signal_connect(G_OBJECT(ret), "toggled", G_CALLBACK (bool_toggled), NULL); prophandler_connect(&prop->common, G_OBJECT(ret), "toggled"); return ret; }
static WIDGET * fontsizeprop_get_widget(FontsizeProperty *prop, PropDialog *dialog) { GtkAdjustment *adj = GTK_ADJUSTMENT(gtk_adjustment_new(prop->fontsize_data, G_MINFLOAT, G_MAXFLOAT, 0.1, 1.0, 0)); GtkWidget *ret = dia_unit_spinner_new(adj, prefs_get_fontsize_unit()); prophandler_connect(&prop->common, G_OBJECT(ret), "value-changed"); return ret; }
static WIDGET * buttonprop_get_widget(ButtonProperty *prop, PropDialog *dialog) { GtkWidget *ret = NULL; if (!prop->common.descr) return NULL; ret = gtk_button_new_with_label(_(prop->common.descr->tooltip)); prophandler_connect(&prop->common, G_OBJECT(ret), "clicked"); return ret; }
static WIDGET * intprop_get_widget(IntProperty *prop, PropDialog *dialog) { GtkAdjustment *adj = GTK_ADJUSTMENT(gtk_adjustment_new(prop->int_data, G_MININT, G_MAXINT, 1.0, 10.0, 0)); GtkWidget *ret = gtk_spin_button_new(adj, 1.0, 0); gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(ret),TRUE); prophandler_connect(&prop->common, G_OBJECT(ret), "value_changed"); return ret; }
static WIDGET * lengthprop_get_widget(LengthProperty *prop, PropDialog *dialog) { GtkAdjustment *adj = GTK_ADJUSTMENT(gtk_adjustment_new(prop->length_data, G_MINFLOAT, G_MAXFLOAT, 0.1, 1.0, 0)); GtkWidget *ret = dia_unit_spinner_new(adj, prefs_get_length_unit()); /* gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(ret),TRUE);*/ prophandler_connect(&prop->common, G_OBJECT(ret), "value-changed"); return ret; }
static GtkWidget * multistringprop_get_widget(StringProperty *prop, PropDialog *dialog) { GtkWidget *ret = gtk_text_view_new(); GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(ret)); GtkWidget *frame = gtk_frame_new(NULL); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); gtk_container_add(GTK_CONTAINER(frame), ret); g_signal_connect(G_OBJECT(ret), "key-release-event", G_CALLBACK(multistringprop_handle_key), NULL); gtk_widget_show(ret); prophandler_connect(&prop->common, G_OBJECT(buffer), "changed"); return frame; }
static WIDGET * listprop_get_widget(ListProperty *prop, PropDialog *dialog) { GtkWidget *ret = gtk_list_new(); gtk_list_set_selection_mode(GTK_LIST(ret),GTK_SELECTION_BROWSE); gtk_list_unselect_all(GTK_LIST(ret)); g_signal_connect(G_OBJECT(ret), "select-child", G_CALLBACK (listprop_select_child_signal), prop); prophandler_connect(&prop->common, G_OBJECT(ret), "selection-changed"); return ret; }