home *** CD-ROM | disk | FTP | other *** search
- /*
- bordghzb.c 2/87
-
- % border_GetHzBar
-
- OWL 1.1
- Copyright (c) 1986, 1987, 1988, by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 11/08/88 ted Changed to new non-window border scheme
- 12/18/88 jdc Fixed calculation error
- 12/20/88 ted Converted to integer math.
- */
-
- #include "oakhead.h"
- #include "disppriv.h"
- #include "bordobj.h"
-
- void bord_GetHzBar(win, lend, rend, left, right)
- win_type win;
- int *lend;
- int *rend;
- boolean *left;
- boolean *right;
- /*
- Get horizontal scroll bar info for a border.
- The left and right end cols of the bar are passed
- in lend and rend. The left and right ends of the scrollbar 'elevator'
- are returned in lend and rend.
- */
- {
- inposdata_struct inpos;
- int ellend, elrend, elwid;
- int barwid;
- opcoord inwid;
-
- if (win == NULL) {
- *left = FALSE;
- *right = FALSE;
- return;
- }
- inpos.win = win;
- win_Do(win, WINM_GETINPOS, NULL, &inpos);
-
- *left = (inpos.inbox.xmin < 0);
- *right = (inpos.inbox.xmax > win_GetPixWidth(win));
-
- if (!(*left) && !(*right)) {
- return;
- }
-
- barwid = *rend - *lend + 1;
- if (barwid <= 1) {
- return;
- }
- inwid = opbox_GetWidth(&inpos.inbox);
- if (inwid <= 0) {
- return;
- }
- ellend = (barwid * (0 - inpos.inbox.xmin) + inwid/2) /
- inwid;
- ellend += *lend;
-
- elwid = (barwid * win_GetPixWidth(win) + inwid/2) /
- inwid;
- if (elwid <= 0) {
- elwid = 1;
- }
- elrend = ellend + elwid - 1;
-
- if (win_GetPixWidth(win) <= inpos.inbox.xmax &&
- elrend > *rend) {
- ellend -= elrend - *rend;
- elrend = *rend;
- }
-
- if (ellend < *lend) ellend = *lend;
- else if (ellend > *rend) ellend = *rend;
-
- if (elrend < *lend) elrend = *lend;
- else if (elrend > *rend) elrend = *rend;
-
- *lend = ellend;
- *rend = elrend;
- }
- /* -------------------------------------------------------------------------- */
-
-