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 ***************************************************************************/
26 #include <QtCore/QRect>
27 #include <QtGui/QWidget>
28 #include <QtGui/QLabel>
29 #include <QtGui/QMouseEvent>
31 class KMagSelWinCorner
: public QLabel
37 explicit KMagSelWinCorner ( QWidget
* parent
= 0, Qt::WFlags f
= 0 );
39 virtual ~KMagSelWinCorner();
43 void startResizing ();
44 void resized ( QPoint offset
);
50 virtual void mousePressEvent ( QMouseEvent
* e
);
51 virtual void mouseReleaseEvent ( QMouseEvent
* e
);
52 virtual void mouseMoveEvent ( QMouseEvent
* e
);
55 class KMagSelWin
: public QWidget
61 explicit KMagSelWin ( QWidget
* parent
= 0, Qt::WFlags f
= 0 );
63 virtual ~KMagSelWin();
65 void setSelRect ( const QRect
& selRect
);
70 void startResizing ();
71 void titleMoved ( const QPoint
& offset
);
72 void topLeftResized ( const QPoint
& offset
);
73 void topRightResized ( const QPoint
& offset
);
74 void bottomLeftResized ( const QPoint
& offset
);
75 void bottomRightResized ( const QPoint
& offset
);
85 KMagSelWinCorner
*titleBar
;
86 KMagSelWinCorner
*topLeftCorner
;
87 KMagSelWinCorner
*topRightCorner
;
88 KMagSelWinCorner
*bottomLeftCorner
;
89 KMagSelWinCorner
*bottomRightCorner
;
93 * This class stores the selected rectangular area for grabbing. It also displays the
94 * rectangular area on demand.
96 * @author Original : Michael Forster
97 * @author Current : Sarang Lakare
99 class KMagSelRect
: public QObject
, public QRect
104 KMagSelRect(QWidget
*parent
=0);
105 KMagSelRect(const QPoint
&topLeft
, const QPoint
&bottomRight
,
107 KMagSelRect(const QPoint
&topLeft
, const QSize
&size
,
109 KMagSelRect(int left
, int top
, int width
, int height
,
110 QWidget
*selWindowParent
=0);
112 virtual ~KMagSelRect();
116 /// Makes the rectangle always visible
117 void alwaysVisible(bool visible
=true);
119 /// Returns true if always visible is set
120 bool getAlwaysVisible() const {
121 return (m_alwaysVisible
);
130 void selWinResized();
134 void init(QWidget
*);
136 QWidget
*selWindowParent
;
137 KMagSelWin
*selectionwindow
;
138 bool m_alwaysVisible
;
142 void setTitleColors (const QColor
& title
, const QColor
& text
, const QColor
& titleBtn
);
143 void setFrameSize (int size
);
145 #endif // KMAGSELRECT_H