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., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA.
20 #ifndef __KPIXMAPREGIONSELECTORDIALOG_H__
21 #define __KPIXMAPREGIONSELECTORDIALOG_H__
23 #include <kdialogbase.h>
24 #include <libkdepim/kpixmapregionselectorwidget.h>
30 * A dialog that uses a KPixmapRegionSelectorWidget to allow the user
31 * to select a region of an image. If you want to use special features
32 * like forcing the selected area to have a fixed aspect ratio, you can use
33 * @see pixmapRegionSelectorWidget() to get the pointer to the
34 * pixmapRegionSelectorWidget object and set the desired options there.
36 * There are some convenience methods that allow to easily show a dialog
37 * for the user to select a region of an image, and just care about the selected
40 * @author Antonio Larrosa <larrosa@kde.org>
43 class KPixmapRegionSelectorDialog
: public KDialogBase
47 * The constructor of an empty KPixmapRegionSelectorDialog, you have to call
48 * later the setPixmap method of the KPixmapRegionSelectorWidget widget of
51 KPixmapRegionSelectorDialog(QWidget
*parent
=0L, const char *name
=0L,
54 * The destructor of the dialog
56 ~KPixmapRegionSelectorDialog();
59 * @returns the KPixmapRegionSelectorWidget widget so that additional
60 * parameters can be set by using it.
62 KPIM::KPixmapRegionSelectorWidget
*pixmapRegionSelectorWidget() const
63 { return m_pixmapSelectorWidget
; };
66 * Creates a modal dialog, lets the user to select a region of the @p pixmap
67 * and returns when the dialog is closed.
69 * @returns the selected rectangle, or an invalid rectangle if the user
70 * pressed the Cancel button.
72 static QRect
getSelectedRegion(const QPixmap
&pixmap
, QWidget
*parent
= 0L );
75 * Creates a modal dialog, lets the user to select a region of the @p pixmap
76 * with the same aspect ratio than @p aspectRatioWidth x @p aspectRatioHeight
77 * and returns when the dialog is closed.
79 * @returns the selected rectangle, or an invalid rectangle if the user
80 * pressed the Cancel button.
82 static QRect
getSelectedRegion(const QPixmap
&pixmap
, int aspectRatioWidth
, int aspectRatioHeight
, QWidget
*parent
= 0L );
85 * Creates a modal dialog, lets the user to select a region of the @p pixmap
86 * and returns when the dialog is closed.
88 * @returns the selected image, or an invalid image if the user
89 * pressed the Cancel button.
91 static QImage
getSelectedImage(const QPixmap
&pixmap
, QWidget
*parent
= 0L );
94 * Creates a modal dialog, lets the user to select a region of the @p pixmap
95 * with the same aspect ratio than @p aspectRatioWidth x @p aspectRatioHeight
96 * and returns when the dialog is closed.
98 * @returns the selected image, or an invalid image if the user
99 * pressed the Cancel button.
101 static QImage
getSelectedImage(const QPixmap
&pixmap
, int aspectRatioWidth
, int aspectRatioHeight
, QWidget
*parent
= 0L );
104 KPIM::KPixmapRegionSelectorWidget
*m_pixmapSelectorWidget
;