ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/scrollbar.h
(Generate patch)

Comparing rxvt-unicode/src/scrollbar.h (file contents):
Revision 1.5 by ayin, Sat Dec 29 14:52:55 2007 UTC vs.
Revision 1.15 by ayin, Sun Feb 17 11:37:21 2008 UTC

3 3
4#include <X11/Xlib.h> 4#include <X11/Xlib.h>
5 5
6struct rxvt_term; 6struct rxvt_term;
7 7
8typedef struct { 8#define R_SB_NEXT 1
9#define R_SB_XTERM 2
10#define R_SB_PLAIN 4
11#define R_SB_RXVT 8
12
13enum sb_state {
14 STATE_IDLE = 1,
15 STATE_MOTION,
16 STATE_UP,
17 STATE_DOWN,
18};
19
20struct scrollBar_t {
21 rxvt_term *term;
9 char state; /* scrollbar state */ 22 char state; /* scrollbar state */
10 char init; /* scrollbar has been initialised */ 23 char init; /* scrollbar has been initialised */
11 unsigned int beg; /* slider sub-window begin height */ 24 unsigned int beg; /* slider sub-window begin height */
12 unsigned int end; /* slider sub-window end height */ 25 unsigned int end; /* slider sub-window end height */
13 unsigned int top; /* slider top position */ 26 unsigned int top; /* slider top position */
14 unsigned int bot; /* slider bottom position */ 27 unsigned int bot; /* slider bottom position */
15 unsigned int style; /* style: rxvt, xterm, next */ 28 unsigned int style; /* style: rxvt, xterm, next */
16 unsigned int width; /* scrollbar width */ 29 unsigned int width; /* scrollbar width */
17 int shadow; /* scrollbar shadow width */ 30 int shadow; /* scrollbar shadow width */
31 int last_bot; /* scrollbar last bottom position */
32 int last_top; /* scrollbar last top position */
33 int last_state; /* scrollbar last state */
34 int len;
35 unsigned char align;
18 Window win; 36 Window win;
37 Cursor leftptr_cursor;
19 int (rxvt_term::*update)(int, int, int, int); 38 int (rxvt_term::*update)(int, int, int, int);
39 void setup (rxvt_term *);
20 40
21 void setIdle() { state = 1 ; } 41 bool upButton (int y)
22 void setMotion() { state = 'm'; } 42 {
23 void setUp() { state = 'U'; } 43 if (style == R_SB_NEXT)
24 void setDn() { state = 'D'; } 44 return y > end && y <= end + width + 1;
25} scrollBar_t; 45 if (style == R_SB_RXVT)
46 return y < beg;
47 return false;
48 }
49 bool dnButton (int y)
50 {
51 if (style == R_SB_NEXT)
52 return y > end + width + 1;
53 if (style == R_SB_RXVT)
54 return y > end;
55 return false;
56 }
57 unsigned total_width ()
58 {
59 return width + shadow * 2;
60 }
61};
26 62
27#define scrollbar_TotalWidth() (scrollBar.width + scrollBar.shadow * 2)
28#define scrollbar_isMotion() (scrollBar.state == 'm')
29#define scrollbar_isUp() (scrollBar.state == 'U')
30#define scrollbar_isDn() (scrollBar.state == 'D')
31#define scrollbar_isUpDn() (scrollbar_isUp () || scrollbar_isDn ())
32#define isScrollbarWindow(w) (scrollBar.state && (w) == scrollBar.win)
33
34#define scrollbarnext_dnval() (scrollBar.end + (scrollBar.width + 1))
35#define scrollbarnext_upButton(y) ((y) > scrollBar.end \
36 && (y) <= scrollbarnext_dnval ())
37#define scrollbarnext_dnButton(y) ((y) > scrollbarnext_dnval())
38#define SCROLLNEXT_MINHEIGHT SB_THUMB_MIN_HEIGHT 63#define SCROLLNEXT_MINHEIGHT SB_THUMB_MIN_HEIGHT
39#define scrollbarrxvt_upButton(y) ((y) < scrollBar.beg)
40#define scrollbarrxvt_dnButton(y) ((y) > scrollBar.end)
41#define SCROLLRXVT_MINHEIGHT 10 64#define SCROLLRXVT_MINHEIGHT 10
42 65
43#define scrollbar_minheight() (scrollBar.style == R_SB_NEXT \ 66#define scrollbar_minheight() (scrollBar.style == R_SB_NEXT \
44 ? SCROLLNEXT_MINHEIGHT \ 67 ? SCROLLNEXT_MINHEIGHT \
45 : SCROLLRXVT_MINHEIGHT) 68 : SCROLLRXVT_MINHEIGHT)
50 - scrollbar_minheight ()) 73 - scrollbar_minheight ())
51 74
52#define R_SB_ALIGN_CENTRE 0 75#define R_SB_ALIGN_CENTRE 0
53#define R_SB_ALIGN_TOP 1 76#define R_SB_ALIGN_TOP 1
54#define R_SB_ALIGN_BOTTOM 2 77#define R_SB_ALIGN_BOTTOM 2
55
56#define R_SB_NEXT 1
57#define R_SB_XTERM 2
58#define R_SB_PLAIN 4
59#define R_SB_RXVT 8
60 78
61#define SB_WIDTH_NEXT 19 79#define SB_WIDTH_NEXT 19
62#define SB_WIDTH_XTERM 15 80#define SB_WIDTH_XTERM 15
63#define SB_WIDTH_PLAIN 7 81#define SB_WIDTH_PLAIN 7
64#ifndef SB_WIDTH_RXVT 82#ifndef SB_WIDTH_RXVT

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines