libkipi from trunk (KDE 4.3) : add support of kipi host settings "file timestamp...
[kdegraphics.git] / kruler / klineal.h
blobc7502c2ce235fa9dd3faab1819aeb37c11a86de6
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 #include <KColorDialog>
25 class QAutoSizeLabel;
26 class KMenu;
28 class KLineal : public QWidget {
29 Q_OBJECT
31 public:
32 enum { North = 0, West, South, East };
34 KLineal( QWidget *parent = 0 );
35 ~KLineal();
37 void move( int x, int y );
38 void move( const QPoint &p );
39 QPoint pos();
40 int x();
41 int y();
43 protected:
44 void keyPressEvent( QKeyEvent *e );
45 void mousePressEvent( QMouseEvent *e );
46 void mouseReleaseEvent( QMouseEvent *e );
47 void mouseMoveEvent( QMouseEvent *e );
48 void paintEvent( QPaintEvent *e );
49 void enterEvent( QEvent *e );
50 void leaveEvent( QEvent *e );
53 private:
54 void drawScale( QPainter &painter );
55 void drawBackground( QPainter &painter );
56 void reLength( int percentOfScreen );
57 void updateScaleDirectionMenuItem();
59 bool mDragging;
60 QPoint mLastClickPos;
61 QPoint mDragOffset;
62 QAutoSizeLabel *mLabel;
63 QAutoSizeLabel *mColorLabel;
64 int mOrientation;
65 int mLongEdgeLen;
66 int mShortEdgeLen;
67 KMenu *mMenu;
68 KMenu *mLenMenu;
69 QAction *mFullScreenAction;
70 QAction *mScaleDirectionAction;
71 QColor mColor;
72 QColor mStoredColor;
73 QCursor mCurrentCursor;
74 QCursor mNorthCursor;
75 QCursor mEastCursor;
76 QCursor mWestCursor;
77 QCursor mSouthCursor;
78 QCursor mDragCursor;
79 KColorDialog mColorSelector;
80 QFont mScaleFont;
81 bool mClicked;
82 bool mLeftToRight;
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 setColor();
102 void setFont( const QFont &font );
103 void setColor( const QColor &color );
104 void chooseColor();
105 void chooseFont();
106 void restoreColor();
107 void saveSettings();
108 void slotQuit();
110 #endif