static void drawCDKButtonText (CDKBUTTON *button) { int boxWidth = button->boxWidth; int i; /* Draw in the message. */ for (i = 0; i < boxWidth - 2 * BorderOf (button); i++) { chtype c; int pos = button->infoPos; int len = button->infoLen; if (i >= pos && (i - pos) < len) c = button->info[i - pos]; else c = ' '; if (HasFocusObj (button)) { c = A_REVERSE | CharOf (c); } mvwaddch (button->win, BorderOf (button), i + BorderOf (button), c); } }
static int do_delete1 (CB_PARAMS) { CDKFSELECT *widget = (CDKFSELECT *)clientdata; int size; char **list = getCDKFselectContents (widget, &size); int result = FALSE; if (size) { int save = getCDKScrollCurrentTop (widget->scrollField); int first = getCDKFselectCurrentItem (widget); if (first-- > 0) { int n; fill_undo (widget, first, list[first]); for (n = first; n < size; ++n) list[n] = list[n + 1]; setCDKFselectContents (widget, (CDK_CSTRING2)list, size - 1); setCDKScrollCurrentTop (widget->scrollField, save); setCDKFselectCurrentItem (widget, first); drawCDKFselect (widget, BorderOf (widget)); result = TRUE; } } return result; }
static int do_undo (CB_PARAMS) { int result = FALSE; if (undoSize > 0) { CDKFSELECT *widget = (CDKFSELECT *)clientdata; int size; int n; char **oldlist = getCDKFselectContents (widget, &size); char **newlist = (char **)malloc ((size_t) (++size + 1) * sizeof (char *)); --undoSize; newlist[size] = 0; for (n = size - 1; n > myUndoList[undoSize].deleted; --n) { newlist[n] = copyChar (oldlist[n - 1]); } newlist[n--] = copyChar (myUserList[myUndoList[undoSize].original]); while (n >= 0) { newlist[n] = copyChar (oldlist[n]); --n; } setCDKFselectContents (widget, (CDK_CSTRING2)newlist, size); setCDKScrollCurrentTop (widget->scrollField, myUndoList[undoSize].topline); setCDKFselectCurrentItem (widget, myUndoList[undoSize].position); drawCDKFselect (widget, BorderOf (widget)); free (newlist); result = TRUE; } return result; }
/* * This creates a marquee widget. */ CDKMARQUEE *newCDKMarquee (CDKSCREEN *cdkscreen, int xplace, int yplace, int width, boolean Box, boolean shadow) { CDKMARQUEE *widget = 0; int parentWidth = getmaxx (cdkscreen->window); int xpos = xplace; int ypos = yplace; int boxHeight; int boxWidth; if ((widget = newCDKObject (CDKMARQUEE, &my_funcs)) == 0) return (0); setCDKMarqueeBox (widget, Box); boxWidth = setWidgetDimension (parentWidth, width, 0); boxHeight = (BorderOf (widget) * 2) + 1; /* Rejustify the x and y positions if we need to. */ alignxy (cdkscreen->window, &xpos, &ypos, boxWidth, boxHeight); /* Create the widget pointer. */ ScreenOf (widget) = cdkscreen; widget->parent = cdkscreen->window; widget->win = newwin (boxHeight, boxWidth, ypos, xpos); widget->boxHeight = boxHeight; widget->boxWidth = boxWidth; widget->shadowWin = 0; widget->active = TRUE; widget->width = width; widget->shadow = shadow; /* Is the window null??? */ if (widget->win == 0) { destroyCDKObject (widget); return (0); } /* Do we want a shadow? */ if (shadow) { widget->shadowWin = subwin (cdkscreen->window, boxHeight, boxWidth, ypos + 1, xpos + 1); } keypad (widget->win, TRUE); registerCDKObject (cdkscreen, vMARQUEE, widget); return (widget); }
static int do_reload (CB_PARAMS) { int result = FALSE; if (userSize) { CDKFSELECT *widget = (CDKFSELECT *)clientdata; setCDKFselectContents (widget, (CDK_CSTRING2)myUserList, userSize); setCDKFselectCurrentItem (widget, 0); drawCDKFselect (widget, BorderOf (widget)); result = TRUE; } return result; }
/* * This sets the information within the button. */ void setCDKButtonMessage (CDKBUTTON *button, const char *info) { /* Clean out the old message. */ freeChtype (button->info); button->infoPos = 0; button->infoLen = 0; /* Copy in the new message. */ button->info = char2Chtype (info, &button->infoLen, &button->infoPos); button->infoPos = justifyString (button->boxWidth - 2 * BorderOf (button), button->infoLen, button->infoPos); /* Redraw the button widget. */ eraseCDKButton (button); drawCDKButton (button, ObjOf (button)->box); }
/* * This creates the alphalist widget. */ CDKALPHALIST *newCDKAlphalist (CDKSCREEN *cdkscreen, int xplace, int yplace, int height, int width, char *title, char *label, char **list, int listSize, chtype fillerChar, chtype highlight, boolean Box, boolean shadow) { CDKALPHALIST *alphalist = 0; chtype *chtypeLabel = 0; int parentWidth = getmaxx (cdkscreen->window); int parentHeight = getmaxy (cdkscreen->window); int boxWidth = width; int boxHeight = height; int xpos = xplace; int ypos = yplace; int tempWidth = 0; int tempHeight = 0; int labelLen = 0; int x, junk2; static const struct { int from; int to; } bindings[] = { { CDK_BACKCHAR, KEY_PPAGE }, { CDK_FORCHAR, KEY_NPAGE }, }; if ((alphalist = newCDKObject (CDKALPHALIST, &my_funcs)) == 0 || !createList (alphalist, list, listSize)) { destroyCDKObject (alphalist); return (0); } setCDKAlphalistBox (alphalist, Box); /* * If the height is a negative value, the height will * be ROWS-height, otherwise, the height will be the * given height. */ boxHeight = setWidgetDimension (parentHeight, height, 0); /* * If the width is a negative value, the width will * be COLS-width, otherwise, the width will be the * given width. */ boxWidth = setWidgetDimension (parentWidth, width, 0); /* Translate the label char *pointer to a chtype pointer. */ if (label != 0) { chtypeLabel = char2Chtype (label, &labelLen, &junk2); freeChtype (chtypeLabel); } /* Rejustify the x and y positions if we need to. */ alignxy (cdkscreen->window, &xpos, &ypos, boxWidth, boxHeight); /* Make the file selector window. */ alphalist->win = newwin (boxHeight, boxWidth, ypos, xpos); if (alphalist->win == 0) { destroyCDKObject (alphalist); return (0); } keypad (alphalist->win, TRUE); /* Set some variables. */ ScreenOf (alphalist) = cdkscreen; alphalist->parent = cdkscreen->window; alphalist->highlight = highlight; alphalist->fillerChar = fillerChar; alphalist->boxHeight = boxHeight; alphalist->boxWidth = boxWidth; initExitType (alphalist); alphalist->shadow = shadow; alphalist->shadowWin = 0; /* Do we want a shadow? */ if (shadow) { alphalist->shadowWin = newwin (boxHeight, boxWidth, ypos + 1, xpos + 1); } /* Create the entry field. */ tempWidth = (isFullWidth (width) ? FULL : boxWidth - 2 - labelLen); alphalist->entryField = newCDKEntry (cdkscreen, getbegx (alphalist->win), getbegy (alphalist->win), title, label, A_NORMAL, fillerChar, vMIXED, tempWidth, 0, 512, Box, FALSE); if (alphalist->entryField == 0) { destroyCDKObject (alphalist); return (0); } setCDKEntryLLChar (alphalist->entryField, ACS_LTEE); setCDKEntryLRChar (alphalist->entryField, ACS_RTEE); /* Set the key bindings for the entry field. */ bindCDKObject (vENTRY, alphalist->entryField, KEY_UP, adjustAlphalistCB, alphalist); bindCDKObject (vENTRY, alphalist->entryField, KEY_DOWN, adjustAlphalistCB, alphalist); bindCDKObject (vENTRY, alphalist->entryField, KEY_NPAGE, adjustAlphalistCB, alphalist); bindCDKObject (vENTRY, alphalist->entryField, KEY_PPAGE, adjustAlphalistCB, alphalist); bindCDKObject (vENTRY, alphalist->entryField, KEY_TAB, completeWordCB, alphalist); /* Set up the post-process function for the entry field. */ setCDKEntryPreProcess (alphalist->entryField, preProcessEntryField, alphalist); /* * Create the scrolling list. It overlaps the entry field by one line if * we are using box-borders. */ tempHeight = getmaxy (alphalist->entryField->win) - BorderOf (alphalist); tempWidth = (isFullWidth (width) ? FULL : boxWidth - 1); alphalist->scrollField = newCDKScroll (cdkscreen, getbegx (alphalist->win), getbegy (alphalist->entryField->win) + tempHeight, RIGHT, boxHeight - tempHeight, tempWidth, 0, list, listSize, NONUMBERS, A_REVERSE, Box, FALSE); setCDKScrollULChar (alphalist->scrollField, ACS_LTEE); setCDKScrollURChar (alphalist->scrollField, ACS_RTEE); /* Setup the key bindings. */ for (x = 0; x < (int) SIZEOF (bindings); ++x) bindCDKObject (vALPHALIST, alphalist, bindings[x].from, getcCDKBind, (void *)(long)bindings[x].to); registerCDKObject (cdkscreen, vALPHALIST, alphalist); return (alphalist); }
/* * This activates the widget. */ int activateCDKMarquee (CDKMARQUEE *widget, char *mesg, int delay, int repeat, boolean Box) { chtype *message; int mesgLength = 0; int startPos = 0; int firstChar = 0; int lastChar = 1; int repeatCount = 0; int viewSize = 0; int viewLimit; int padding; int x, y, junk, oldcurs; bool firstTime = TRUE; /* Make sure the message has some content. */ if (mesg == 0 || *mesg == '\0') { return (-1); } /* Keep the box info, setting BorderOf () */ setCDKMarqueeBox (widget, Box); padding = (mesg[strlen (mesg) - 1] == ' ') ? 0 : 1; /* Translate the char * to a chtype * */ message = char2Chtype (mesg, &mesgLength, &junk); /* Draw in the widget. */ drawCDKMarquee (widget, ObjOf (widget)->box); viewLimit = widget->width - (2 * BorderOf (widget)); /* Start doing the marquee thing... */ oldcurs = curs_set (0); while (widget->active) { if (firstTime) { firstChar = 0; lastChar = 1; viewSize = lastChar - firstChar; startPos = widget->width - viewSize - BorderOf (widget); firstTime = FALSE; } /* Draw in the characters. */ y = firstChar; for (x = startPos; x < (startPos + viewSize); x++) { chtype ch = (y < mesgLength) ? message[y] : ' '; mvwaddch (widget->win, BorderOf (widget), x, ch); y++; } wrefresh (widget->win); /* Set my variables. */ if (mesgLength < viewLimit) { if (lastChar < (mesgLength + padding)) { lastChar++; viewSize++; startPos = widget->width - viewSize - BorderOf (widget); } else if (startPos > BorderOf (widget)) { /* This means the whole string is visible. */ startPos--; viewSize = mesgLength + padding; } else { /* We have to start chopping the viewSize */ startPos = BorderOf (widget); firstChar++; viewSize--; } } else { if (startPos > BorderOf (widget)) { lastChar++; viewSize++; startPos--; } else if (lastChar < (mesgLength + padding)) { firstChar++; lastChar++; startPos = BorderOf (widget); viewSize = viewLimit; } else { startPos = BorderOf (widget); firstChar++; viewSize--; } } /* OK, lets check if we have to start over. */ if (viewSize <= 0 && firstChar == mesgLength + padding) { /* Check if we repeat a specified number, or loop indefinitely. */ if ((repeat > 0) && (++repeatCount >= repeat)) { break; } /* Time to start over. */ mvwaddch (widget->win, BorderOf (widget), BorderOf (widget), ' '); wrefresh (widget->win); firstTime = TRUE; } /* Now sleep */ napms (delay * 10); } if (oldcurs < 0) oldcurs = 1; curs_set (oldcurs); freeChtype (message); return (0); }
/* * This creates a button widget. */ CDKBUTTON *newCDKButton (CDKSCREEN *cdkscreen, int xplace, int yplace, const char *text, tButtonCallback callback, boolean Box, boolean shadow) { /* *INDENT-EQLS* */ CDKBUTTON *button = 0; int parentWidth = getmaxx (cdkscreen->window); int parentHeight = getmaxy (cdkscreen->window); int boxWidth = 0; int boxHeight; int xpos = xplace; int ypos = yplace; if ((button = newCDKObject (CDKBUTTON, &my_funcs)) == 0) return (0); setCDKButtonBox (button, Box); boxHeight = 1 + 2 * BorderOf (button); /* Translate the char * to a chtype. */ button->info = char2Chtype (text, &button->infoLen, &button->infoPos); boxWidth = MAXIMUM (boxWidth, button->infoLen) + 2 * BorderOf (button); /* Create the string alignments. */ button->infoPos = justifyString (boxWidth - 2 * BorderOf (button), button->infoLen, button->infoPos); /* * Make sure we didn't extend beyond the dimensions of the window. */ boxWidth = (boxWidth > parentWidth ? parentWidth : boxWidth); boxHeight = (boxHeight > parentHeight ? parentHeight : boxHeight); /* Rejustify the x and y positions if we need to. */ alignxy (cdkscreen->window, &xpos, &ypos, boxWidth, boxHeight); /* *INDENT-EQLS* Create the button. */ ScreenOf (button) = cdkscreen; ObjOf (button)->fn = &my_funcs; button->parent = cdkscreen->window; button->win = newwin (boxHeight, boxWidth, ypos, xpos); button->shadowWin = (WINDOW *)NULL; button->xpos = xpos; button->ypos = ypos; button->boxWidth = boxWidth; button->boxHeight = boxHeight; button->callback = callback; ObjOf (button)->inputWindow = button->win; ObjOf (button)->acceptsFocus = TRUE; initExitType (button); button->shadow = shadow; /* Is the window NULL? */ if (button->win == (WINDOW *)NULL) { destroyCDKObject (button); return (0); } keypad (button->win, TRUE); /* If a shadow was requested, then create the shadow window. */ if (shadow) button->shadowWin = newwin (boxHeight, boxWidth, ypos + 1, xpos + 1); /* Register this baby. */ registerCDKObject (cdkscreen, vBUTTON, button); /* Return the button pointer. */ return (button); }
/* * This redraws the scrolling list. */ static void drawCDKScrollList (CDKSCROLL *scrollp, boolean Box) { int j; /* If the list is empty, don't draw anything. */ if (scrollp->listSize > 0) { /* Redraw the list */ for (j = 0; j < scrollp->viewSize; j++) { int k = j + scrollp->currentTop; writeBlanks (scrollp->listWin, 0, j, HORIZONTAL, 0, scrollp->boxWidth - 2 * BorderOf (scrollp)); /* Draw the elements in the scrolling list. */ if (k < scrollp->listSize) { int screenPos = SCREENPOS (scrollp, k); int ypos = SCREEN_YPOS (scrollp, j); /* Write in the correct line. */ writeChtype (scrollp->listWin, (screenPos >= 0) ? screenPos : 1, ypos, scrollp->item[k], HORIZONTAL, (screenPos >= 0) ? 0 : (1 - screenPos), scrollp->itemLen[k]); } } drawCDKScrollCurrent (scrollp); /* Determine where the toggle is supposed to be. */ if (scrollp->scrollbarWin != 0) { scrollp->togglePos = floorCDK (scrollp->currentItem * (double)scrollp->step); /* Make sure the toggle button doesn't go out of bounds. */ if (scrollp->togglePos >= getmaxy (scrollp->scrollbarWin)) scrollp->togglePos = getmaxy (scrollp->scrollbarWin) - 1; /* Draw the scrollbar. */ mvwvline (scrollp->scrollbarWin, 0, 0, ACS_CKBOARD, getmaxy (scrollp->scrollbarWin)); mvwvline (scrollp->scrollbarWin, scrollp->togglePos, 0, ' ' | A_REVERSE, scrollp->toggleSize); } } /* Box it if needed. */ if (Box) { drawObjBox (scrollp->win, ObjOf (scrollp)); } /* Refresh the window. */ wrefresh (scrollp->win); }
/* * This function creates a new scrolling list widget. */ CDKSCROLL *newCDKScroll (CDKSCREEN *cdkscreen, int xplace, int yplace, int splace, int height, int width, const char *title, CDK_CSTRING2 list, int listSize, boolean numbers, chtype highlight, boolean Box, boolean shadow) { /* *INDENT-EQLS* */ CDKSCROLL *scrollp = 0; int parentWidth = getmaxx (cdkscreen->window); int parentHeight = getmaxy (cdkscreen->window); int boxWidth = width; int boxHeight = height; int xpos = xplace; int ypos = yplace; int scrollAdjust = 0; int x; /* *INDENT-OFF* */ static const struct { int from; int to; } bindings[] = { { CDK_BACKCHAR, KEY_PPAGE }, { CDK_FORCHAR, KEY_NPAGE }, { 'g', KEY_HOME }, { '1', KEY_HOME }, { 'G', KEY_END }, { '<', KEY_HOME }, { '>', KEY_END }, }; /* *INDENT-ON* */ if ((scrollp = newCDKObject (CDKSCROLL, &my_funcs)) == 0) { destroyCDKObject (scrollp); return (0); } setCDKScrollBox (scrollp, Box); /* * If the height is a negative value, the height will * be ROWS-height, otherwise, the height will be the * given height. */ boxHeight = setWidgetDimension (parentHeight, height, 0); /* * If the width is a negative value, the width will * be COLS-width, otherwise, the width will be the * given width. */ boxWidth = setWidgetDimension (parentWidth, width, 0); boxWidth = setCdkTitle (ObjOf (scrollp), title, boxWidth); /* Set the box height. */ if (TitleLinesOf (scrollp) > boxHeight) { boxHeight = (TitleLinesOf (scrollp) + MINIMUM (listSize, 8) + 2 * BorderOf (scrollp)); } /* Adjust the box width if there is a scrollp bar. */ if ((splace == LEFT) || (splace == RIGHT)) { scrollp->scrollbar = TRUE; boxWidth += 1; } else { scrollp->scrollbar = FALSE; } /* * Make sure we didn't extend beyond the dimensions of the window. */ scrollp->boxWidth = (boxWidth > parentWidth ? (parentWidth - scrollAdjust) : boxWidth); scrollp->boxHeight = (boxHeight > parentHeight ? parentHeight : boxHeight); setViewSize (scrollp, listSize); /* Rejustify the x and y positions if we need to. */ alignxy (cdkscreen->window, &xpos, &ypos, scrollp->boxWidth, scrollp->boxHeight); /* Make the scrolling window */ scrollp->win = newwin (scrollp->boxHeight, scrollp->boxWidth, ypos, xpos); /* Is the scrolling window null?? */ if (scrollp->win == 0) { destroyCDKObject (scrollp); return (0); } /* Turn the keypad on for the window. */ keypad (scrollp->win, TRUE); /* Create the scrollbar window. */ if (splace == RIGHT) { scrollp->scrollbarWin = subwin (scrollp->win, maxViewSize (scrollp), 1, SCREEN_YPOS (scrollp, ypos), xpos + scrollp->boxWidth - BorderOf (scrollp) - 1); } else if (splace == LEFT) { scrollp->scrollbarWin = subwin (scrollp->win, maxViewSize (scrollp), 1, SCREEN_YPOS (scrollp, ypos), SCREEN_XPOS (scrollp, xpos)); } else { scrollp->scrollbarWin = 0; } /* create the list window */ scrollp->listWin = subwin (scrollp->win, maxViewSize (scrollp), scrollp->boxWidth - 2 * BorderOf (scrollp) - scrollAdjust, SCREEN_YPOS (scrollp, ypos), SCREEN_XPOS (scrollp, xpos) + (splace == LEFT ? 1 : 0)); /* *INDENT-EQLS* Set the rest of the variables */ ScreenOf (scrollp) = cdkscreen; scrollp->parent = cdkscreen->window; scrollp->shadowWin = 0; scrollp->scrollbarPlacement = splace; scrollp->maxLeftChar = 0; scrollp->leftChar = 0; scrollp->highlight = highlight; initExitType (scrollp); ObjOf (scrollp)->acceptsFocus = TRUE; ObjOf (scrollp)->inputWindow = scrollp->win; scrollp->shadow = shadow; setCDKScrollPosition (scrollp, 0); /* Create the scrolling list item list and needed variables. */ if (createCDKScrollItemList (scrollp, numbers, list, listSize) <= 0) { destroyCDKObject (scrollp); return (0); } /* Do we need to create a shadow? */ if (shadow) { scrollp->shadowWin = newwin (scrollp->boxHeight, boxWidth, ypos + 1, xpos + 1); } /* Setup the key bindings. */ for (x = 0; x < (int)SIZEOF (bindings); ++x) bindCDKObject (vSCROLL, scrollp, (chtype)bindings[x].from, getcCDKBind, (void *)(long)bindings[x].to); registerCDKObject (cdkscreen, vSCROLL, scrollp); /* Return the scrolling list */ return scrollp; }
/* * This function creates a widget. */ CDKUSCALE *newCDKUScale (CDKSCREEN *cdkscreen, int xplace, int yplace, char *title, char *label, chtype fieldAttr, int fieldWidth, unsigned start, unsigned low, unsigned high, unsigned inc, unsigned fastInc, boolean Box, boolean shadow) { CDKUSCALE *widget = 0; int parentWidth = getmaxx(cdkscreen->window); int parentHeight = getmaxy(cdkscreen->window); int boxHeight; int boxWidth; int horizontalAdjust, oldWidth; int xpos = xplace; int ypos = yplace; int x, junk; static const struct { int from; int to; } bindings[] = { { 'u', KEY_UP }, { 'U', KEY_PPAGE }, { CDK_BACKCHAR, KEY_PPAGE }, { CDK_FORCHAR, KEY_NPAGE }, { 'g', KEY_HOME }, { '^', KEY_HOME }, { 'G', KEY_END }, { '$', KEY_END }, }; if ((widget = newCDKObject(CDKUSCALE, &my_funcs)) == 0) return (0); setCDKUScaleBox (widget, Box); boxHeight = (BorderOf(widget) * 2) + 1; boxWidth = fieldWidth + 2*BorderOf(widget); /* Set some basic values of the widget's data field. */ widget->label = 0; widget->labelLen = 0; widget->labelWin = 0; /* * If the fieldWidth is a negative value, the fieldWidth will * be COLS-fieldWidth, otherwise, the fieldWidth will be the * given width. */ fieldWidth = setWidgetDimension (parentWidth, fieldWidth, 0); boxWidth = fieldWidth + 2*BorderOf(widget); /* Translate the label char *pointer to a chtype pointer. */ if (label != 0) { widget->label = char2Chtype (label, &widget->labelLen, &junk); boxWidth = widget->labelLen + fieldWidth + 2; } oldWidth = boxWidth; boxWidth = setCdkTitle(ObjOf(widget), title, boxWidth); horizontalAdjust = (boxWidth - oldWidth) / 2; boxHeight += TitleLinesOf(widget); /* * Make sure we didn't extend beyond the dimensions of the window. */ boxWidth = (boxWidth > parentWidth ? parentWidth : boxWidth); boxHeight = (boxHeight > parentHeight ? parentHeight : boxHeight); fieldWidth = (fieldWidth > (boxWidth - widget->labelLen - 2*BorderOf(widget)) ? (boxWidth - widget->labelLen - 2*BorderOf(widget)) : fieldWidth); /* Rejustify the x and y positions if we need to. */ alignxy (cdkscreen->window, &xpos, &ypos, boxWidth, boxHeight); /* Make the widget's window. */ widget->win = newwin (boxHeight, boxWidth, ypos, xpos); /* Is the main window null??? */ if (widget->win == 0) { destroyCDKObject(widget); return (0); } /* Create the widget's label window. */ if (widget->label != 0) { widget->labelWin = subwin (widget->win, 1, widget->labelLen, ypos + TitleLinesOf(widget) + BorderOf(widget), xpos + horizontalAdjust + BorderOf(widget)); if (widget->labelWin == 0) { destroyCDKObject(widget); return (0); } } /* Create the widget's data field window. */ widget->fieldWin = subwin (widget->win, 1, fieldWidth, ypos + TitleLinesOf(widget) + BorderOf(widget), xpos + widget->labelLen + horizontalAdjust + BorderOf(widget)); if (widget->fieldWin == 0) { destroyCDKObject(widget); return (0); } keypad (widget->fieldWin, TRUE); keypad (widget->win, TRUE); /* Create the widget's data field. */ ScreenOf(widget) = cdkscreen; widget->parent = cdkscreen->window; widget->shadowWin = 0; widget->boxWidth = boxWidth; widget->boxHeight = boxHeight; widget->fieldWidth = fieldWidth; widget->fieldAttr = (chtype)fieldAttr; widget->current = low; widget->low = low; widget->high = high; widget->current = start; widget->inc = inc; widget->fastinc = fastInc; initExitType(widget); ObjOf(widget)->acceptsFocus = TRUE; ObjOf(widget)->inputWindow = widget->win; widget->shadow = shadow; /* Do we want a shadow??? */ if (shadow) { widget->shadowWin = newwin (boxHeight, boxWidth, ypos + 1, xpos + 1); if (widget->shadowWin == 0) { destroyCDKObject(widget); return (0); } } /* Setup the key bindings. */ for (x = 0; x < (int) SIZEOF(bindings); ++x) bindCDKObject (vUSCALE, widget, bindings[x].from, getcCDKBind, (void *)(long)bindings[x].to); registerCDKObject (cdkscreen, vUSCALE, widget); return (widget); }