#include #include #include "frame.h" HTMLBlockObj * blockobj_new(void) { HTMLBlockObj *p; if ((p = malloc(sizeof(*p))) == NULL) { perror("htmlblockobj_new"); exit(1); } p->bg_image = NULL; p->obj = NULL; return p; } void blockobj_delete(HTMLBlockObj *p) { if (p) { if (p->bg_image) image_delete(p->bg_image); htmlobjlist_delete(p->obj); free(p); } } void blockobj_draw(Display *dpy, Drawable draw, GC gc, int x, int y, HTMLObj *o, int x1, int y1, int w, int h) { HTMLBlockObj *bo = o->data; int x2 = x + o->x + bo->off_x; int y2 = y + o->y - o->ascent + bo->off_y; int w2 = bo->width; int h2 = bo->height; XSetForeground(dpy, gc, bo->border_pixel); /* draw me */ if (bo->border_top_width) XFillRectangle(dpy, draw, gc, x2, y2, w2, bo->border_top_width); if (bo->border_bottom_width) XFillRectangle(dpy, draw, gc, x2, y2 + h2 - bo->border_bottom_width, w2, bo->border_bottom_width); if (bo->border_left_width) XFillRectangle(dpy, draw, gc, x2, y2, bo->border_left_width, h2); if (bo->border_right_width) XFillRectangle(dpy, draw, gc, x2 + w2 - bo->border_right_width, y2, bo->border_right_width, h2); /* draw all children */ { HTMLObj *p = bo->obj->next; while (p != bo->obj) { htmlobj_draw(dpy, draw, gc, x, y, p, x1, y1, w, h); p = p->next; } } }