/* * Finalise hierarchical tree. */ static void gdisp_finaliseHierarchicalTree ( Kernel_T *kernel, GtkWidget *cTree ) { guint optimalWidth = 0; /* * Change tree global aspect. */ gtk_clist_set_row_height(GTK_CLIST(cTree), /* CLIST, and not CTREE !! */ 15); gtk_ctree_set_indent(GTK_CTREE(cTree), 16); /* * Compute first column optimal length. */ optimalWidth = gtk_clist_optimal_column_width(GTK_CLIST(cTree), 0 /* first column */); gtk_clist_set_column_width(GTK_CLIST(cTree), 0, /* first column */ optimalWidth); }
GtkWidget *create_cwidget (GtkWidget *scrollwin, struct clist_def *cldef) { GtkWidget *alignment; GtkWidget *label; GtkWidget *clist; char buf[256]; int i; switch (cldef->type) { case CWIDGET_CLIST: clist = gtk_clist_new (cldef->columns); break; case CWIDGET_CTREE: clist = gtk_ctree_new (cldef->columns, 0); gtk_ctree_set_line_style (GTK_CTREE (clist), GTK_CTREE_LINES_NONE); gtk_ctree_set_expander_style (GTK_CTREE (clist), GTK_CTREE_EXPANDER_TRIANGLE); gtk_ctree_set_indent (GTK_CTREE (clist), 10); break; default: return NULL; } gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); GTK_CLIST_SET_FLAG (GTK_CLIST (clist), CLIST_SHOW_TITLES); gtk_container_add (GTK_CONTAINER (scrollwin), clist); gtk_clist_set_selection_mode (GTK_CLIST (clist), cldef->mode); for (i = 0; i < cldef->columns; i++) { g_snprintf (buf, 256, "/" CONFIG_FILE "/%s Geometry/%s=%d", cldef->name, cldef->cols[i].name, cldef->cols[i].width); gtk_clist_set_column_width (GTK_CLIST (clist), i, config_get_int (buf)); if (cldef->cols[i].justify != GTK_JUSTIFY_LEFT) { gtk_clist_set_column_justification (GTK_CLIST (clist), i, cldef->cols[i].justify); } alignment = gtk_alignment_new (0.0, 0.5, 0.0, 0.0); label = gtk_label_new (_(cldef->cols[i].name)); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_container_add (GTK_CONTAINER (alignment), label); gtk_widget_show (label); cldef->cols[i].widget = label; gtk_clist_set_column_widget (GTK_CLIST (clist), i, alignment); gtk_widget_show (alignment); } gtk_clist_set_sort_column (GTK_CLIST (clist), cldef->sort_column); gtk_clist_set_sort_type (GTK_CLIST (clist), cldef->sort_type); clist_column_set_title (GTK_CLIST (clist), cldef, TRUE); return clist; }
/* indent : The number of pixels to shift the levels of the tree. */ int clip_GTK_CTREESETINDENT (ClipMachine *cm) { C_widget *cctree = _fetch_cw_arg(cm); gint indent = _clip_parni(cm,2); CHECKCWID(cctree,GTK_IS_CTREE); CHECKOPT(2,NUMERIC_t); gtk_ctree_set_indent (GTK_CTREE(cctree->widget), indent); return 0; err: return 1; }
GtkWidget *create_source_ctree (GtkWidget *scrollwin) { char *titles[1] = { _("Source") }; GtkWidget *ctree; /* gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); */ ctree = gtk_ctree_new_with_titles (1, 0, titles); gtk_container_add (GTK_CONTAINER (scrollwin), ctree); gtk_clist_set_selection_mode (GTK_CLIST (ctree), GTK_SELECTION_EXTENDED); gtk_ctree_set_line_style (GTK_CTREE (ctree), GTK_CTREE_LINES_NONE); gtk_ctree_set_expander_style (GTK_CTREE (ctree), GTK_CTREE_EXPANDER_TRIANGLE); gtk_ctree_set_indent (GTK_CTREE (ctree), 10); fill_source_ctree (ctree); return ctree; }