ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/scrollbar.h
Revision: 1.11
Committed: Sat Jan 5 12:19:34 2008 UTC (16 years, 4 months ago) by ayin
Content type: text/plain
Branch: MAIN
CVS Tags: rel-9_0, rel-9_01
Changes since 1.10: +2 -2 lines
Log Message:
Name scrollbar struct and remove typedef.

File Contents

# User Rev Content
1 ayin 1.1 #ifndef SCROLLBAR_H
2     #define SCROLLBAR_H
3    
4     #include <X11/Xlib.h>
5    
6     struct rxvt_term;
7    
8 ayin 1.11 struct scrollBar_t {
9 ayin 1.1 char state; /* scrollbar state */
10     char init; /* scrollbar has been initialised */
11     unsigned int beg; /* slider sub-window begin height */
12     unsigned int end; /* slider sub-window end height */
13     unsigned int top; /* slider top position */
14     unsigned int bot; /* slider bottom position */
15     unsigned int style; /* style: rxvt, xterm, next */
16     unsigned int width; /* scrollbar width */
17 ayin 1.3 int shadow; /* scrollbar shadow width */
18 ayin 1.7 int last_bot; /* scrollbar last bottom position */
19     int last_top; /* scrollbar last top position */
20     int last_state; /* scrollbar last state */
21 ayin 1.9 int len;
22 ayin 1.6 unsigned char align;
23 ayin 1.1 Window win;
24 ayin 1.10 Cursor leftptr_cursor;
25 ayin 1.1 int (rxvt_term::*update)(int, int, int, int);
26    
27     void setIdle() { state = 1 ; }
28     void setMotion() { state = 'm'; }
29     void setUp() { state = 'U'; }
30     void setDn() { state = 'D'; }
31 ayin 1.11 };
32 ayin 1.1
33 ayin 1.3 #define scrollbar_TotalWidth() (scrollBar.width + scrollBar.shadow * 2)
34 ayin 1.1 #define scrollbar_isMotion() (scrollBar.state == 'm')
35     #define scrollbar_isUp() (scrollBar.state == 'U')
36     #define scrollbar_isDn() (scrollBar.state == 'D')
37 ayin 1.5 #define scrollbar_isUpDn() (scrollbar_isUp () || scrollbar_isDn ())
38 ayin 1.1
39     #define scrollbarnext_dnval() (scrollBar.end + (scrollBar.width + 1))
40     #define scrollbarnext_upButton(y) ((y) > scrollBar.end \
41     && (y) <= scrollbarnext_dnval ())
42     #define scrollbarnext_dnButton(y) ((y) > scrollbarnext_dnval())
43     #define SCROLLNEXT_MINHEIGHT SB_THUMB_MIN_HEIGHT
44     #define scrollbarrxvt_upButton(y) ((y) < scrollBar.beg)
45     #define scrollbarrxvt_dnButton(y) ((y) > scrollBar.end)
46     #define SCROLLRXVT_MINHEIGHT 10
47    
48     #define scrollbar_minheight() (scrollBar.style == R_SB_NEXT \
49     ? SCROLLNEXT_MINHEIGHT \
50     : SCROLLRXVT_MINHEIGHT)
51     #define scrollbar_above_slider(y) ((y) < scrollBar.top)
52     #define scrollbar_below_slider(y) ((y) > scrollBar.bot)
53     #define scrollbar_position(y) ((y) - scrollBar.beg)
54     #define scrollbar_size() (scrollBar.end - scrollBar.beg \
55     - scrollbar_minheight ())
56    
57     #define R_SB_ALIGN_CENTRE 0
58     #define R_SB_ALIGN_TOP 1
59     #define R_SB_ALIGN_BOTTOM 2
60    
61     #define R_SB_NEXT 1
62     #define R_SB_XTERM 2
63     #define R_SB_PLAIN 4
64     #define R_SB_RXVT 8
65    
66     #define SB_WIDTH_NEXT 19
67     #define SB_WIDTH_XTERM 15
68     #define SB_WIDTH_PLAIN 7
69     #ifndef SB_WIDTH_RXVT
70     # define SB_WIDTH_RXVT 10
71     #endif
72    
73     /*
74     * NeXT scrollbar defines
75     */
76     #define SB_PADDING 1
77     #define SB_BORDER_WIDTH 1
78     #define SB_BEVEL_WIDTH_UPPER_LEFT 1
79     #define SB_BEVEL_WIDTH_LOWER_RIGHT 2
80     #define SB_LEFT_PADDING (SB_PADDING + SB_BORDER_WIDTH)
81     #define SB_MARGIN_SPACE (SB_PADDING * 2)
82     #define SB_BUTTON_WIDTH (SB_WIDTH_NEXT - SB_MARGIN_SPACE - SB_BORDER_WIDTH)
83     #define SB_BUTTON_HEIGHT (SB_BUTTON_WIDTH)
84     #define SB_BUTTON_SINGLE_HEIGHT (SB_BUTTON_HEIGHT + SB_PADDING)
85     #define SB_BUTTON_BOTH_HEIGHT (SB_BUTTON_SINGLE_HEIGHT * 2)
86     #define SB_BUTTON_TOTAL_HEIGHT (SB_BUTTON_BOTH_HEIGHT + SB_PADDING)
87     #define SB_BUTTON_BEVEL_X (SB_LEFT_PADDING)
88     #define SB_BUTTON_FACE_X (SB_BUTTON_BEVEL_X + SB_BEVEL_WIDTH_UPPER_LEFT)
89     #define SB_THUMB_MIN_HEIGHT (SB_BUTTON_WIDTH - (SB_PADDING * 2))
90     /*
91     * +-------------+
92     * | | <---< SB_PADDING
93     * | ::::::::::: |
94     * | ::::::::::: |
95     * '''''''''''''''''
96     * ,,,,,,,,,,,,,,,,,
97     * | ::::::::::: |
98     * | ::::::::::: |
99     * | +---------------< SB_BEVEL_WIDTH_UPPER_LEFT
100     * | | :::::::: |
101     * | V :::: vv-------< SB_BEVEL_WIDTH_LOWER_RIGHT
102     * | +---------+ |
103     * | | ......%%| |
104     * | | ......%%| |
105     * | | .. ()..%%| |
106     * | | ......%%| |
107     * | | %%%%%%%%| |
108     * | +---------+ | <.........................
109     * | | <---< SB_PADDING :
110     * | +---------+ | <-+.......... :---< SB_BUTTON_TOTAL_HEIGHT
111     * | | ......%%| | | : :
112     * | | ../\..%%| | |---< SB_BUTTON_HEIGHT :
113     * | | %%%%%%%%| | | : :
114     * | +---------+ | <-+ : :
115     * | | : :
116     * | +---------+ | <-+ :---< SB_BUTTON_BOTH_HEIGHT
117     * | | ......%%| | | : :
118     * | | ..\/..%%| | | : :
119     * | | %%%%%%%%| | |---< SB_BUTTON_SINGLE_HEIGHT
120     * | +---------+ | | : :
121     * | | | : :
122     * +-------------+ <-+.........:............:
123     * ^^|_________| :
124     * || | :
125     * || +---< SB_BUTTON_WIDTH
126     * || :
127     * |+------< SB_PADDING
128     * |: :
129     * +----< SB_BORDER_WIDTH
130     * : :
131     * :............:
132     * |
133     * +---< SB_WIDTH_NEXT
134     */
135    
136     #endif