… | |
… | |
44 | STATE_MOTION, |
44 | STATE_MOTION, |
45 | STATE_UP, |
45 | STATE_UP, |
46 | STATE_DOWN, |
46 | STATE_DOWN, |
47 | }; |
47 | }; |
48 | |
48 | |
49 | struct scrollBar_t { |
49 | struct scrollBar_t |
|
|
50 | { |
50 | rxvt_term *term; |
51 | rxvt_term *term; |
51 | char state; /* scrollbar state */ |
52 | char state; /* scrollbar state */ |
52 | char init; /* scrollbar has been initialised */ |
53 | char init; /* scrollbar has been initialised */ |
53 | unsigned int beg; /* slider sub-window begin height */ |
54 | unsigned int beg; /* slider sub-window begin height */ |
54 | unsigned int end; /* slider sub-window end height */ |
55 | unsigned int end; /* slider sub-window end height */ |
… | |
… | |
58 | unsigned int width; /* scrollbar width */ |
59 | unsigned int width; /* scrollbar width */ |
59 | int shadow; /* scrollbar shadow width */ |
60 | int shadow; /* scrollbar shadow width */ |
60 | int last_bot; /* scrollbar last bottom position */ |
61 | int last_bot; /* scrollbar last bottom position */ |
61 | int last_top; /* scrollbar last top position */ |
62 | int last_top; /* scrollbar last top position */ |
62 | int last_state; /* scrollbar last state */ |
63 | int last_state; /* scrollbar last state */ |
63 | int len; |
|
|
64 | unsigned char align; |
64 | unsigned char align; |
65 | Window win; |
65 | Window win; |
66 | Cursor leftptr_cursor; |
66 | Cursor leftptr_cursor; |
67 | int (rxvt_term::*update)(int, int, int, int); |
67 | int (scrollBar_t::*update)(int); |
68 | void setup (rxvt_term *); |
68 | void setup (rxvt_term *); |
|
|
69 | void resize (); |
|
|
70 | int map (int); |
|
|
71 | int show (int); |
|
|
72 | void destroy (); |
69 | |
73 | |
70 | bool upButton (int y) |
74 | bool upButton (int y) |
71 | { |
75 | { |
72 | if (style == R_SB_NEXT) |
76 | if (style == R_SB_NEXT) |
73 | return y > end && y <= end + width + 1; |
77 | return y > end && y <= end + width + 1; |
… | |
… | |
81 | return y > end + width + 1; |
85 | return y > end + width + 1; |
82 | if (style == R_SB_RXVT) |
86 | if (style == R_SB_RXVT) |
83 | return y > end; |
87 | return y > end; |
84 | return false; |
88 | return false; |
85 | } |
89 | } |
|
|
90 | unsigned min_height () |
|
|
91 | { |
|
|
92 | return style == R_SB_NEXT ? SB_THUMB_MIN_HEIGHT : 10; |
|
|
93 | } |
|
|
94 | unsigned size () |
|
|
95 | { |
|
|
96 | return end - beg - min_height (); |
|
|
97 | } |
86 | unsigned total_width () |
98 | unsigned total_width () |
87 | { |
99 | { |
88 | return width + shadow * 2; |
100 | return width + shadow * 2; |
89 | } |
101 | } |
|
|
102 | |
|
|
103 | #if defined(NEXT_SCROLLBAR) |
|
|
104 | GC blackGC, |
|
|
105 | whiteGC, |
|
|
106 | grayGC, |
|
|
107 | darkGC, |
|
|
108 | stippleGC; |
|
|
109 | Pixmap dimple, |
|
|
110 | upArrow, |
|
|
111 | downArrow, |
|
|
112 | upArrowHi, |
|
|
113 | downArrowHi; |
|
|
114 | #endif |
|
|
115 | |
|
|
116 | #if defined(RXVT_SCROLLBAR) |
|
|
117 | GC scrollbarGC, |
|
|
118 | topShadowGC, |
|
|
119 | botShadowGC; |
|
|
120 | #endif |
|
|
121 | |
|
|
122 | #if defined(XTERM_SCROLLBAR) |
|
|
123 | GC xscrollbarGC, |
|
|
124 | ShadowGC; |
|
|
125 | #endif |
|
|
126 | |
|
|
127 | #if defined(PLAIN_SCROLLBAR) |
|
|
128 | GC pscrollbarGC; |
|
|
129 | #endif |
|
|
130 | |
|
|
131 | private: |
|
|
132 | // update style dependent data |
|
|
133 | void update_data (); |
|
|
134 | |
|
|
135 | // scrollbar-next.C |
|
|
136 | int show_next (int); |
|
|
137 | // scrollbar-rxvt.C |
|
|
138 | int show_rxvt (int); |
|
|
139 | // scrollbar-xterm.C |
|
|
140 | int show_xterm (int); |
|
|
141 | // scrollbar-plain.C |
|
|
142 | int show_plain (int); |
|
|
143 | |
|
|
144 | void init_next (); |
90 | }; |
145 | }; |
91 | |
146 | |
92 | #define SCROLLNEXT_MINHEIGHT SB_THUMB_MIN_HEIGHT |
|
|
93 | #define SCROLLRXVT_MINHEIGHT 10 |
|
|
94 | |
|
|
95 | #define scrollbar_minheight() (scrollBar.style == R_SB_NEXT \ |
|
|
96 | ? SCROLLNEXT_MINHEIGHT \ |
|
|
97 | : SCROLLRXVT_MINHEIGHT) |
|
|
98 | #define scrollbar_above_slider(y) ((y) < scrollBar.top) |
147 | #define scrollbar_above_slider(y) ((y) < scrollBar.top) |
99 | #define scrollbar_below_slider(y) ((y) > scrollBar.bot) |
148 | #define scrollbar_below_slider(y) ((y) > scrollBar.bot) |
100 | #define scrollbar_position(y) ((y) - scrollBar.beg) |
149 | #define scrollbar_position(y) ((y) - scrollBar.beg) |
101 | #define scrollbar_size() (scrollBar.end - scrollBar.beg \ |
|
|
102 | - scrollbar_minheight ()) |
|
|
103 | |
150 | |
104 | /* |
151 | /* |
105 | * +-------------+ |
152 | * +-------------+ |
106 | * | | <---< SB_PADDING |
153 | * | | <---< SB_PADDING |
107 | * | ::::::::::: | |
154 | * | ::::::::::: | |