00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef SPINBOX_H
00022 #define SPINBOX_H
00023
00024 #include <tqspinbox.h>
00025
00026
00042 class SpinBox : public TQSpinBox
00043 {
00044 Q_OBJECT
00045
00046 public:
00051 explicit SpinBox(TQWidget* parent = 0, const char* name = 0);
00059 SpinBox(int minValue, int maxValue, int step = 1, TQWidget* parent = 0, const char* name = 0);
00061 bool isReadOnly() const { return mReadOnly; }
00065 virtual void setReadOnly(bool readOnly);
00067 bool selectOnStep() const { return mSelectOnStep; }
00069 void setSelectOnStep(bool sel) { mSelectOnStep = sel; }
00071 void addValue(int change) { addValue(change, false); }
00073 int minValue() const { return mMinValue; }
00075 int maxValue() const { return mMaxValue; }
00077 void setMinValue(int val);
00079 void setMaxValue(int val);
00081 void setRange(int minValue, int maxValue) { setMinValue(minValue); setMaxValue(maxValue); }
00083 int bound(int val) const;
00087 int lineStep() const { return mLineStep; }
00091 void setLineStep(int step);
00095 int lineShiftStep() const { return mLineShiftStep; }
00099 void setLineShiftStep(int step);
00100 public slots:
00102 virtual void stepUp();
00104 virtual void stepDown();
00105 signals:
00110 void stepped(int step);
00111
00112 protected:
00114 virtual void valueChange();
00125 virtual int shiftStepAdjustment(int oldValue, int shiftStep);
00127 virtual bool eventFilter(TQObject*, TQEvent*);
00131 virtual void updateDisplay();
00132
00133 private slots:
00134 void textEdited();
00135 private:
00136 void init();
00137 void addValue(int change, bool current);
00138 int whichButton(const TQPoint&);
00139 bool setShiftStepping(bool, int currentButton);
00140
00141 enum { NO_BUTTON, UP, DOWN };
00142
00143 int mMinValue;
00144 int mMaxValue;
00145 int mLineStep;
00146 int mLineShiftStep;
00147 int mCurrentButton;
00148 bool mShiftMouse;
00149 bool mShiftMinBound;
00150 bool mShiftMaxBound;
00151 bool mSelectOnStep;
00152 bool mReadOnly;
00153 bool mSuppressSignals;
00154 bool mEdited;
00155 };
00156
00157 #endif // SPINBOX_H