subtraction of already painted area: be fool and
[kdelibs.git] / kdeui / kpixmapregionselectordialog.h
bloba848b78841c391b40ac14439b38da15f1f64b143
1 /* This file is part of the KDE libraries
2 Copyright (C) 2004 Antonio Larrosa <larrosa@kde.org
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library 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 library 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 Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
17 Boston, MA 02110-1301, USA.
20 #ifndef __KPIXMAPREGIONSELECTORDIALOG_H__
21 #define __KPIXMAPREGIONSELECTORDIALOG_H__
23 #include <qimage.h>
25 #include <kdialogbase.h>
26 #include <kpixmapregionselectorwidget.h>
28 /**
29 * A dialog that uses a KPixmapRegionSelectorWidget to allow the user
30 * to select a region of an image. If you want to use special features
31 * like forcing the selected area to have a fixed aspect ratio, you can use
32 * @see pixmapRegionSelectorWidget() to get the pointer to the
33 * KPixmapRegionSelectorWidget object and set the desired options there.
35 * There are some convenience methods that allow to easily show a dialog
36 * for the user to select a region of an image, and just care about the selected
37 * image.
39 * @author Antonio Larrosa <larrosa@kde.org>
40 * @since 3.4
41 */
42 class KDEUI_EXPORT KPixmapRegionSelectorDialog : public KDialogBase
44 public:
45 /**
46 * The constructor of an empty KPixmapRegionSelectorDialog, you have to call
47 * later the setPixmap method of the KPixmapRegionSelectorWidget widget of
48 * the new object.
50 KPixmapRegionSelectorDialog(QWidget *parent=0L, const char *name=0L,
51 bool modal = false );
52 /**
53 * The destructor of the dialog
55 ~KPixmapRegionSelectorDialog();
57 /**
58 * @returns the KPixmapRegionSelectorWidget widget so that additional
59 * parameters can be set by using it.
61 KPixmapRegionSelectorWidget *pixmapRegionSelectorWidget() const
62 { return m_pixmapSelectorWidget; };
64 /**
65 * Creates a modal dialog, lets the user to select a region of the @p pixmap
66 * and returns when the dialog is closed.
68 * @returns the selected rectangle, or an invalid rectangle if the user
69 * pressed the Cancel button.
71 static QRect getSelectedRegion(const QPixmap &pixmap, QWidget *parent = 0L );
73 /**
74 * Creates a modal dialog, lets the user to select a region of the @p pixmap
75 * with the same aspect ratio than @p aspectRatioWidth x @p aspectRatioHeight
76 * and returns when the dialog is closed.
78 * @returns the selected rectangle, or an invalid rectangle if the user
79 * pressed the Cancel button.
81 static QRect getSelectedRegion(const QPixmap &pixmap, int aspectRatioWidth, int aspectRatioHeight, QWidget *parent = 0L );
83 /**
84 * Creates a modal dialog, lets the user to select a region of the @p pixmap
85 * and returns when the dialog is closed.
87 * @returns the selected image, or an invalid image if the user
88 * pressed the Cancel button.
90 static QImage getSelectedImage(const QPixmap &pixmap, QWidget *parent = 0L );
92 /**
93 * Creates a modal dialog, lets the user to select a region of the @p pixmap
94 * with the same aspect ratio than @p aspectRatioWidth x @p aspectRatioHeight
95 * and returns when the dialog is closed.
97 * @returns the selected image, or an invalid image if the user
98 * pressed the Cancel button.
100 static QImage getSelectedImage(const QPixmap &pixmap, int aspectRatioWidth, int aspectRatioHeight, QWidget *parent = 0L );
102 protected:
103 KPixmapRegionSelectorWidget *m_pixmapSelectorWidget;
107 #endif