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>
32 class KMagSelWinCorner
: public QLabel
38 KMagSelWinCorner ( QWidget
* parent
= 0, Qt::WFlags f
= 0 );
40 virtual ~KMagSelWinCorner();
44 void startResizing ();
45 void resized ( QPoint offset
);
51 virtual void mousePressEvent ( QMouseEvent
* e
);
52 virtual void mouseReleaseEvent ( QMouseEvent
* e
);
53 virtual void mouseMoveEvent ( QMouseEvent
* e
);
56 class KMagSelWin
: public QWidget
62 KMagSelWin ( QWidget
* parent
= 0, Qt::WFlags f
= 0 );
64 virtual ~KMagSelWin();
66 void setSelRect ( QRect selRect
);
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
);
86 KMagSelWinCorner
*titleBar
;
87 KMagSelWinCorner
*topLeftCorner
;
88 KMagSelWinCorner
*topRightCorner
;
89 KMagSelWinCorner
*bottomLeftCorner
;
90 KMagSelWinCorner
*bottomRightCorner
;
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
105 KMagSelRect(QWidget
*parent
=0);
106 KMagSelRect(const QPoint
&topLeft
, const QPoint
&bottomRight
,
108 KMagSelRect(const QPoint
&topLeft
, const QSize
&size
,
110 KMagSelRect(int left
, int top
, int width
, int height
,
111 QWidget
*selWindowParent
=0);
113 virtual ~KMagSelRect();
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
);
131 void selWinResized();
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