… | |
… | |
8 | #define R_SB_NEXT 1 |
8 | #define R_SB_NEXT 1 |
9 | #define R_SB_XTERM 2 |
9 | #define R_SB_XTERM 2 |
10 | #define R_SB_PLAIN 4 |
10 | #define R_SB_PLAIN 4 |
11 | #define R_SB_RXVT 8 |
11 | #define R_SB_RXVT 8 |
12 | |
12 | |
|
|
13 | enum sb_state { |
|
|
14 | STATE_IDLE = 1, |
|
|
15 | STATE_MOTION, |
|
|
16 | STATE_UP, |
|
|
17 | STATE_DOWN, |
|
|
18 | }; |
|
|
19 | |
13 | struct scrollBar_t { |
20 | struct scrollBar_t { |
|
|
21 | rxvt_term *term; |
14 | char state; /* scrollbar state */ |
22 | char state; /* scrollbar state */ |
15 | char init; /* scrollbar has been initialised */ |
23 | char init; /* scrollbar has been initialised */ |
16 | unsigned int beg; /* slider sub-window begin height */ |
24 | unsigned int beg; /* slider sub-window begin height */ |
17 | unsigned int end; /* slider sub-window end height */ |
25 | unsigned int end; /* slider sub-window end height */ |
18 | unsigned int top; /* slider top position */ |
26 | unsigned int top; /* slider top position */ |
… | |
… | |
26 | int len; |
34 | int len; |
27 | unsigned char align; |
35 | unsigned char align; |
28 | Window win; |
36 | Window win; |
29 | Cursor leftptr_cursor; |
37 | Cursor leftptr_cursor; |
30 | int (rxvt_term::*update)(int, int, int, int); |
38 | int (rxvt_term::*update)(int, int, int, int); |
31 | |
39 | void setup (rxvt_term *); |
32 | void setIdle() { state = 1 ; } |
|
|
33 | void setMotion() { state = 'm'; } |
|
|
34 | void setUp() { state = 'U'; } |
|
|
35 | void setDn() { state = 'D'; } |
|
|
36 | |
40 | |
37 | bool upButton (int y) |
41 | bool upButton (int y) |
38 | { |
42 | { |
39 | if (style == R_SB_NEXT) |
43 | if (style == R_SB_NEXT) |
40 | return y > end && y <= end + width + 1; |
44 | return y > end && y <= end + width + 1; |
… | |
… | |
48 | return y > end + width + 1; |
52 | return y > end + width + 1; |
49 | if (style == R_SB_RXVT) |
53 | if (style == R_SB_RXVT) |
50 | return y > end; |
54 | return y > end; |
51 | return false; |
55 | return false; |
52 | } |
56 | } |
|
|
57 | unsigned total_width () |
|
|
58 | { |
|
|
59 | return width + shadow * 2; |
|
|
60 | } |
53 | }; |
61 | }; |
54 | |
|
|
55 | #define scrollbar_TotalWidth() (scrollBar.width + scrollBar.shadow * 2) |
|
|
56 | #define scrollbar_isMotion() (scrollBar.state == 'm') |
|
|
57 | #define scrollbar_isUp() (scrollBar.state == 'U') |
|
|
58 | #define scrollbar_isDn() (scrollBar.state == 'D') |
|
|
59 | #define scrollbar_isUpDn() (scrollbar_isUp () || scrollbar_isDn ()) |
|
|
60 | |
62 | |
61 | #define SCROLLNEXT_MINHEIGHT SB_THUMB_MIN_HEIGHT |
63 | #define SCROLLNEXT_MINHEIGHT SB_THUMB_MIN_HEIGHT |
62 | #define SCROLLRXVT_MINHEIGHT 10 |
64 | #define SCROLLRXVT_MINHEIGHT 10 |
63 | |
65 | |
64 | #define scrollbar_minheight() (scrollBar.style == R_SB_NEXT \ |
66 | #define scrollbar_minheight() (scrollBar.style == R_SB_NEXT \ |