/* * This function sets the low/high values of the widget. */ void setCDKFSliderLowHigh (CDKFSLIDER *widget, float low, float high) { /* Make sure the values aren't out of bounds. */ if (low <= high) { widget->low = low; widget->high = high; } else if (low > high) { widget->low = high; widget->high = low; } /* Make sure the user hasn't done something silly. */ limitCurrentValue(widget); }
/* * This function sets the low/high values of the widget. */ void setCDKUScaleLowHigh (CDKUSCALE *widget, unsigned low, unsigned high) { /* Make sure the values aren't out of bounds. */ if (low <= high) { widget->low = low; widget->high = high; } else if (low > high) { widget->low = high; widget->high = low; } /* Make sure the user hasn't done something silly. */ limitCurrentValue(widget); }
/* * This sets the widget's value. */ void setCDKUScaleValue (CDKUSCALE *widget, unsigned value) { widget->current = value; limitCurrentValue(widget); }
/* * This function injects a single character into the widget. */ static int _injectCDKUScale (CDKOBJS *object, chtype input) { CDKUSCALE *widget = (CDKUSCALE *)object; int ppReturn = 1; unsigned ret = unknownUnsigned; bool complete = FALSE; /* Set the exit type. */ setExitType(widget, 0); /* Draw the field. */ drawCDKUScaleField (widget); /* Check if there is a pre-process function to be called. */ if (PreProcessFuncOf(widget) != 0) { /* Call the pre-process function. */ ppReturn = PreProcessFuncOf(widget) (vUSCALE, widget, PreProcessDataOf(widget), input); } /* Should we continue? */ if (ppReturn != 0) { /* Check for a key binding. */ if (checkCDKObjectBind(vUSCALE, widget, input) != 0) { checkEarlyExit(widget); complete = TRUE; } else { switch (input) { case KEY_LEFT : setEditPosition(widget, widget->fieldEdit + 1); break; case KEY_RIGHT : setEditPosition(widget, widget->fieldEdit - 1); break; case KEY_DOWN : Decrement(widget->current, widget->inc); break; case KEY_UP : Increment(widget->current, widget->inc); break; case KEY_PPAGE : Increment(widget->current, widget->fastinc); break; case KEY_NPAGE : Decrement(widget->current, widget->fastinc); break; case KEY_HOME : widget->current = widget->low; break; case KEY_END : widget->current = widget->high; break; case KEY_TAB : case KEY_ENTER : setExitType(widget, input); ret = (widget->current); complete = TRUE; break; case KEY_ESC : setExitType(widget, input); complete = TRUE; break; case CDK_REFRESH : eraseCDKScreen (ScreenOf(widget)); refreshCDKScreen (ScreenOf(widget)); break; default : if (widget->fieldEdit) { if (!performEdit(widget, input)) BEEP(); } else { /* * The cursor is not within the editable text. Interpret * input as commands. */ switch (input) { case 'd': case '-': return _injectCDKUScale(object, KEY_DOWN); case '+': return _injectCDKUScale(object, KEY_UP); case 'D': return _injectCDKUScale(object, KEY_NPAGE); case '0': return _injectCDKUScale(object, KEY_HOME); default: BEEP(); break; } } break; } } limitCurrentValue(widget); /* Should we call a post-process? */ if (!complete && (PostProcessFuncOf(widget) != 0)) { PostProcessFuncOf(widget) (vUSCALE, widget, PostProcessDataOf(widget), input); } } if (!complete) { drawCDKUScaleField (widget); setExitType(widget, 0); } ResultOf(widget).valueUnsigned = ret; return (ret != unknownUnsigned); }
/* * This sets the widget's value. */ void setCDKDScaleValue (CDKDSCALE *widget, double value) { widget->current = value; limitCurrentValue(widget); }
/* * This sets the widget's value. */ void setCDKFSliderValue (CDKFSLIDER *widget, float value) { widget->current = value; limitCurrentValue(widget); }
/* * This sets the widget's value. */ void setCDKScaleValue (CDKSCALE * widget, int value) { widget->current = value; limitCurrentValue (widget); }