template <class DataType, class Base, class IncType = DataType>
class WithSpin : public Base

This template adds spin buttons to the Base widget to increment and decrement its value. Base musts be descendant of Ctrl and must have defined methods MinMax(DataType, DataType), GetMin and GetMax. DataType is a type of Value contained in Base, IncType type of increment value.
There two global function templates that can be used to customize increment/decrement process: WithSpin_DefaultIncValue defines the default increment value and WithSpin_Add defines a way how the value is incremented or decremented.
WithSpin& SetInc(IncType _inc = 1)
Sets the increment value.
DataType GetInc() const
Returns current increment value.
WithSpin& OnSides(bool b = true)
Instead of putting both buttons at the right side of widget, puts decrement button to the left and increment to the right.
bool IsOnSides() const
True is OnSides is active.
WithSpin& ShowSpin(bool s = true)
Shows/hides spin buttons.
bool IsSpinVisible() const
Returns true if spin buttons are shown.
WithSpin& RoundFromMin(bool b = true)
If this option is active, increments are rounded with respect to minimum value. E.g. normally (when not active) if minimum value is 3, going up from the minimum goes through values 3, 5, 10, ..., which when RoundFromMin is active, it goes through 3, 8, 13, ...
WithSpin& MouseWheelSpin(bool b = true)
If active, the value can be altered by mouse wheel - rolling the wheel is equivalent to pushing up/down arrows. Default is active.
WithSpin& NoMouseWheelSpin()
Same as MouseWheelSpin(false).
WithSpin& KeySpin(bool b = true)
If active, the value can be altered with Up and Down keys. Default is active.
WithSpin& NoKeySpin()
Same as KeySpin(false).
Predefined WithSpin widgets
|
|
typedef WithSpin<int, EditInt> EditIntSpin
typedef WithSpin<int64, EditInt64> EditInt64Spin
typedef WithSpin<double, EditDouble> EditDoubleSpin
typedef WithSpin<float, EditFloat> EditFloatSpin
typedef WithSpin<Date, EditDate, int> EditDateSpin
typedef WithSpin<Time, EditTime, int> EditTimeSpin
typedef WithSpin<int, EditIntNotNull> EditIntNotNullSpin
typedef WithSpin<int64, EditInt64NotNull> EditInt64NotNullSpin
typedef WithSpin<double, EditDoubleNotNull> EditDoubleNotNullSpin
typedef WithSpin<Date, EditDateNotNull, int> EditDateNotNullSpin
typedef WithSpin<Time, EditTimeNotNull, int> EditTimeNotNullSpin
These typedefs predefine common EditField based value editors with spin buttons.
|