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