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 
00070 class KRuler : public QFrame
00071 {
00072   Q_OBJECT
00073   Q_PROPERTY( int minValue READ minValue WRITE setMinValue )
00074   Q_PROPERTY( int maxValue READ maxValue WRITE setMaxValue )
00075   Q_PROPERTY( int value READ value WRITE setValue )
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       
00089 public:
00090 
00091 /*
00092 #define KRULER_ROTATE_TEST KRULER_ROTATE_TEST
00093 #undef KRULER_ROTATE_TEST
00094 #ifdef KRULER_ROTATE_TEST
00095   double xtrans, ytrans, rotate;
00096 # warning tmporaer variablen eingeschaltet
00097 #endif
00098 */
00099 
00103   enum MetricStyle { Custom=0, Pixel, Inch, Millimetres, Centimetres, Metres };
00104 
00108     //  enum PaintStyle { Flat, Raised, Sunken };
00109 
00113   KRuler(QWidget *parent=0, const char *name=0);
00128   KRuler(Orientation orient, QWidget *parent=0, const char *name=0, 
00129      WFlags f=0);
00130 
00147   KRuler(Orientation orient, int widgetWidth, QWidget *parent=0, 
00148      const char *name=0, WFlags f=0);
00149 
00153   ~KRuler();
00154 
00162   void setMinValue(int);
00163 
00167   inline int minValue() const;
00168 
00175   void setMaxValue(int);
00176   
00180   inline int maxValue() const;
00181 
00188   void setRange(int min, int max);
00189 
00198   void setValue(int);
00199   inline int value() const;
00200 
00206   void setTinyMarkDistance(int);
00210   inline int tinyMarkDistance() const;
00211 
00217   void setLittleMarkDistance(int);
00218 
00222   inline int littleMarkDistance() const;
00223 
00230   void setMediumMarkDistance(int);
00231   inline int mediumMarkDistance() const;
00232 
00238   void setBigMarkDistance(int);
00242   inline int bigMarkDistance() const;
00243 
00247   void setShowTinyMarks(bool);
00248   bool showTinyMarks() const;
00252   void setShowLittleMarks(bool);
00253   bool showLittleMarks() const;
00257   void setShowMediumMarks(bool);
00258   bool showMediumMarks() const;
00262   void setShowBigMarks(bool);
00263   bool showBigMarks() const;
00267   void setShowEndMarks(bool);
00268   bool showEndMarks() const;
00272   void setShowPointer(bool);
00273   bool showPointer() const;
00274 
00275   //#### KDE4: The next 3 need to go.
00280   void setValuePerLittleMark(int);
00281 
00286   void setValuePerMediumMark(int);
00287 
00292   void setValuePerBigMark(int);
00293 
00299     //  void setShowLittleMarkLabel(bool);
00300 
00306     //  void setShowMediumMarkLabel(bool);
00307 
00313     //  void showBigMarkLabel(bool);
00314 
00320    void setShowEndLabel(bool);
00321    bool showEndLabel() const;
00322 
00327   void setEndLabel(const QString&);
00328   QString endLabel() const;
00329 
00335   void setRulerMetricStyle(KRuler::MetricStyle);
00336 
00355   void setPixelPerMark(double rate);
00356 
00360   inline double pixelPerMark() const;
00361 
00371   void setLength(int);
00372   int length() const;
00373 
00380   void setLengthFixed(bool fix);
00381   bool lengthFixed() const;
00382 
00394   void slideUp(int count = 1);
00395 
00407   void slideDown(int count = 1);
00408 
00417   void setOffset(int offset);
00418 
00422   inline int offset() const;
00423 
00424   int endOffset() const;
00425 
00426 public slots:
00427 
00434   void slotNewValue(int);
00435 
00442   void slotNewOffset(int);
00443 
00444   void slotEndOffset(int);
00445 
00446 protected:
00450   virtual void drawContents(QPainter *);
00451 
00452 private:
00453   void init();
00454 
00455   QRangeControl range;
00456   Orientation dir;
00457   int tmDist;
00458   int lmDist;
00459   int mmDist;
00460   int bmDist;
00461   int offset_;
00462   bool showtm; /* show tiny, little, medium, big, endmarks */
00463   bool showlm;
00464   bool showmm;
00465   bool showbm;
00466   bool showem;
00467   
00468   // #### KDE4 : All value* and show* below should be removed, unused
00469   
00470   int valuelm; /* value per little, medium, big mark */
00471   int valuemm;
00472   int valuebm;
00473   bool showValuelm;
00474   bool showValuemm;
00475   bool showValuebm;
00476   
00477   double ppm; /* pixel per mark */
00478 
00479   QString endlabel;
00480 
00481 protected:
00482   virtual void virtual_hook( int id, void* data );
00483 private:
00484   class KRulerPrivate;
00485   KRulerPrivate *d;
00486 };
00487 
00488 
00489 int
00490 KRuler::minValue() const
00491 { return range.minValue(); }
00492 
00493 int 
00494 KRuler::maxValue() const
00495 { return range.maxValue(); }
00496 
00497 int 
00498 KRuler::value() const
00499 { return range.value(); }
00500 
00501 int 
00502 KRuler::tinyMarkDistance() const
00503 { return tmDist; }
00504 
00505 int 
00506 KRuler::littleMarkDistance() const
00507 { return lmDist; }
00508 
00509 int 
00510 KRuler::mediumMarkDistance() const
00511 { return mmDist; }
00512 
00513 int 
00514 KRuler::bigMarkDistance() const
00515 { return bmDist; }
00516 
00517 double 
00518 KRuler::pixelPerMark() const
00519 { return ppm; }
00520 
00521 int 
00522 KRuler::offset() const
00523 { return offset_; }
00524 
00525 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:21:01 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001