1 | /*--------------------------------*-C-*---------------------------------* |
1 | /*----------------------------------------------------------------------* |
2 | * File: scrollbar-rxvt.C |
2 | * File: scrollbar-rxvt.C |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * |
4 | * |
5 | * Copyright (c) 1997,1998 mj olesen <olesen@me.QueensU.CA> |
5 | * Copyright (c) 1997,1998 mj olesen <olesen@me.QueensU.CA> |
6 | * Copyright (c) 1999-2001 Geoff Wing <gcw@pobox.com> |
6 | * Copyright (c) 1999-2001 Geoff Wing <gcw@pobox.com> |
… | |
… | |
147 | } |
147 | } |
148 | |
148 | |
149 | int |
149 | int |
150 | rxvt_term::scrollbar_show_rxvt (int update, int last_top, int last_bot, int scrollbar_len) |
150 | rxvt_term::scrollbar_show_rxvt (int update, int last_top, int last_bot, int scrollbar_len) |
151 | { |
151 | { |
152 | int sbshadow = sb_shadow; |
152 | int sbshadow = scrollBar.shadow; |
153 | int sbwidth = (int)scrollBar.width; |
153 | int sbwidth = (int)scrollBar.width; |
|
|
154 | int state; |
154 | |
155 | |
155 | if ((scrollBar.init & R_SB_RXVT) == 0) |
156 | if ((scrollBar.init & R_SB_RXVT) == 0) |
156 | { |
157 | { |
|
|
158 | XGCValues gcvalue; |
|
|
159 | |
157 | scrollBar.init |= R_SB_RXVT; |
160 | scrollBar.init |= R_SB_RXVT; |
158 | |
161 | |
|
|
162 | gcvalue.foreground = pix_colors[Color_topShadow]; |
|
|
163 | topShadowGC = XCreateGC (dpy, vt, GCForeground, &gcvalue); |
|
|
164 | gcvalue.foreground = pix_colors[Color_bottomShadow]; |
|
|
165 | botShadowGC = XCreateGC (dpy, vt, GCForeground, &gcvalue); |
|
|
166 | gcvalue.foreground = pix_colors[ (depth <= 2 ? Color_fg : Color_scroll)]; |
|
|
167 | scrollbarGC = XCreateGC (dpy, vt, GCForeground, &gcvalue); |
159 | if (sbshadow) |
168 | if (sbshadow) |
160 | { |
169 | { |
161 | XSetWindowBackground (dpy, scrollBar.win, pix_colors_focused[Color_trough]); |
170 | XSetWindowBackground (dpy, scrollBar.win, pix_colors_focused[Color_trough]); |
162 | XClearWindow (dpy, scrollBar.win); |
171 | XClearWindow (dpy, scrollBar.win); |
163 | } |
172 | } |
… | |
… | |
185 | /* scrollbar slider */ |
194 | /* scrollbar slider */ |
186 | #ifdef SB_BORDER |
195 | #ifdef SB_BORDER |
187 | { |
196 | { |
188 | int xofs; |
197 | int xofs; |
189 | |
198 | |
190 | if (OPTION (Opt_scrollBar_right)) |
199 | if (option (Opt_scrollBar_right)) |
191 | xofs = 0; |
200 | xofs = 0; |
192 | else |
201 | else |
193 | xofs = sbshadow ? sbwidth : sbwidth - 1; |
202 | xofs = sbshadow ? sbwidth : sbwidth - 1; |
194 | |
203 | |
195 | XDrawLine (dpy, scrollBar.win, botShadowGC, |
204 | XDrawLine (dpy, scrollBar.win, botShadowGC, |
… | |
… | |
207 | |
216 | |
208 | /* shadow for scrollbar slider */ |
217 | /* shadow for scrollbar slider */ |
209 | draw_shadow (this, sbshadow, scrollBar.top, sbwidth, scrollbar_len); |
218 | draw_shadow (this, sbshadow, scrollBar.top, sbwidth, scrollbar_len); |
210 | |
219 | |
211 | /* Redraw scrollbar arrows */ |
220 | /* Redraw scrollbar arrows */ |
|
|
221 | state = scrollBar.state == STATE_UP ? -1 : +1; |
212 | draw_button (this, sbshadow, sbshadow, (scrollbar_isUp () ? -1 : +1), UP); |
222 | draw_button (this, sbshadow, sbshadow, state, UP); |
|
|
223 | state = scrollBar.state == STATE_DOWN ? -1 : +1; |
213 | draw_button (this, sbshadow, scrollBar.end + 1, (scrollbar_isDn () ? -1 : +1), DN); |
224 | draw_button (this, sbshadow, scrollBar.end + 1, state, DN); |
214 | |
225 | |
215 | return 1; |
226 | return 1; |
216 | } |
227 | } |
217 | #endif /* RXVT_SCROLLBAR */ |
228 | #endif /* RXVT_SCROLLBAR */ |
218 | /*----------------------- end-of-file (C source) -----------------------*/ |
229 | /*----------------------- end-of-file (C source) -----------------------*/ |
219 | |
230 | |