diff options
author | phil9 <telephil9@gmail.com> | 2022-04-06 16:46:58 +0000 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2022-04-06 16:46:58 +0000 |
commit | 63f8dc808490ef038ce868eba62983290e38489d (patch) | |
tree | 06b050b7a993a3e89fca82b205652261c7117078 /sys/src/cmd/mothra/libpanel/draw.c | |
parent | aba0c7fceac419c426da85b3f5d4bfe82d410e00 (diff) |
mothra: make scrollbar style consistent with other applications
Scrollbar was drawn using a wide dark gutter over a white background
whereas other applications (window, sam, ...) use a thinner scrollbar with an
inverse colorscheme.
This makes the scrollbar more consistent with other 9front applications.
Diffstat (limited to 'sys/src/cmd/mothra/libpanel/draw.c')
-rw-r--r-- | sys/src/cmd/mothra/libpanel/draw.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/sys/src/cmd/mothra/libpanel/draw.c b/sys/src/cmd/mothra/libpanel/draw.c index f8e9d72ae..87f00d5bc 100644 --- a/sys/src/cmd/mothra/libpanel/draw.c +++ b/sys/src/cmd/mothra/libpanel/draw.c @@ -13,12 +13,13 @@ #define CKWID 1 /* width of frame around check mark */ #define CKINSET 1 /* space around check mark frame */ #define CKBORDER 2 /* space around X inside frame */ -static Image *pl_light, *pl_dark, *pl_tick, *pl_hilit; +static Image *pl_light, *pl_dark, *pl_scrl, *pl_tick, *pl_hilit; Image *pl_blue, *pl_white, *pl_black; int pl_drawinit(void){ pl_white=allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0xFFFFFFFF); pl_light=allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0xFFFFFFFF); pl_dark=allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0x777777FF); + pl_scrl=allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0x999999FF); pl_black=allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0x000000FF); pl_hilit=allocimage(display, Rect(0,0,1,1), CHAN1(CAlpha,8), 1, 0x80); pl_blue=allocimage(display, Rect(0,0,1,1), RGB24, 1, 0x0000FFFF); @@ -28,7 +29,7 @@ int pl_drawinit(void){ draw(pl_tick, Rect(0, 0, TICKW, TICKW), pl_black, nil, ZP); draw(pl_tick, Rect(0, font->height-TICKW, TICKW, font->height), pl_black, nil, ZP); } - if(pl_white==0 || pl_light==0 || pl_black==0 || pl_dark==0 || pl_blue==0 || pl_tick==0) sysfatal("allocimage: %r"); + if(pl_white==0 || pl_light==0 || pl_black==0 || pl_dark==0 || pl_scrl==0 || pl_blue==0 || pl_tick==0) sysfatal("allocimage: %r"); return 1; } Rectangle pl_boxoutline(Image *b, Rectangle r, int style, int fill){ @@ -206,6 +207,19 @@ void pl_sliderupd(Image *b, Rectangle r1, int dir, int lo, int hi){ draw(b, r2, pl_dark, 0, ZP); draw(b, r3, pl_light, 0, ZP); } +void pl_scrollupd(Image *b, Rectangle r, int lo, int hi) +{ + Rectangle sr; + if(lo<0) lo=0; + if(hi<=lo) hi=lo+1; + sr=r; + sr.min.y+=lo; + sr.max.x-=1; + sr.max.y=sr.min.y+hi; + if(sr.max.y>r.max.y) sr.max.y=r.max.y; + draw(b, r, pl_scrl, 0, ZP); + draw(b, sr, pl_light, 0, ZP); +} void pl_draw1(Panel *p, Image *b); void pl_drawall(Panel *p, Image *b){ if(p->flags&INVIS || p->flags&IGNORE) return; |