1 | /*--------------------------------*-C-*---------------------------------* |
1 | /*--------------------------------*-C-*---------------------------------* |
2 | * File: scrollbar-rxvt.c |
2 | * File: scrollbar-rxvt.c |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * $Id: scrollbar-rxvt.C,v 1.1 2003/11/24 17:28:08 pcg Exp $ |
4 | * $Id: scrollbar-rxvt.C,v 1.3 2003/11/25 11:52:42 pcg Exp $ |
5 | * |
5 | * |
6 | * Copyright (c) 1997,1998 mj olesen <olesen@me.QueensU.CA> |
6 | * Copyright (c) 1997,1998 mj olesen <olesen@me.QueensU.CA> |
7 | * Copyright (c) 1999-2001 Geoff Wing <gcw@pobox.com> |
7 | * Copyright (c) 1999-2001 Geoff Wing <gcw@pobox.com> |
8 | * |
8 | * |
9 | * This program is free software; you can redistribute it and/or modify |
9 | * This program is free software; you can redistribute it and/or modify |
… | |
… | |
39 | |
39 | |
40 | sz = R->scrollBar.width; |
40 | sz = R->scrollBar.width; |
41 | sz2 = sz / 2; |
41 | sz2 = sz / 2; |
42 | switch (state) { |
42 | switch (state) { |
43 | case +1: |
43 | case +1: |
44 | top = R->h->topShadowGC; |
44 | top = R->topShadowGC; |
45 | bot = R->h->botShadowGC; |
45 | bot = R->botShadowGC; |
46 | break; |
46 | break; |
47 | case -1: |
47 | case -1: |
48 | top = R->h->botShadowGC; |
48 | top = R->botShadowGC; |
49 | bot = R->h->topShadowGC; |
49 | bot = R->topShadowGC; |
50 | break; |
50 | break; |
51 | default: |
51 | default: |
52 | top = bot = R->h->scrollbarGC; |
52 | top = bot = R->scrollbarGC; |
53 | break; |
53 | break; |
54 | } |
54 | } |
55 | |
55 | |
56 | /* fill triangle */ |
56 | /* fill triangle */ |
57 | pt[0].x = x; |
57 | pt[0].x = x; |
… | |
… | |
62 | pt[2].y = y; |
62 | pt[2].y = y; |
63 | } else { |
63 | } else { |
64 | pt[0].y = pt[1].y = y; |
64 | pt[0].y = pt[1].y = y; |
65 | pt[2].y = y + sz - 1; |
65 | pt[2].y = y + sz - 1; |
66 | } |
66 | } |
67 | XFillPolygon(R->Xdisplay, R->scrollBar.win, R->h->scrollbarGC, |
67 | XFillPolygon(R->Xdisplay, R->scrollBar.win, R->scrollbarGC, |
68 | pt, 3, Convex, CoordModeOrigin); |
68 | pt, 3, Convex, CoordModeOrigin); |
69 | |
69 | |
70 | /* draw base */ |
70 | /* draw base */ |
71 | XDrawLine(R->Xdisplay, R->scrollBar.win, (dirn == UP ? bot : top), |
71 | XDrawLine(R->Xdisplay, R->scrollBar.win, (dirn == UP ? bot : top), |
72 | pt[0].x, pt[0].y, pt[1].x, pt[1].y); |
72 | pt[0].x, pt[0].y, pt[1].x, pt[1].y); |
… | |
… | |
152 | if (R->Options & Opt_scrollBar_right) |
152 | if (R->Options & Opt_scrollBar_right) |
153 | xofs = 0; |
153 | xofs = 0; |
154 | else |
154 | else |
155 | xofs = sbshadow ? sbwidth : sbwidth - 1; |
155 | xofs = sbshadow ? sbwidth : sbwidth - 1; |
156 | |
156 | |
157 | XDrawLine(R->Xdisplay, R->scrollBar.win, R->h->botShadowGC, |
157 | XDrawLine(R->Xdisplay, R->scrollBar.win, R->botShadowGC, |
158 | xofs, 0, xofs, R->scrollBar.end + sbwidth); |
158 | xofs, 0, xofs, R->scrollBar.end + sbwidth); |
159 | } |
159 | } |
160 | #endif |
160 | #endif |
161 | XFillRectangle(R->Xdisplay, R->scrollBar.win, R->h->scrollbarGC, |
161 | XFillRectangle(R->Xdisplay, R->scrollBar.win, R->scrollbarGC, |
162 | sbshadow, R->scrollBar.top, sbwidth, |
162 | sbshadow, R->scrollBar.top, sbwidth, |
163 | scrollbar_len); |
163 | scrollbar_len); |
164 | |
164 | |
165 | if (sbshadow) |
165 | if (sbshadow) |
166 | /* trough shadow */ |
166 | /* trough shadow */ |
167 | rxvt_Draw_Shadow(R->Xdisplay, R->scrollBar.win, |
167 | rxvt_Draw_Shadow(R->Xdisplay, R->scrollBar.win, |
168 | R->h->botShadowGC, R->h->topShadowGC, |
168 | R->botShadowGC, R->topShadowGC, |
169 | 0, 0, |
169 | 0, 0, |
170 | sbwidth + 2 * sbshadow, /* scrollbar_TotalWidth() */ |
170 | sbwidth + 2 * sbshadow, /* scrollbar_TotalWidth() */ |
171 | R->scrollBar.end + (sbwidth + 1) + sbshadow); |
171 | R->scrollBar.end + (sbwidth + 1) + sbshadow); |
172 | /* shadow for scrollbar slider */ |
172 | /* shadow for scrollbar slider */ |
173 | rxvt_Draw_Shadow(R->Xdisplay, R->scrollBar.win, |
173 | rxvt_Draw_Shadow(R->Xdisplay, R->scrollBar.win, |
174 | R->h->topShadowGC, R->h->botShadowGC, |
174 | R->topShadowGC, R->botShadowGC, |
175 | sbshadow, R->scrollBar.top, sbwidth, |
175 | sbshadow, R->scrollBar.top, sbwidth, |
176 | scrollbar_len); |
176 | scrollbar_len); |
177 | |
177 | |
178 | /* |
178 | /* |
179 | * Redraw scrollbar arrows |
179 | * Redraw scrollbar arrows |