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