draw window frame
[windtk] / src / windtk.c
index d6b4d64..c34dc42 100644 (file)
@@ -11,9 +11,9 @@ struct wt_context *wt_curctx_ = &defctx;
 
 static unsigned int def_colors[] = {
        0xf0f0f0,       /* font/foreground */
-       0x333333,       /* background */
-       0x444444,       /* highlight */
-       0x222222,       /* shadow */
+       0x444444,       /* background */
+       0x555555,       /* highlight */
+       0x333333,       /* shadow */
        0x403065,       /* inactive frame */
        0x54349c,       /* inactive frame highlight */
        0x221e2c,       /* inactive frame shadow */
@@ -87,7 +87,7 @@ void wt_use_theme(struct wt_theme *theme)
 
 void wt_viewport(int x, int y, int w, int h)
 {
-       wt_setrect(&wt->vp, x, y, w, h);
+       wt_rect(&wt->vp, x, y, w, h);
        wt_move(wt->root, x, y);
        wt_resize(wt->root, w, h);
 }
@@ -147,16 +147,25 @@ void wt_gfx_fillrect(struct wt_rect *r)
        wt->gfx.fillrect(r);
 }
 
+void wt_gfx_fillrect4i(int x, int y, int w, int h)
+{
+       struct wt_rect r;
+       wt_rect(&r, x, y, w, h);
+       wt->gfx.fillrect(&r);
+}
+
 void wt_gfx_frame(struct wt_rect *r, int style, int basecol)
 {
-       wt_gfx_color(basecol);
-       wt_gfx_fillrect(r);
-       wt_gfx_color(style == FRM_OUT ? basecol + 2 : basecol + 1);
-       wt_gfx_line(r->x, r->y + r->height, r->x + r->width - 1, r->y + r->height);
-       wt_gfx_line(r->x + r->width, r->y + 1, r->x + r->width, r->y + r->height);
-       wt_gfx_color(style == FRM_OUT ? basecol + 1 : basecol + 2);
-       wt_gfx_line(r->x, r->y, r->x + r->width, r->y);
-       wt_gfx_line(r->x, r->y + 1, r->x, r->y + r->height - 1);
+       if((style & FRM_NOFILL) == 0) {
+               wt_gfx_color(basecol);
+               wt_gfx_fillrect(r);
+       }
+       wt_gfx_color(FRMSTYLE(style) == FRM_OUT ? basecol + 2 : basecol + 1);
+       wt_gfx_fillrect4i(r->x + 1, r->y + r->height - 1, r->width - 2, 1);
+       wt_gfx_fillrect4i(r->x + r->width - 1, r->y, 1, r->height);
+       wt_gfx_color(FRMSTYLE(style) == FRM_OUT ? basecol + 1 : basecol + 2);
+       wt_gfx_fillrect4i(r->x + 1, r->y, r->width - 2, 1);
+       wt_gfx_fillrect4i(r->x, r->y, 1, r->height);
 }
 
 void wt_gfx_line(int x0, int y0, int x1, int y1)
@@ -164,7 +173,7 @@ void wt_gfx_line(int x0, int y0, int x1, int y1)
        wt->gfx.line(x0, y0, x1, y1);
 }
 
-void wt_setrect(struct wt_rect *r, int x, int y, int w, int h)
+void wt_rect(struct wt_rect *r, int x, int y, int w, int h)
 {
        r->x = x;
        r->y = y;