kdeui
kruler.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KRULER_H
00022 #define KRULER_H
00023
00024 #include <qframe.h>
00025 #include <qrangecontrol.h>
00026 #include <kdelibs_export.h>
00027
00071 class KDEUI_EXPORT KRuler : public QFrame
00072 {
00073 Q_OBJECT
00074 Q_PROPERTY( int minValue READ minValue WRITE setMinValue )
00075 Q_PROPERTY( int maxValue READ maxValue WRITE setMaxValue )
00076 Q_PROPERTY( int value READ value WRITE setValue )
00077 Q_PROPERTY( bool showTinyMarks READ showTinyMarks WRITE setShowTinyMarks )
00078 Q_PROPERTY( bool showLittleMarks READ showLittleMarks WRITE setShowLittleMarks )
00079 Q_PROPERTY( bool showMediumMarks READ showMediumMarks WRITE setShowMediumMarks )
00080 Q_PROPERTY( bool showBigMarks READ showBigMarks WRITE setShowBigMarks )
00081 Q_PROPERTY( bool showPointer READ showPointer WRITE setShowPointer )
00082 Q_PROPERTY( bool showEndLabel READ showEndLabel WRITE setShowEndLabel )
00083 Q_PROPERTY( int tinyMarkDistance READ tinyMarkDistance WRITE setTinyMarkDistance )
00084 Q_PROPERTY( int littleMarkDistance READ littleMarkDistance WRITE setLittleMarkDistance )
00085 Q_PROPERTY( int mediumMarkDistance READ mediumMarkDistance WRITE setBigMarkDistance )
00086 Q_PROPERTY( int bigMarkDistance READ bigMarkDistance WRITE setBigMarkDistance )
00087 Q_PROPERTY( double pixelPerMark READ pixelPerMark WRITE setPixelPerMark )
00088 Q_PROPERTY( bool lengthFixed READ lengthFixed WRITE setLengthFixed )
00089
00090 public:
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00104 enum MetricStyle { Custom=0, Pixel, Inch, Millimetres, Centimetres, Metres };
00105
00109
00110
00114 KRuler(QWidget *parent=0, const char *name=0);
00128 KRuler(Orientation orient, QWidget *parent=0, const char *name=0,
00129 WFlags f=0);
00130
00146 KRuler(Orientation orient, int widgetWidth, QWidget *parent=0,
00147 const char *name=0, WFlags f=0);
00148
00152 ~KRuler();
00153
00161 void setMinValue(int);
00162
00166 inline int minValue() const;
00167
00174 void setMaxValue(int);
00175
00179 inline int maxValue() const;
00180
00187 void setRange(int min, int max);
00188
00197 void setValue(int);
00198 inline int value() const;
00199
00205 void setTinyMarkDistance(int);
00209 inline int tinyMarkDistance() const;
00210
00216 void setLittleMarkDistance(int);
00217
00221 inline int littleMarkDistance() const;
00222
00229 void setMediumMarkDistance(int);
00230 inline int mediumMarkDistance() const;
00231
00237 void setBigMarkDistance(int);
00241 inline int bigMarkDistance() const;
00242
00246 void setShowTinyMarks(bool);
00247 bool showTinyMarks() const;
00251 void setShowLittleMarks(bool);
00252 bool showLittleMarks() const;
00256 void setShowMediumMarks(bool);
00257 bool showMediumMarks() const;
00261 void setShowBigMarks(bool);
00262 bool showBigMarks() const;
00266 void setShowEndMarks(bool);
00267 bool showEndMarks() const;
00271 void setShowPointer(bool);
00272 bool showPointer() const;
00273
00274
00279 void setValuePerLittleMark(int) KDE_DEPRECATED;
00280
00285 void setValuePerMediumMark(int) KDE_DEPRECATED;
00286
00291 void setValuePerBigMark(int) KDE_DEPRECATED;
00292
00298
00299
00305
00306
00312
00313
00319 void setShowEndLabel(bool);
00320 bool showEndLabel() const;
00321
00326 void setEndLabel(const QString&);
00327 QString endLabel() const;
00328
00334 void setRulerMetricStyle(KRuler::MetricStyle);
00335
00354 void setPixelPerMark(double rate);
00355
00359 inline double pixelPerMark() const;
00360
00370 void setLength(int);
00371 int length() const;
00372
00379 void setLengthFixed(bool fix);
00380 bool lengthFixed() const;
00381
00393 void slideUp(int count = 1);
00394
00406 void slideDown(int count = 1);
00407
00416 void setOffset(int offset);
00417
00421 inline int offset() const;
00422
00423 int endOffset() const;
00424
00425 public slots:
00426
00433 void slotNewValue(int);
00434
00441 void slotNewOffset(int);
00442
00443 void slotEndOffset(int);
00444
00445 protected:
00446 virtual void drawContents(QPainter *);
00447
00448 private:
00449 void init();
00450
00451 QRangeControl range;
00452 Orientation dir;
00453 int tmDist;
00454 int lmDist;
00455 int mmDist;
00456 int bmDist;
00457 int offset_;
00458 bool showtm;
00459 bool showlm;
00460 bool showmm;
00461 bool showbm;
00462 bool showem;
00463
00464
00465
00466 int valuelm;
00467 int valuemm;
00468 int valuebm;
00469 bool showValuelm;
00470 bool showValuemm;
00471 bool showValuebm;
00472
00473 double ppm;
00474
00475 QString endlabel;
00476
00477 protected:
00478 virtual void virtual_hook( int id, void* data );
00479 private:
00480 class KRulerPrivate;
00481 KRulerPrivate *d;
00482 };
00483
00484
00485 int
00486 KRuler::minValue() const
00487 { return range.minValue(); }
00488
00489 int
00490 KRuler::maxValue() const
00491 { return range.maxValue(); }
00492
00493 int
00494 KRuler::value() const
00495 { return range.value(); }
00496
00497 int
00498 KRuler::tinyMarkDistance() const
00499 { return tmDist; }
00500
00501 int
00502 KRuler::littleMarkDistance() const
00503 { return lmDist; }
00504
00505 int
00506 KRuler::mediumMarkDistance() const
00507 { return mmDist; }
00508
00509 int
00510 KRuler::bigMarkDistance() const
00511 { return bmDist; }
00512
00513 double
00514 KRuler::pixelPerMark() const
00515 { return ppm; }
00516
00517 int
00518 KRuler::offset() const
00519 { return offset_; }
00520
00521 #endif