typo
[kdegraphics.git] / kruler / klineal.h
bloba37dbd7614023ec302c71db79df79d38008175f7
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 QToolButton;
26 class KAction;
27 class KActionCollection;
28 class KIcon;
29 class KMenu;
30 class KRulerSystemTray;
32 class KLineal : public QWidget {
33 Q_OBJECT
35 public:
36 enum { North = 0, West, South, East };
38 KLineal( QWidget *parent = 0 );
39 ~KLineal();
41 void move( int x, int y );
42 void move( const QPoint &p );
43 QPoint pos() const;
44 int x() const;
45 int y() const;
47 protected:
48 void keyPressEvent( QKeyEvent *e );
49 void mousePressEvent( QMouseEvent *e );
50 void mouseReleaseEvent( QMouseEvent *e );
51 void mouseMoveEvent( QMouseEvent *e );
52 void wheelEvent( QWheelEvent *e );
53 void paintEvent( QPaintEvent *e );
54 void enterEvent( QEvent *e );
55 void leaveEvent( QEvent *e );
57 void createSystemTray();
59 private:
60 KAction* addAction( KMenu *menu, KIcon icon, const QString& text,
61 const QObject* receiver, const char* member,
62 const QKeySequence &shortcut, const QString& name );
63 void drawScale( QPainter &painter );
64 void drawBackground( QPainter &painter );
65 void reLength( int percentOfScreen );
66 void reLengthAbsolute( int length );
67 void updateScaleDirectionMenuItem();
69 bool mDragging;
70 QPoint mLastClickPos;
71 QPoint mDragOffset;
72 QAutoSizeLabel *mLabel;
73 QAutoSizeLabel *mColorLabel;
74 int mOrientation;
75 int mLongEdgeLen;
76 int mShortEdgeLen;
77 KMenu *mMenu;
78 KMenu *mLenMenu;
79 QAction *mFullScreenAction;
80 QAction *mScaleDirectionAction;
81 QAction *mCenterOriginAction;
82 QAction *mOffsetAction;
83 QColor mColor;
84 QCursor mCurrentCursor;
85 QCursor mNorthCursor;
86 QCursor mEastCursor;
87 QCursor mWestCursor;
88 QCursor mSouthCursor;
89 QCursor mDragCursor;
90 QFont mScaleFont;
91 bool mClicked;
92 bool mLeftToRight;
93 int mOffset;
94 bool mRelativeScale;
95 KActionCollection *mActionCollection;
96 int mOpacity;
97 QToolButton *mBtnRotateLeft, *mBtnRotateRight;
98 QToolButton *mCloseButton;
99 KRulerSystemTray *mTrayIcon;
101 public slots:
102 void setOrientation( int );
103 void setNorth();
104 void setEast();
105 void setSouth();
106 void setWest();
107 void turnLeft();
108 void turnRight();
109 void showMenu();
110 void hideLabel();
111 void showLabel();
112 void adjustLabel();
113 void adjustButtons();
114 void setShortLength();
115 void setMediumLength();
116 void setTallLength();
117 void setFullLength();
118 void switchDirection();
119 void centerOrigin();
120 void slotOffset();
121 void slotLength();
122 void slotOpacity( int value );
123 void slotKeyBindings();
124 void slotPreferences();
125 void switchRelativeScale( bool checked );
126 void copyColor();
127 void saveSettings();
128 void slotClose();
129 void slotQuit();
130 void loadConfig();
132 #endif