示例#1
0
void
balsa_print_object_draw(BalsaPrintObject * self, GtkPrintContext * context,
			cairo_t * cairo_ctx)
{
    guint level;

    BALSA_PRINT_OBJECT_CLASS(G_OBJECT_GET_CLASS(self))->draw(self, context, cairo_ctx);

    /* print borders if the depth is > 0 */
    if (self->depth == 0)
	return;

    /* print the requested number of border lines */
    cairo_save(cairo_ctx);
    cairo_set_line_width(cairo_ctx, 0.25);
    cairo_new_path(cairo_ctx);
    for (level = self->depth; level; level--) {
	gdouble level_sep = level * C_LABEL_SEP;

	cairo_move_to(cairo_ctx, self->c_at_x - level_sep, self->c_at_y);
	cairo_line_to(cairo_ctx, self->c_at_x - level_sep,
		      self->c_at_y + self->c_height);
	cairo_move_to(cairo_ctx, self->c_at_x + self->c_width + level_sep,
		      self->c_at_y);
	cairo_line_to(cairo_ctx, self->c_at_x + self->c_width + level_sep,
		      self->c_at_y + self->c_height);
    }
    cairo_stroke(cairo_ctx);
    cairo_restore(cairo_ctx);
}
示例#2
0
static void
balsa_print_object_image_class_init(BalsaPrintObjectImageClass * klass)
{
    parent_class = g_type_class_ref(BALSA_TYPE_PRINT_OBJECT);
    BALSA_PRINT_OBJECT_CLASS(klass)->draw =
	balsa_print_object_image_draw;
    G_OBJECT_CLASS(klass)->finalize = balsa_print_object_image_destroy;
}