Exemplo n.º 1
0
static void
etcta_reflow (GnomeCanvasItem *item,
              gint flags)
{
	ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (item);

	gdouble old_height = etcta->height;

	if (etcta->text) {
		g_object_get (
			etcta->text,
			"height", &etcta->height,
			NULL);
		etcta->height += 6;
	}
	if (etcta->row) {
		g_object_get (
			etcta->row,
			"height", &etcta->height,
			NULL);
	}

	if (etcta->rect) {
		g_object_set (
			etcta->rect,
			"y2", etcta->height - 1,
			NULL);
	}

	if (old_height != etcta->height)
		e_canvas_item_request_parent_reflow (item);
}
static void
etfci_reflow (GnomeCanvasItem *item,
              gint flags)
{
	ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (item);
	gdouble old_height;
	gint i;
	gint count;
	gdouble height = 0;

	etfci_rebuild_combined (etfci);

	old_height = etfci->height;

	count = e_table_header_count (etfci->combined_header);
	for (i = 0; i < count; i++) {
		ETableCol *ecol;

		ecol = e_table_header_get_column (etfci->combined_header, i);
		if (ecol->spec->disabled)
			continue;
		height += e_table_header_compute_height (
			ecol, GTK_WIDGET (GNOME_CANVAS_ITEM (etfci)->canvas));
	}

	etfci->height = height;

	if (old_height != etfci->height)
		e_canvas_item_request_parent_reflow (item);

	gnome_canvas_item_request_update (item);
}
Exemplo n.º 3
0
static void
etgl_reflow (GnomeCanvasItem *item,
             gint flags)
{
	ETableGroupLeaf *leaf = E_TABLE_GROUP_LEAF (item);

	g_object_get (leaf->item, "height", &leaf->height, NULL);
	g_object_get (leaf->item, "width", &leaf->width, NULL);

	e_canvas_item_request_parent_reflow (item);
}
Exemplo n.º 4
0
static void
e_reflow_reflow( GnomeCanvasItem *item, int flags )
{
	EReflow *reflow = E_REFLOW(item);
	gdouble old_width;
	gdouble running_width;
	gdouble running_height;
	int next_column;
	int i;

	if (! (GTK_OBJECT_FLAGS (reflow) & GNOME_CANVAS_ITEM_REALIZED))
		return;

	if (reflow->need_reflow_columns) {
		reflow_columns (reflow);
	}

	old_width = reflow->width;

	running_width = E_REFLOW_BORDER_WIDTH;
	running_height = E_REFLOW_BORDER_WIDTH;

	next_column = 1;

	for (i = 0; i < reflow->count; i++) {
		int unsorted = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), i);
		if (next_column < reflow->column_count && i == reflow->columns[next_column]) {
			running_height = E_REFLOW_BORDER_WIDTH;
			running_width += reflow->column_width + E_REFLOW_FULL_GUTTER;
			next_column ++;
		}

		if (unsorted >= 0 && reflow->items[unsorted]) {
			e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(reflow->items[unsorted]),
						    (double) running_width,
						    (double) running_height);
			running_height += reflow->heights[unsorted] + E_REFLOW_BORDER_WIDTH;
		}
	}
	reflow->width = running_width + reflow->column_width + E_REFLOW_BORDER_WIDTH;
	if ( reflow->width < reflow->minimum_width )
		reflow->width = reflow->minimum_width;
	if (old_width != reflow->width)
		e_canvas_item_request_parent_reflow(item);
}
Exemplo n.º 5
0
static void
e_minicard_label_reflow (GnomeCanvasItem *item,
                         gint flags)
{
	EMinicardLabel *e_minicard_label = E_MINICARD_LABEL (item);

	gint old_height;
	gdouble text_height;
	gdouble left_width;

	old_height = e_minicard_label->height;

	g_object_get (e_minicard_label->fieldname,
		     "text_height", &text_height,
		     NULL);

	e_minicard_label->height = text_height;

	g_object_get (e_minicard_label->field,
		     "text_height", &text_height,
		     NULL);

	if (e_minicard_label->height < text_height)
		e_minicard_label->height = text_height;
	e_minicard_label->height += 3;

	gnome_canvas_item_set ( e_minicard_label->rect,
			       "x2", (double) e_minicard_label->width - 1,
			       "y2", (double) e_minicard_label->height - 1,
			       NULL );

	gnome_canvas_item_set ( e_minicard_label->fieldname,
			       "clip_height", (double) e_minicard_label->height - 3,
			       NULL );

	if (e_minicard_label->max_field_name_length != -1 && ((e_minicard_label->width / 2) - 4 > e_minicard_label->max_field_name_length))
		left_width = e_minicard_label->max_field_name_length;
	else
		left_width = e_minicard_label->width / 2 - 4;

	e_canvas_item_move_absolute (e_minicard_label->field, left_width + 6, 1);

	if (old_height != e_minicard_label->height)
		e_canvas_item_request_parent_reflow (item);
}
static void
etgc_reflow (GnomeCanvasItem *item, gint flags)
{
	ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(item);
	gboolean frozen;

        g_object_get (etgc,
		      "frozen", &frozen,
		      NULL);

	if (frozen)
		return;


	if (GTK_OBJECT_FLAGS(etgc)& GNOME_CANVAS_ITEM_REALIZED){
		gdouble running_height = 0;
		gdouble running_width = 0;
		gdouble old_height;
		gdouble old_width;

		old_height = etgc->height;
		old_width = etgc->width;
		if (etgc->children == NULL){
		} else {
			GList *list;
			gdouble extra_height = 0;
			gdouble item_height = 0;
			gdouble item_width = 0;

			if (etgc->font_desc) {
				PangoContext *context;
				PangoFontMetrics *metrics;

				context = gtk_widget_get_pango_context (GTK_WIDGET (item->canvas));
				metrics = pango_context_get_metrics (context, etgc->font_desc, NULL);
				extra_height +=
					PANGO_PIXELS (pango_font_metrics_get_ascent (metrics)) +
					PANGO_PIXELS (pango_font_metrics_get_descent (metrics)) +
					BUTTON_PADDING * 2;
				pango_font_metrics_unref (metrics);
			}

			extra_height = MAX(extra_height, BUTTON_HEIGHT + BUTTON_PADDING * 2);

			running_height = extra_height;

			for ( list = etgc->children; list; list = g_list_next (list)){
				ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *) list->data;
				ETableGroup *child = child_node->child;

				g_object_get (child,
					      "width", &item_width,
					      NULL);

				if (item_width > running_width)
					running_width = item_width;
			}
			for ( list = etgc->children; list; list = g_list_next (list)){
				ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *) list->data;
				ETableGroup *child = child_node->child;
				g_object_get (child,
					      "height", &item_height,
					      NULL);

				e_canvas_item_move_absolute (GNOME_CANVAS_ITEM(child_node->text),
							    GROUP_INDENT,
							    running_height - BUTTON_PADDING);

				e_canvas_item_move_absolute (GNOME_CANVAS_ITEM(child),
							    GROUP_INDENT,
							    running_height);

				gnome_canvas_item_set (GNOME_CANVAS_ITEM(child_node->rect),
						      "x1", (double) 0,
						      "x2", (double) running_width + GROUP_INDENT,
						      "y1", (double) running_height - extra_height,
						      "y2", (double) running_height + item_height,
						      NULL);

				running_height += item_height + extra_height;
			}
			running_height -= extra_height;
		}
		if (running_height != old_height || running_width != old_width) {
			etgc->height = running_height;
			etgc->width = running_width;
			e_canvas_item_request_parent_reflow (item);
		}
	}
}