1 /***************************************************************************
2 kmagselrect.h - description
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 /***************************************************************************
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. *
18 ***************************************************************************/
30 #include <QMouseEvent>
33 #define min(a,b) ((a) < (b) ? (a) : (b))
35 class KMagSelWinCorner
: public QLabel
41 KMagSelWinCorner ( QWidget
* parent
= 0, const char * name
= 0, Qt::WFlags f
= 0 );
43 virtual ~KMagSelWinCorner();
47 void startResizing ();
48 void resized ( QPoint offset
);
54 virtual void mousePressEvent ( QMouseEvent
* e
);
55 virtual void mouseReleaseEvent ( QMouseEvent
* e
);
56 virtual void mouseMoveEvent ( QMouseEvent
* e
);
59 class KMagSelWin
: public QWidget
65 KMagSelWin ( QWidget
* parent
= 0, const char * name
= 0, Qt::WFlags f
= 0 );
67 virtual ~KMagSelWin();
69 void setSelRect ( QRect selRect
);
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
);
89 KMagSelWinCorner
*titleBar
;
90 KMagSelWinCorner
*topLeftCorner
;
91 KMagSelWinCorner
*topRightCorner
;
92 KMagSelWinCorner
*bottomLeftCorner
;
93 KMagSelWinCorner
*bottomRightCorner
;
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
108 KMagSelRect(QWidget
*parent
=0);
109 KMagSelRect(const QPoint
&topLeft
, const QPoint
&bottomRight
,
111 KMagSelRect(const QPoint
&topLeft
, const QSize
&size
,
113 KMagSelRect(int left
, int top
, int width
, int height
,
114 QWidget
*selWindowParent
=0);
116 virtual ~KMagSelRect();
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
);
134 void selWinResized();
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