Exemplo n.º 1
0
static void
draw (HTMLObject *o,
      HTMLPainter *p,
      gint x,
      gint y,
      gint width,
      gint height,
      gint tx,
      gint ty)
{
	HTMLFrame   *frame  = HTML_FRAME (o);
	HTMLEngine   *e       = GTK_HTML (frame->html)->engine;
	GdkRectangle paint;

	if (G_OBJECT_TYPE (e->painter) == HTML_TYPE_PRINTER) {
		gint pixel_size = html_painter_get_pixel_size (e->painter);

		if (!html_object_intersect (o, &paint, x, y, width, height))
			return;

		html_object_draw (e->clue, e->painter,
				  x, y,
				  width - pixel_size * (html_engine_get_left_border (e) + html_engine_get_right_border (e)),
				  height - pixel_size * (html_engine_get_top_border (e) + html_engine_get_bottom_border (e)),
				  tx + pixel_size * html_engine_get_left_border (e), ty + pixel_size * html_engine_get_top_border (e));
	} else
		(*HTML_OBJECT_CLASS (parent_class)->draw) (o, p, x, y, width, height, tx, ty);
}
Exemplo n.º 2
0
static void
draw (HTMLObject *o,
      HTMLPainter *p,
      gint x, gint y,
      gint width, gint height,
      gint tx, gint ty)
{
	HTMLObject *aclue;
	HTMLClueV *cluev;
	GdkRectangle paint;

	cluev = HTML_CLUEV (o);

	if (!html_object_intersect (o, &paint, x, y, width, height))
		return;

	if (cluev->background_color) {
		html_painter_alloc_color (p, &cluev->background_color->color);
		html_painter_draw_background (p,
					      &cluev->background_color->color,
					      NULL, tx + paint.x, ty + paint.y, paint.width, paint.height, 0, 0);
	}

	HTML_OBJECT_CLASS (&html_clue_class)->draw (o,
						    p,
						    x, y ,
						    width, height,
						    tx, ty);

	tx += o->x;
	ty += o->y - o->ascent;

	for ( aclue = HTML_CLUEV (o)->align_left_list;
	      aclue != NULL;
	      aclue = cluev_next_aligned (aclue) ) {
		html_object_draw (aclue,
				  p,
				  x - o->x - aclue->parent->x,
				  y - (o->y - o->ascent) - (aclue->parent->y - aclue->parent->ascent),
				  width - aclue->parent->x, height,
				  tx + aclue->parent->x,
				  ty + aclue->parent->y - aclue->parent->ascent);
	}

	for (aclue = HTML_CLUEV (o)->align_right_list;
	     aclue != NULL;
	     aclue = cluev_next_aligned (aclue)) {
		html_object_draw (aclue,
				  p,
				  x - o->x - aclue->parent->x,
				  y - (o->y - o->ascent) - (aclue->parent->y - aclue->parent->ascent),
				  width - aclue->parent->x, height,
				  tx + aclue->parent->x,
				  ty + aclue->parent->y - aclue->parent->ascent);
	}

	if (cluev->border_style != HTML_BORDER_NONE && cluev->border_width > 0) {
		GdkColor *color;

		if (cluev->border_color) {
			html_painter_alloc_color (p, &cluev->border_color->color);
			color = &cluev->border_color->color;
		} else {
			HTMLEngine *e = html_object_engine (o, GTK_HTML (p->widget)->engine);
			color = &html_colorset_get_color_allocated (e->settings->color_set,
								    p, HTMLTextColor)->color;
		}

		html_painter_draw_border (p, color,
					  tx, ty,
					  o->width,
					  o->ascent + o->descent,
					  cluev->border_style,
					  html_painter_get_pixel_size (p) * cluev->border_width);
	}
}