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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines