Use qobject_cast fix crash when we load KRegExpEditorInterface
[kdeaccessibility.git] / kmag / kmagselrect.h
blob1fffeedbb56ed321a18ab5ea904ed322b9ee8497
1 /***************************************************************************
2 kmagselrect.h - description
3 -------------------
4 begin : Mon Feb 12 23:45:41 EST 2001
5 copyright : (C) 2001-2003 by Sarang Lakare
6 email : sarang#users.sf.net
7 copyright : (C) 2003-2004 by Olaf Schmidt
8 email : ojschmidt@kde.org
9 ***************************************************************************/
11 /***************************************************************************
12 * *
13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. *
17 * *
18 ***************************************************************************/
20 #ifndef KMAGSELRECT_H
21 #define KMAGSELRECT_H
23 #include <stdlib.h>
25 // Qt includes
26 #include <QRect>
27 #include <qwidget.h>
28 #include <QLabel>
29 //Added by qt3to4:
30 #include <QMouseEvent>
32 class KMagSelWinCorner : public QLabel
34 Q_OBJECT
36 public:
38 KMagSelWinCorner ( QWidget * parent = 0, Qt::WFlags f = 0 );
40 virtual ~KMagSelWinCorner();
42 signals:
44 void startResizing ();
45 void resized ( QPoint offset );
47 protected:
49 QPoint oldPos;
51 virtual void mousePressEvent ( QMouseEvent * e );
52 virtual void mouseReleaseEvent ( QMouseEvent * e );
53 virtual void mouseMoveEvent ( QMouseEvent * e );
56 class KMagSelWin : public QWidget
58 Q_OBJECT
60 public:
62 KMagSelWin ( QWidget * parent = 0, Qt::WFlags f = 0 );
64 virtual ~KMagSelWin();
66 void setSelRect ( QRect selRect );
67 QRect getSelRect ();
69 public slots:
71 void startResizing ();
72 void titleMoved ( QPoint offset );
73 void topLeftResized ( QPoint offset );
74 void topRightResized ( QPoint offset );
75 void bottomLeftResized ( QPoint offset );
76 void bottomRightResized ( QPoint offset );
78 signals:
80 void resized();
82 protected:
84 QRect oldSelRect;
86 KMagSelWinCorner *titleBar;
87 KMagSelWinCorner *topLeftCorner;
88 KMagSelWinCorner *topRightCorner;
89 KMagSelWinCorner *bottomLeftCorner;
90 KMagSelWinCorner *bottomRightCorner;
93 /**
94 * This class stores the selected rectangular area for grabbing. It also displays the
95 * rectangular area on demand.
97 * @author Original : Michael Forster
98 * @author Current : Sarang Lakare
100 class KMagSelRect : public QObject, public QRect
102 Q_OBJECT
104 public:
105 KMagSelRect(QWidget *parent=0);
106 KMagSelRect(const QPoint &topLeft, const QPoint &bottomRight,
107 QWidget *parent=0);
108 KMagSelRect(const QPoint &topLeft, const QSize &size,
109 QWidget *parent=0);
110 KMagSelRect(int left, int top, int width, int height,
111 QWidget *selWindowParent=0);
113 virtual ~KMagSelRect();
115 bool visible();
117 /// Makes the rectangle always visible
118 void alwaysVisible(bool visible=true);
120 /// Returns true if always visible is set
121 bool getAlwaysVisible() const {
122 return (m_alwaysVisible);
125 public slots:
127 void show();
128 void hide();
129 void update();
131 void selWinResized();
133 protected:
135 void init(QWidget *);
137 QWidget *selWindowParent;
138 KMagSelWin *selectionwindow;
139 bool m_alwaysVisible;
143 void setTitleColors (QColor title, QColor text, QColor titleBtn);
144 void setFrameSize (int size);
146 #endif // KMAGSELRECT_H