kruler.h
/* -*- c++ -*- */
/* This file is part of the KDE libraries
Copyright (C) 1998 Jörg Habenicht (j.habenicht@europemail.com)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KRULER_H
#define KRULER_H
#include <qframe.h>
#include <qrangecontrol.h>
#include <kdelibs_export.h>
class KDEUI_EXPORT KRuler : public QFrame
{
Q_OBJECT
Q_PROPERTY( int minValue READ minValue WRITE setMinValue )
Q_PROPERTY( int maxValue READ maxValue WRITE setMaxValue )
Q_PROPERTY( int value READ value WRITE setValue )
Q_PROPERTY( bool showTinyMarks READ showTinyMarks WRITE setShowTinyMarks )
Q_PROPERTY( bool showLittleMarks READ showLittleMarks WRITE setShowLittleMarks )
Q_PROPERTY( bool showMediumMarks READ showMediumMarks WRITE setShowMediumMarks )
Q_PROPERTY( bool showBigMarks READ showBigMarks WRITE setShowBigMarks )
Q_PROPERTY( bool showPointer READ showPointer WRITE setShowPointer )
Q_PROPERTY( bool showEndLabel READ showEndLabel WRITE setShowEndLabel )
Q_PROPERTY( int tinyMarkDistance READ tinyMarkDistance WRITE setTinyMarkDistance )
Q_PROPERTY( int littleMarkDistance READ littleMarkDistance WRITE setLittleMarkDistance )
Q_PROPERTY( int mediumMarkDistance READ mediumMarkDistance WRITE setBigMarkDistance )
Q_PROPERTY( int bigMarkDistance READ bigMarkDistance WRITE setBigMarkDistance )
Q_PROPERTY( double pixelPerMark READ pixelPerMark WRITE setPixelPerMark )
Q_PROPERTY( bool lengthFixed READ lengthFixed WRITE setLengthFixed )
public:
/*
#define KRULER_ROTATE_TEST KRULER_ROTATE_TEST
#undef KRULER_ROTATE_TEST
#ifdef KRULER_ROTATE_TEST
double xtrans, ytrans, rotate;
# warning tmporaer variablen eingeschaltet
#endif
*/
enum MetricStyle { Custom=0, Pixel, Inch, Millimetres, Centimetres, Metres };
// enum PaintStyle { Flat, Raised, Sunken };
KRuler(QWidget *parent=0, const char *name=0);
KRuler(Orientation orient, QWidget *parent=0, const char *name=0,
WFlags f=0);
KRuler(Orientation orient, int widgetWidth, QWidget *parent=0,
const char *name=0, WFlags f=0);
~KRuler();
void setMinValue(int);
inline int minValue() const;
void setMaxValue(int);
inline int maxValue() const;
void setRange(int min, int max);
void setValue(int);
inline int value() const;
void setTinyMarkDistance(int);
inline int tinyMarkDistance() const;
void setLittleMarkDistance(int);
inline int littleMarkDistance() const;
void setMediumMarkDistance(int);
inline int mediumMarkDistance() const;
void setBigMarkDistance(int);
inline int bigMarkDistance() const;
void setShowTinyMarks(bool);
bool showTinyMarks() const;
void setShowLittleMarks(bool);
bool showLittleMarks() const;
void setShowMediumMarks(bool);
bool showMediumMarks() const;
void setShowBigMarks(bool);
bool showBigMarks() const;
void setShowEndMarks(bool);
bool showEndMarks() const;
void setShowPointer(bool);
bool showPointer() const;
//#### KDE4: The next 3 need to go.
void setValuePerLittleMark(int) KDE_DEPRECATED;
void setValuePerMediumMark(int) KDE_DEPRECATED;
void setValuePerBigMark(int) KDE_DEPRECATED;
// void setShowLittleMarkLabel(bool);
// void setShowMediumMarkLabel(bool);
// void showBigMarkLabel(bool);
void setShowEndLabel(bool);
bool showEndLabel() const;
void setEndLabel(const QString&);
QString endLabel() const;
void setRulerMetricStyle(KRuler::MetricStyle);
void setPixelPerMark(double rate);
inline double pixelPerMark() const;
void setLength(int);
int length() const;
void setLengthFixed(bool fix);
bool lengthFixed() const;
void slideUp(int count = 1);
void slideDown(int count = 1);
void setOffset(int offset);
inline int offset() const;
int endOffset() const;
public slots:
void slotNewValue(int);
void slotNewOffset(int);
void slotEndOffset(int);
protected:
virtual void drawContents(QPainter *);
private:
void init();
QRangeControl range;
Orientation dir;
int tmDist;
int lmDist;
int mmDist;
int bmDist;
int offset_;
bool showtm; /* show tiny, little, medium, big, endmarks */
bool showlm;
bool showmm;
bool showbm;
bool showem;
// #### KDE4 : All value* and show* below should be removed, unused
int valuelm; /* value per little, medium, big mark */
int valuemm;
int valuebm;
bool showValuelm;
bool showValuemm;
bool showValuebm;
double ppm; /* pixel per mark */
QString endlabel;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KRulerPrivate;
KRulerPrivate *d;
};
int
KRuler::minValue() const
{ return range.minValue(); }
int
KRuler::maxValue() const
{ return range.maxValue(); }
int
KRuler::value() const
{ return range.value(); }
int
KRuler::tinyMarkDistance() const
{ return tmDist; }
int
KRuler::littleMarkDistance() const
{ return lmDist; }
int
KRuler::mediumMarkDistance() const
{ return mmDist; }
int
KRuler::bigMarkDistance() const
{ return bmDist; }
double
KRuler::pixelPerMark() const
{ return ppm; }
int
KRuler::offset() const
{ return offset_; }
#endif
KRuler::maxValue
int maxValue() const
Returns the maximal value of the ruler pointer.
KRuler::pixelPerMark
double pixelPerMark() const
Returns the number of pixels between two base marks.
KRuler::tinyMarkDistance
int tinyMarkDistance() const
Returns the distance between tiny marks.
KRuler::littleMarkDistance
int littleMarkDistance() const
Returns the distance between little marks.
KRuler
A ruler widget.
Definition: kruler.h:71
KRuler::bigMarkDistance
int bigMarkDistance() const
Returns the distance between big marks.
KRuler::offset
int offset() const
Returns the current ruler offset.
Definition: kruler.h:518
KRuler::MetricStyle
MetricStyle
The types of units used.
Definition: kruler.h:104

KDE Home | KDE Accessibility Home | Description of Access Keys