Although originally designed for the TQScrollBar widget, the TQRangeControl can also be used in conjunction with other widgets such as TQSlider and TQSpinBox. Here are the five main concepts in the class:
\fILine step\fR The smaller of two natural steps that TQRangeControl provides and typically corresponds to the user pressing an arrow key. The line step is returned by lineStep() and set using setSteps(). The functions addLine() and subtractLine() respectively increment and decrement the current value by lineStep().
\fIPage step\fR The larger of two natural steps that TQRangeControl provides and typically corresponds to the user pressing PageUp or PageDown. The page step is returned by pageStep() and set using setSteps(). The functions addPage() and substractPage() respectively increment and decrement the current value by pageStep().
Unity (1) may be viewed as a third step size. setValue() lets you set the current value to any integer in the allowed range, not just minValue() + \fIn\fR * lineStep() for integer values of \fIn\fR. Some widgets may allow the user to set any value at all; others may just provide multiples of lineStep() or pageStep().
TQRangeControl provides three virtual functions that are well suited for updating the on-screen representation of range controls and emitting signals: valueChange(), rangeChange() and stepChange().
We recommend that all widgets that inherit TQRangeControl provide at least a signal called valueChanged(); many widgets will want to provide addStep(), addPage(), substractStep() and substractPage() as slots.
Note that you must use multiple inheritance if you plan to implement a widget using TQRangeControl because TQRangeControl is not derived from TQWidget.
Constructs a range control whose value can never be smaller than \fIminValue\fR or greater than \fImaxValue\fR, whose line step size is \fIlineStep\fR and page step size is \fIpageStep\fR and whose value is initially \fIvalue\fR (which is guaranteed to be in range using bound()).
This function is provided so that you can easily force other numbers than value() into the allowed range. You do not need to call it in order to use TQRangeControl itself.
Sets the range control \fIvalue\fR directly without calling valueChange().
.PP
Forces the new \fIvalue\fR to be within the legal range.
.PP
You will rarely have to call this function. However, if you want to change the range control's value inside the overloaded method valueChange(), setValue() would call the function valueChange() again. To avoid this recursion you must use directSetValue() instead.
Converts \fIlogical_val\fR to a pixel position. minValue() maps to 0, maxValue() maps to \fIspan\fR and other values are distributed evenly in-between.
.PP
This function can handle the entire integer range without overflow, providing \fIspan\fR is <= 4096.
Returns the previous value of the range control. "Previous value" means the value before the last change occurred. Setting a new range may affect the value, too, because the value is forced to be inside the specified range. When the range control is initially created, this is the same as value().
.PP
prevValue() can be outside the current legal range if a call to setRange() causes the current value to change. For example, if the range was [0, 1000] and the current value is 500, setRange(0, 400) makes value() return 400 and prevValue() return 500.
This virtual function is called whenever the range control's range changes. You can reimplement it if you want to be notified when the range changes. The default implementation does nothing.
.PP
Note that this method is called after the range has changed.
.PP
See also setRange(), valueChange(), and stepChange().
Sets the range control's minimum value to \fIminValue\fR and its maximum value to \fImaxValue\fR.
.PP
Calls the virtual rangeChange() function if one or both of the new minimum and maximum values are different from the previous setting. Calls the virtual valueChange() function if the current value is adjusted because it was outside the new range.
.PP
If \fImaxValue\fR is smaller than \fIminValue\fR, \fIminValue\fR becomes the only legal value.
.PP
See also minValue() and maxValue().
.PP
Examples:
.)l listbox/listbox.cpp, t12/lcdrange.cpp, t5/main.cpp, t6/main.cpp, t8/lcdrange.cpp, and xform/xform.cpp.
Sets the range control's value to \fIvalue\fR and forces it to be within the legal range.
.PP
Calls the virtual valueChange() function if the new value is different from the previous value. The old value can still be retrieved using prevValue().
This virtual function is called whenever the range control's line or page step settings change. You can reimplement it if you want to be notified when the step changes. The default implementation does nothing.
.PP
Note that this method is called after a step setting has changed.
.PP
See also setSteps(), rangeChange(), and valueChange().
This virtual function is called whenever the range control value changes. You can reimplement it if you want to be notified when the value changes. The default implementation does nothing.
.PP
Note that this method is called after the value has changed. The previous value can be retrieved using prevValue().
.PP
See also setValue(), addPage(), subtractPage(), addLine(), subtractLine(), rangeChange(), and stepChange().
Converts the pixel position \fIpos\fR to a value. 0 maps to minValue(), \fIspan\fR maps to maxValue() and other values are distributed evenly in-between.
.PP
This function can handle the entire integer range without overflow.
Calling this method is useful if you actually implemented a range control widget such as TQScrollBar and want to handle mouse press events. This function then maps screen coordinates to the logical values.