… | |
… | |
25 | #include "rxvt.h" /* NECESSARY */ |
25 | #include "rxvt.h" /* NECESSARY */ |
26 | |
26 | |
27 | /*----------------------------------------------------------------------*/ |
27 | /*----------------------------------------------------------------------*/ |
28 | #if defined(RXVT_SCROLLBAR) |
28 | #if defined(RXVT_SCROLLBAR) |
29 | |
29 | |
|
|
30 | #define DOUBLED 1 |
|
|
31 | |
30 | /* draw triangular button with a shadow of SHADOW (1 or 2) pixels */ |
32 | /* draw triangular button with a shadow of 2 pixels */ |
31 | void |
33 | void |
32 | rxvt_term::Draw_button (int x, int y, int state, int dirn) |
34 | rxvt_term::Draw_button (int x, int y, int state, int dirn) |
33 | { |
35 | { |
34 | unsigned int sz, sz2; |
36 | unsigned int sz, sz2; |
35 | XPoint pt[3]; |
37 | XPoint pt[3]; |
… | |
… | |
78 | pt[1].x = x + sz2 - 1; |
80 | pt[1].x = x + sz2 - 1; |
79 | pt[1].y = y + (dirn == UP ? 0 : sz - 1); |
81 | pt[1].y = y + (dirn == UP ? 0 : sz - 1); |
80 | XDrawLine (display->display, scrollBar.win, top, |
82 | XDrawLine (display->display, scrollBar.win, top, |
81 | pt[0].x, pt[0].y, pt[1].x, pt[1].y); |
83 | pt[0].x, pt[0].y, pt[1].x, pt[1].y); |
82 | |
84 | |
83 | #if (SHADOW > 1) |
85 | #if DOUBLED |
84 | /* doubled */ |
86 | /* doubled */ |
85 | pt[0].x++; |
87 | pt[0].x++; |
|
|
88 | |
86 | if (dirn == UP) |
89 | if (dirn == UP) |
87 | { |
90 | { |
88 | pt[0].y--; |
91 | pt[0].y--; |
89 | pt[1].y++; |
92 | pt[1].y++; |
90 | } |
93 | } |
91 | else |
94 | else |
92 | { |
95 | { |
93 | pt[0].y++; |
96 | pt[0].y++; |
94 | pt[1].y--; |
97 | pt[1].y--; |
95 | } |
98 | } |
|
|
99 | |
96 | XDrawLine (display->display, scrollBar.win, top, |
100 | XDrawLine (display->display, scrollBar.win, top, |
97 | pt[0].x, pt[0].y, pt[1].x, pt[1].y); |
101 | pt[0].x, pt[0].y, pt[1].x, pt[1].y); |
98 | #endif |
102 | #endif |
|
|
103 | |
99 | /* draw shadow on right */ |
104 | /* draw shadow on right */ |
100 | pt[1].x = x + sz - 1; |
105 | pt[1].x = x + sz - 1; |
101 | /* pt[2].x = x + sz2; */ |
106 | /* pt[2].x = x + sz2; */ |
102 | pt[1].y = y + (dirn == UP ? sz - 1 : 0); |
107 | pt[1].y = y + (dirn == UP ? sz - 1 : 0); |
103 | pt[2].y = y + (dirn == UP ? 0 : sz - 1); |
108 | pt[2].y = y + (dirn == UP ? 0 : sz - 1); |
104 | XDrawLine (display->display, scrollBar.win, bot, |
109 | XDrawLine (display->display, scrollBar.win, bot, |
105 | pt[2].x, pt[2].y, pt[1].x, pt[1].y); |
110 | pt[2].x, pt[2].y, pt[1].x, pt[1].y); |
106 | #if (SHADOW > 1) |
111 | |
|
|
112 | #if DOUBLED |
107 | /* doubled */ |
113 | /* doubled */ |
108 | pt[1].x--; |
114 | pt[1].x--; |
109 | if (dirn == UP) |
115 | if (dirn == UP) |
110 | { |
116 | { |
111 | pt[2].y++; |
117 | pt[2].y++; |
… | |
… | |
129 | int sbwidth = (int)scrollBar.width; |
135 | int sbwidth = (int)scrollBar.width; |
130 | |
136 | |
131 | if ((scrollBar.init & R_SB_RXVT) == 0) |
137 | if ((scrollBar.init & R_SB_RXVT) == 0) |
132 | { |
138 | { |
133 | scrollBar.init |= R_SB_RXVT; |
139 | scrollBar.init |= R_SB_RXVT; |
|
|
140 | |
134 | if (sbshadow) |
141 | if (sbshadow) |
135 | { |
142 | { |
136 | XSetWindowBackground (display->display, scrollBar.win, pix_colors_focused[Color_trough]); |
143 | XSetWindowBackground (display->display, scrollBar.win, pix_colors_focused[Color_trough]); |
137 | XClearWindow (display->display, scrollBar.win); |
144 | XClearWindow (display->display, scrollBar.win); |
138 | } |
145 | } |
… | |
… | |
160 | /* scrollbar slider */ |
167 | /* scrollbar slider */ |
161 | #ifdef SB_BORDER |
168 | #ifdef SB_BORDER |
162 | { |
169 | { |
163 | int xofs; |
170 | int xofs; |
164 | |
171 | |
165 | if (options & Opt_scrollBar_right) |
172 | if (OPTION (Opt_scrollBar_right)) |
166 | xofs = 0; |
173 | xofs = 0; |
167 | else |
174 | else |
168 | xofs = sbshadow ? sbwidth : sbwidth - 1; |
175 | xofs = sbshadow ? sbwidth : sbwidth - 1; |
169 | |
176 | |
170 | XDrawLine (display->display, scrollBar.win, botShadowGC, |
177 | XDrawLine (display->display, scrollBar.win, botShadowGC, |
… | |
… | |
196 | |
203 | |
197 | return 1; |
204 | return 1; |
198 | } |
205 | } |
199 | #endif /* RXVT_SCROLLBAR */ |
206 | #endif /* RXVT_SCROLLBAR */ |
200 | /*----------------------- end-of-file (C source) -----------------------*/ |
207 | /*----------------------- end-of-file (C source) -----------------------*/ |
|
|
208 | |