drivers/wifi: Remove unnecessary data structure copy
[coreboot2.git] / payloads / libpayload / curses / PDCurses / x11 / sb.c
blob95b029216955e9359f76246ea8088025d5890306
1 /* Public Domain Curses */
3 #include "pdcx11.h"
5 RCSID("$Id: sb.c,v 1.27 2008/07/14 04:24:52 wmcbrine Exp $")
7 /*man-start**************************************************************
9 Name: sb
11 Synopsis:
12 int sb_init(void)
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)
17 int sb_refresh(void);
19 Description:
20 These functions manipulate the scrollbar.
22 Return Value:
23 All functions return OK on success and ERR on error.
25 Portability X/Open BSD SYS V
26 sb_init - - -
27 sb_set_horz - - -
28 sb_set_vert - - -
29 sb_get_horz - - -
30 sb_get_vert - - -
31 sb_refresh - - -
33 **man-end****************************************************************/
35 bool sb_started = FALSE;
37 /* sb_init() is the sb initialization routine.
38 This must be called before initscr(). */
40 int sb_init(void)
42 PDC_LOG(("sb_init() - called\n"));
44 if (SP)
45 return ERR;
47 sb_started = TRUE;
49 return OK;
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));
63 if (!SP)
64 return ERR;
66 SP->sb_total_x = total;
67 SP->sb_viewport_x = viewport;
68 SP->sb_cur_x = cur;
70 return OK;
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));
84 if (!SP)
85 return ERR;
87 SP->sb_total_y = total;
88 SP->sb_viewport_y = viewport;
89 SP->sb_cur_y = cur;
91 return OK;
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"));
104 if (!SP)
105 return ERR;
107 if (total)
108 *total = SP->sb_total_x;
109 if (viewport)
110 *viewport = SP->sb_viewport_x;
111 if (cur)
112 *cur = SP->sb_cur_x;
114 return OK;
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"));
127 if (!SP)
128 return ERR;
130 if (total)
131 *total = SP->sb_total_y;
132 if (viewport)
133 *viewport = SP->sb_viewport_y;
134 if (cur)
135 *cur = SP->sb_cur_y;
137 return OK;
140 /* sb_refresh() - Used to draw the scrollbars. */
142 int sb_refresh(void)
144 PDC_LOG(("sb_refresh() - called\n"));
146 if (!SP)
147 return ERR;
149 XCursesInstruct(CURSES_REFRESH_SCROLLBAR);
151 return OK;