kalarm/lib
spinbox.h00001
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 <qspinbox.h>
00025
00026
00042 class SpinBox : public QSpinBox
00043 {
00044 Q_OBJECT
00045 public:
00050 SpinBox(QWidget* parent = 0, const char* name = 0);
00058 SpinBox(int minValue, int maxValue, int step = 1, QWidget* parent = 0, const char* name = 0);
00060 bool isReadOnly() const { return mReadOnly; }
00064 virtual void setReadOnly(bool readOnly);
00066 bool selectOnStep() const { return mSelectOnStep; }
00068 void setSelectOnStep(bool sel) { mSelectOnStep = sel; }
00070 void addValue(int change) { addValue(change, false); }
00072 int minValue() const { return mMinValue; }
00074 int maxValue() const { return mMaxValue; }
00076 void setMinValue(int val);
00078 void setMaxValue(int val);
00080 void setRange(int minValue, int maxValue) { setMinValue(minValue); setMaxValue(maxValue); }
00082 int bound(int val) const;
00086 int lineStep() const { return mLineStep; }
00090 void setLineStep(int step);
00094 int lineShiftStep() const { return mLineShiftStep; }
00098 void setLineShiftStep(int step);
00099 public slots:
00101 virtual void stepUp();
00103 virtual void stepDown();
00104 signals:
00109 void stepped(int step);
00110
00111 protected:
00113 virtual void valueChange();
00124 virtual int shiftStepAdjustment(int oldValue, int shiftStep);
00126 virtual bool eventFilter(QObject*, QEvent*);
00130 virtual void updateDisplay();
00131
00132 private slots:
00133 void textEdited();
00134 private:
00135 void init();
00136 void addValue(int change, bool current);
00137 int whichButton(const QPoint&);
00138 bool setShiftStepping(bool);
00139
00140 enum { NO_BUTTON, UP, DOWN };
00141
00142 int mMinValue;
00143 int mMaxValue;
00144 int mLineStep;
00145 int mLineShiftStep;
00146 int mCurrentButton;
00147 bool mShiftMouse;
00148 bool mShiftMinBound;
00149 bool mShiftMaxBound;
00150 bool mSelectOnStep;
00151 bool mReadOnly;
00152 bool mSuppressSignals;
00153 bool mEdited;
00154 };
00155
00156 #endif // SPINBOX_H
|