2 * Copyright (C) 2007 Luca Gugelmann <lucag@student.ethz.ch>
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Library General Public License version 2 as
6 * published by the Free Software Foundation
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details
13 * You should have received a copy of the GNU Library General Public
14 * License along with this program; if not, write to the
15 * Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #ifndef REGIONGRABBER_H
20 #define REGIONGRABBER_H
33 class RegionGrabber
: public QWidget
45 void regionGrabbed( const QPixmap
& );
48 void paintEvent( QPaintEvent
* e
);
49 void resizeEvent( QResizeEvent
* e
);
50 void mousePressEvent( QMouseEvent
* e
);
51 void mouseMoveEvent( QMouseEvent
* e
);
52 void mouseReleaseEvent( QMouseEvent
* e
);
53 void mouseDoubleClickEvent( QMouseEvent
* );
54 void keyPressEvent( QKeyEvent
* e
);
56 QRegion
handleMask() const;
57 QPoint
limitPointToRect( const QPoint
&p
, const QRect
&r
) const;
64 QRect
* mouseOverHandle
;
65 QPoint dragStartPoint
;
66 QRect selectionBeforeDrag
;
71 // naming convention for handles
72 // T top, B bottom, R Right, L left
73 // 2 letters: a corner
74 // 1 letter: the handle on the middle of the corresponding side
75 QRect TLHandle
, TRHandle
, BLHandle
, BRHandle
;
76 QRect LHandle
, THandle
, RHandle
, BHandle
;
78 QVector
<QRect
*> handles
;