some cleanup from the last change SVN_SILENT
[kdegraphics.git] / kruler / klineal.h
blob5b951e549befecd41760d21cec8d9d08e2febe67
1 /***************************************************************************
2 klineal.h - description
3 -------------------
4 begin : Fri Oct 13 2000
5 Copyright : (C) 2000 - 2008 by Till Krech <till@snafu.de>
6 (C) 2009 by Mathias Soeken <msoeken@tzi.de>
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
18 #ifndef KLINEAL_H
19 #define KLINEAL_H
21 #include <QWidget>
23 class QAutoSizeLabel;
24 class KMenu;
26 class KLineal : public QWidget {
27 Q_OBJECT
29 public:
30 enum { North = 0, West, South, East };
32 KLineal( QWidget *parent = 0 );
33 ~KLineal();
35 void move( int x, int y );
36 void move( const QPoint &p );
37 QPoint pos();
38 int x();
39 int y();
41 protected:
42 void keyPressEvent( QKeyEvent *e );
43 void mousePressEvent( QMouseEvent *e );
44 void mouseReleaseEvent( QMouseEvent *e );
45 void mouseMoveEvent( QMouseEvent *e );
46 void wheelEvent( QWheelEvent *e );
47 void paintEvent( QPaintEvent *e );
48 void enterEvent( QEvent *e );
49 void leaveEvent( QEvent *e );
51 private:
52 void drawScale( QPainter &painter );
53 void drawBackground( QPainter &painter );
54 void reLength( int percentOfScreen );
55 void updateScaleDirectionMenuItem();
57 bool mDragging;
58 QPoint mLastClickPos;
59 QPoint mDragOffset;
60 QAutoSizeLabel *mLabel;
61 QAutoSizeLabel *mColorLabel;
62 int mOrientation;
63 int mLongEdgeLen;
64 int mShortEdgeLen;
65 KMenu *mMenu;
66 KMenu *mLenMenu;
67 QAction *mFullScreenAction;
68 QAction *mScaleDirectionAction;
69 QAction *mCenterOriginAction;
70 QAction *mOffsetAction;
71 QColor mColor;
72 QCursor mCurrentCursor;
73 QCursor mNorthCursor;
74 QCursor mEastCursor;
75 QCursor mWestCursor;
76 QCursor mSouthCursor;
77 QCursor mDragCursor;
78 QFont mScaleFont;
79 bool mClicked;
80 bool mLeftToRight;
81 int mOffset;
82 bool mRelativeScale;
84 public slots:
85 void setOrientation( int );
86 void setNorth();
87 void setEast();
88 void setSouth();
89 void setWest();
90 void turnLeft();
91 void turnRight();
92 void showMenu();
93 void hideLabel();
94 void showLabel();
95 void adjustLabel();
96 void setShortLength();
97 void setMediumLength();
98 void setTallLength();
99 void setFullLength();
100 void switchDirection();
101 void centerOrigin();
102 void slotOffset();
103 void slotPreferences();
104 void switchRelativeScale( bool checked );
105 void copyColor();
106 void saveSettings();
107 void slotQuit();
109 #endif