kdeui Library API Documentation

kruler.h

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., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, USA. 00019 */ 00020 00021 #ifndef KRULER_H 00022 #define KRULER_H 00023 00024 #include <qframe.h> 00025 #include <qrangecontrol.h> 00026 #include <kdemacros.h> 00027 00071 class 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 #define KRULER_ROTATE_TEST KRULER_ROTATE_TEST 00094 #undef KRULER_ROTATE_TEST 00095 #ifdef KRULER_ROTATE_TEST 00096 double xtrans, ytrans, rotate; 00097 # warning tmporaer variablen eingeschaltet 00098 #endif 00099 */ 00100 00104 enum MetricStyle { Custom=0, Pixel, Inch, Millimetres, Centimetres, Metres }; 00105 00109 // enum PaintStyle { Flat, Raised, Sunken }; 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 //#### KDE4: The next 3 need to go. 00279 void setValuePerLittleMark(int) KDE_DEPRECATED; 00280 00285 void setValuePerMediumMark(int) KDE_DEPRECATED; 00286 00291 void setValuePerBigMark(int) KDE_DEPRECATED; 00292 00298 // void setShowLittleMarkLabel(bool); 00299 00305 // void setShowMediumMarkLabel(bool); 00306 00312 // void showBigMarkLabel(bool); 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; /* show tiny, little, medium, big, endmarks */ 00459 bool showlm; 00460 bool showmm; 00461 bool showbm; 00462 bool showem; 00463 00464 // #### KDE4 : All value* and show* below should be removed, unused 00465 00466 int valuelm; /* value per little, medium, big mark */ 00467 int valuemm; 00468 int valuebm; 00469 bool showValuelm; 00470 bool showValuemm; 00471 bool showValuebm; 00472 00473 double ppm; /* pixel per mark */ 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
KDE Logo
This file is part of the documentation for kdeui Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Sep 29 09:40:34 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003