1 /* Public Domain Curses */
5 RCSID("$Id: sb.c,v 1.27 2008/07/14 04:24:52 wmcbrine Exp $")
7 /*man-start**************************************************************
13 int sb_set_horz(int total, int viewport, int cur)
14 int sb_set_vert(int total, int viewport, int cur)
15 int sb_get_horz(int *total, int *viewport, int *cur)
16 int sb_get_vert(int *total, int *viewport, int *cur)
20 These functions manipulate the scrollbar.
23 All functions return OK on success and ERR on error.
25 Portability X/Open BSD SYS V
33 **man-end****************************************************************/
35 bool sb_started = FALSE;
37 /* sb_init() is the sb initialization routine.
38 This must be called before initscr(). */
42 PDC_LOG(("sb_init() - called\n"));
52 /* sb_set_horz() - Used to set horizontal scrollbar.
54 total = total number of columns
55 viewport = size of viewport in columns
56 cur = current column in total */
58 int sb_set_horz(int total, int viewport, int cur)
60 PDC_LOG(("sb_set_horz() - called: total %d viewport %d cur %d\n",
61 total, viewport, cur));
66 SP->sb_total_x = total;
67 SP->sb_viewport_x = viewport;
73 /* sb_set_vert() - Used to set vertical scrollbar.
75 total = total number of columns on line
76 viewport = size of viewport in columns
77 cur = current column in total */
79 int sb_set_vert(int total, int viewport, int cur)
81 PDC_LOG(("sb_set_vert() - called: total %d viewport %d cur %d\n",
82 total, viewport, cur));
87 SP->sb_total_y = total;
88 SP->sb_viewport_y = viewport;
94 /* sb_get_horz() - Used to get horizontal scrollbar.
96 total = total number of lines
97 viewport = size of viewport in lines
98 cur = current line in total */
100 int sb_get_horz(int *total, int *viewport, int *cur)
102 PDC_LOG(("sb_get_horz() - called\n"));
108 *total = SP->sb_total_x;
110 *viewport = SP->sb_viewport_x;
117 /* sb_get_vert() - Used to get vertical scrollbar.
119 total = total number of lines
120 viewport = size of viewport in lines
121 cur = current line in total */
123 int sb_get_vert(int *total, int *viewport, int *cur)
125 PDC_LOG(("sb_get_vert() - called\n"));
131 *total = SP->sb_total_y;
133 *viewport = SP->sb_viewport_y;
140 /* sb_refresh() - Used to draw the scrollbars. */
144 PDC_LOG(("sb_refresh() - called\n"));
149 XCursesInstruct(CURSES_REFRESH_SCROLLBAR);