1/*
2 * Copyright (C) 1997-2002 Richard J. Moore <rich@kde.org>
3 * Copyright (C) 2000 Matthias Ettrich <ettrich@troll.no>
4 * Copyright (C) 2002 Aaron J. Seigo <aseigo@kde.org>
5 * Copyright (C) 2003 Nadeem Hasan <nhasan@kde.org>
6 * Copyright (C) 2004 Bernd Brandstetter <bbrand@freenet.de>
7 * Copyright (C) 2006 Urs Wolfer <uwolfer @ kde.org>
8 * Copyright (C) 2007 Montel Laurent <montel@kde.org>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 * Boston, MA 02110-1301, USA.
24 */
25
26#ifndef KSNAPSHOTOBJECT_H
27#define KSNAPSHOTOBJECT_H
28
29#include <KUrl>
30#include <QPixmap>
31class QWidget;
32class RegionGrabber;
33class FreeRegionGrabber;
34class QString;
35
36class KSnapshotObject
37{
38public:
39 enum CaptureMode { FullScreen=0, WindowUnderCursor=1, Region=2, FreeRegion=3, ChildWindow=4, CurrentScreen=5 };
40 KSnapshotObject();
41 virtual ~KSnapshotObject();
42
43 bool save( const QString &filename, QWidget* widget = 0);
44 bool save( const KUrl& url, QWidget *widget );
45 bool saveEqual( const KUrl& url,QWidget *widget );
46 bool saveImage( QIODevice *device, const QByteArray &format );
47
48protected:
49 void autoincFilename();
50 virtual void refreshCaption(){}
51
52 void changeUrl(const QString &newUrl);
53
54 KUrl filename;
55 RegionGrabber *rgnGrab;
56 FreeRegionGrabber *freeRgnGrab;
57 QWidget* grabber;
58 QPixmap snapshot;
59 QString title;
60 QString windowClass;
61};
62
63#endif
64