compile
[kdegraphics.git] / ksnapshot / windowgrabber.h
blob08ceeafad0169bf8eca2d8f9529f768c98a316b7
1 /*
2 Copyright (C) 2004 Bernd Brandstetter <bbrand@freenet.de>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or ( at your option ) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this library; see the file COPYING. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
20 #ifndef WINDOWGRABBER_H
21 #define WINDOWGRABBER_H
23 #include <QDialog>
24 #include <vector>
26 class WindowGrabber : public QDialog
28 Q_OBJECT
30 public:
31 WindowGrabber();
32 ~WindowGrabber();
34 static QPixmap grabCurrent( bool includeDecorations = true );
35 static QString lastWindowTitle() { return WindowGrabber::title; }
36 static QString lastWindowClass() { return WindowGrabber::windowClass; }
38 signals:
39 void windowGrabbed( const QPixmap & );
41 protected:
42 void mousePressEvent( QMouseEvent * );
43 void mouseReleaseEvent( QMouseEvent * );
44 void mouseMoveEvent( QMouseEvent * );
45 void wheelEvent( QWheelEvent * );
46 void paintEvent( QPaintEvent * );
48 private:
49 void increaseScope( const QPoint & );
50 void decreaseScope( const QPoint & );
51 int windowIndex( const QPoint & ) const;
52 std::vector<QRect> windows;
53 int current;
54 int yPos;
55 static QString title;
56 static QString windowClass;
59 #endif // WINDOWGRABBER_H