compile
[kdegraphics.git] / kruler / klineal.h
blobd37160ca83a2d7e276efd780f07c12750dc96831
1 /***************************************************************************
2 klineal.h - description
3 -------------------
4 begin : Fri Oct 13 2000
5 copyright : (C) 2000 by Till Krech
6 email : till@snafu.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 #include <kcolordialog.h>
25 class QLabel;
26 class KMenu;
28 class KLineal : public QWidget {
29 Q_OBJECT
30 public:
31 enum { North=0, West=1, South=2, East=3 };
32 /** constructor */
33 KLineal(QWidget*parent=0);
34 /** destructor */
35 ~KLineal();
36 void move(int x, int y);
37 void move(const QPoint &p);
38 QPoint pos();
39 int x();
40 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 paintEvent(QPaintEvent *e);
47 void enterEvent(QEvent *e);
48 void leaveEvent(QEvent *e);
51 private:
52 void drawScale(QPainter &painter);
53 void drawBackground(QPainter &painter);
54 void reLength(int percentOfScreen);
55 bool mDragging;
56 QPoint mLastClickPos;
57 QPoint mDragOffset;
58 QLabel *mLabel;
59 QLabel *mColorLabel;
60 int mOrientation;
61 int mLongEdgeLen;
62 int mShortEdgeLen;
63 KMenu *mMenu;
64 KMenu *mLenMenu;
65 QAction *mFullScreenAction;
66 QColor mColor;
67 QColor mStoredColor;
68 QCursor mCurrentCursor;
69 QCursor mNorthCursor;
70 QCursor mEastCursor;
71 QCursor mWestCursor;
72 QCursor mSouthCursor;
73 QCursor mDragCursor;
74 KColorDialog mColorSelector;
75 QFont mScaleFont;
76 bool _clicked;
77 public slots:
78 void setOrientation(int);
79 void setNorth();
80 void setEast();
81 void setSouth();
82 void setWest();
83 void turnLeft();
84 void turnRight();
85 void showMenu();
86 void hideLabel();
87 void showLabel();
88 void adjustLabel();
89 void setShortLength();
90 void setMediumLength();
91 void setTallLength();
92 void setFullLength();
93 void setColor();
94 void setFont(QFont &);
95 void setColor(const QColor &color);
96 void choseColor();
97 void choseFont();
98 void restoreColor();
99 void saveSettings();
100 void slotQuit();
102 #endif