Add new test
[kdeaccessibility.git] / kmag / kmagselrect.h
blob0ba6fc19a8bd36b5410373d92e416c151f96de2e
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.h>
27 #include <qwidget.h>
28 #include <qlabel.h>
29 //Added by qt3to4:
30 #include <QMouseEvent>
32 // Min function
33 #define min(a,b) ((a) < (b) ? (a) : (b))
35 class KMagSelWinCorner : public QLabel
37 Q_OBJECT
39 public:
41 KMagSelWinCorner ( QWidget * parent = 0, const char * name = 0, Qt::WFlags f = 0 );
43 virtual ~KMagSelWinCorner();
45 signals:
47 void startResizing ();
48 void resized ( QPoint offset );
50 protected:
52 QPoint oldPos;
54 virtual void mousePressEvent ( QMouseEvent * e );
55 virtual void mouseReleaseEvent ( QMouseEvent * e );
56 virtual void mouseMoveEvent ( QMouseEvent * e );
59 class KMagSelWin : public QWidget
61 Q_OBJECT
63 public:
65 KMagSelWin ( QWidget * parent = 0, const char * name = 0, Qt::WFlags f = 0 );
67 virtual ~KMagSelWin();
69 void setSelRect ( QRect selRect );
70 QRect getSelRect ();
72 public slots:
74 void startResizing ();
75 void titleMoved ( QPoint offset );
76 void topLeftResized ( QPoint offset );
77 void topRightResized ( QPoint offset );
78 void bottomLeftResized ( QPoint offset );
79 void bottomRightResized ( QPoint offset );
81 signals:
83 void resized();
85 protected:
87 QRect oldSelRect;
89 KMagSelWinCorner *titleBar;
90 KMagSelWinCorner *topLeftCorner;
91 KMagSelWinCorner *topRightCorner;
92 KMagSelWinCorner *bottomLeftCorner;
93 KMagSelWinCorner *bottomRightCorner;
96 /**
97 * This class stores the selected rectangular area for grabbing. It also displays the
98 * rectangular area on demand.
100 * @author Original : Michael Forster
101 * @author Current : Sarang Lakare
103 class KMagSelRect : public QObject, public QRect
105 Q_OBJECT
107 public:
108 KMagSelRect(QWidget *parent=0);
109 KMagSelRect(const QPoint &topLeft, const QPoint &bottomRight,
110 QWidget *parent=0);
111 KMagSelRect(const QPoint &topLeft, const QSize &size,
112 QWidget *parent=0);
113 KMagSelRect(int left, int top, int width, int height,
114 QWidget *selWindowParent=0);
116 virtual ~KMagSelRect();
118 bool visible();
120 /// Makes the rectangle always visible
121 void alwaysVisible(bool visible=true);
123 /// Returns true if always visible is set
124 bool getAlwaysVisible() const {
125 return (m_alwaysVisible);
128 public slots:
130 void show();
131 void hide();
132 void update();
134 void selWinResized();
136 protected:
138 void init(QWidget *);
140 QWidget *selWindowParent;
141 KMagSelWin *selectionwindow;
142 bool m_alwaysVisible;
146 void setTitleColors (QColor title, QColor text, QColor titleBtn);
147 void setFrameSize (int size);
149 #endif // KMAGSELRECT_H