KDEUI
kruler.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */ 00002 /* This file is part of the KDE libraries 00003 Copyright (C) 1998 Jörg Habenicht (j.habenicht@europemail.com) 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef KRULER_H 00022 #define KRULER_H 00023 00024 #include <kdeui_export.h> 00025 00026 #include <QtGui/QAbstractSlider> 00027 00073 class KDEUI_EXPORT KRuler : public QAbstractSlider 00074 { 00075 Q_OBJECT 00076 Q_PROPERTY( bool showTinyMarks READ showTinyMarks WRITE setShowTinyMarks ) 00077 Q_PROPERTY( bool showLittleMarks READ showLittleMarks WRITE setShowLittleMarks ) 00078 Q_PROPERTY( bool showMediumMarks READ showMediumMarks WRITE setShowMediumMarks ) 00079 Q_PROPERTY( bool showBigMarks READ showBigMarks WRITE setShowBigMarks ) 00080 Q_PROPERTY( bool showPointer READ showPointer WRITE setShowPointer ) 00081 Q_PROPERTY( bool showEndLabel READ showEndLabel WRITE setShowEndLabel ) 00082 Q_PROPERTY( int tinyMarkDistance READ tinyMarkDistance WRITE setTinyMarkDistance ) 00083 Q_PROPERTY( int littleMarkDistance READ littleMarkDistance WRITE setLittleMarkDistance ) 00084 Q_PROPERTY( int mediumMarkDistance READ mediumMarkDistance WRITE setBigMarkDistance ) 00085 Q_PROPERTY( int bigMarkDistance READ bigMarkDistance WRITE setBigMarkDistance ) 00086 Q_PROPERTY( double pixelPerMark READ pixelPerMark WRITE setPixelPerMark ) 00087 Q_PROPERTY( bool lengthFixed READ lengthFixed WRITE setLengthFixed ) 00088 Q_PROPERTY( QString endLabel READ endLabel WRITE setEndLabel ) 00089 Q_ENUMS( MetricStyle ) 00090 Q_PROPERTY( int length READ length WRITE setLength ) 00091 Q_PROPERTY( int offset READ offset ) 00092 Q_PROPERTY( int endOffset READ endOffset ) 00093 00094 public: 00095 00096 /* 00097 #define KRULER_ROTATE_TEST KRULER_ROTATE_TEST 00098 #undef KRULER_ROTATE_TEST 00099 #ifdef KRULER_ROTATE_TEST 00100 double xtrans, ytrans, rotate; 00101 # warning tmporaer variablen eingeschaltet 00102 #endif 00103 */ 00104 00108 enum MetricStyle { Custom=0, Pixel, Inch, Millimetres, Centimetres, Metres }; 00109 00113 // enum PaintStyle { Flat, Raised, Sunken }; 00114 00118 explicit KRuler(QWidget *parent=0); 00131 explicit KRuler(Qt::Orientation orient, QWidget *parent=0, Qt::WFlags f=0); 00132 00147 KRuler(Qt::Orientation orient, int widgetWidth, QWidget *parent=0, 00148 Qt::WFlags f=0); 00149 00153 ~KRuler(); 00154 00162 #ifndef KDE_NO_DEPRECATED 00163 KDE_DEPRECATED void setMinValue(int); 00164 #endif 00165 00169 #ifndef KDE_NO_DEPRECATED 00170 KDE_DEPRECATED int minValue() const; 00171 #endif 00172 00179 #ifndef KDE_NO_DEPRECATED 00180 KDE_DEPRECATED void setMaxValue(int); 00181 #endif 00182 00186 #ifndef KDE_NO_DEPRECATED 00187 KDE_DEPRECATED int maxValue() const; 00188 #endif 00189 00190 00196 void setTinyMarkDistance(int); 00200 int tinyMarkDistance() const; 00201 00207 void setLittleMarkDistance(int); 00208 00212 int littleMarkDistance() const; 00213 00220 void setMediumMarkDistance(int); 00221 int mediumMarkDistance() const; 00222 00228 void setBigMarkDistance(int); 00232 int bigMarkDistance() const; 00233 00237 void setShowTinyMarks(bool); 00238 bool showTinyMarks() const; 00242 void setShowLittleMarks(bool); 00243 bool showLittleMarks() const; 00247 void setShowMediumMarks(bool); 00248 bool showMediumMarks() const; 00252 void setShowBigMarks(bool); 00253 bool showBigMarks() const; 00257 void setShowEndMarks(bool); 00258 bool showEndMarks() const; 00262 void setShowPointer(bool); 00263 bool showPointer() const; 00264 00265 00266 void setFrameStyle(int); 00267 00273 // void setShowLittleMarkLabel(bool); 00274 00280 // void setShowMediumMarkLabel(bool); 00281 00287 // void showBigMarkLabel(bool); 00288 00294 void setShowEndLabel(bool); 00295 bool showEndLabel() const; 00296 00301 void setEndLabel(const QString&); 00302 QString endLabel() const; 00303 00309 void setRulerMetricStyle(KRuler::MetricStyle); 00310 00329 void setPixelPerMark(double rate); 00330 00334 double pixelPerMark() const; 00335 00345 void setLength(int); 00346 int length() const; 00347 00354 void setLengthFixed(bool fix); 00355 bool lengthFixed() const; 00356 00368 void slideUp(int count = 1); 00369 00381 void slideDown(int count = 1); 00382 00391 void setOffset(int offset); 00392 00396 int offset() const; 00397 00398 int endOffset() const; 00399 00400 public Q_SLOTS: 00401 00408 void slotNewValue(int); 00409 00416 void slotNewOffset(int); 00417 00418 void slotEndOffset(int); 00419 00420 protected: 00421 virtual void paintEvent(QPaintEvent *); 00422 00423 private: 00424 void init(Qt::Orientation orientation); 00425 00426 private: 00427 class KRulerPrivate; 00428 KRulerPrivate * const d; 00429 }; 00430 00431 #endif
KDE 4.6 API Reference