kdeui
kpixmapregionselectorwidget.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __KPIXMAPREGIONSELECTORWIDGET_H__
00021 #define __KPIXMAPREGIONSELECTORWIDGET_H__
00022 #include <qvbox.h>
00023 #include <qpixmap.h>
00024 #include <qrect.h>
00025 #include <qlabel.h>
00026 #include <kimageeffect.h>
00027
00028 class KPopupMenu;
00029
00030 #include <kdelibs_export.h>
00031
00044 class KDEUI_EXPORT KPixmapRegionSelectorWidget : public QWidget
00045 {
00046 Q_OBJECT
00047 public:
00051 KPixmapRegionSelectorWidget( QWidget *parent = 0L, const char *name=0L);
00052
00056 ~KPixmapRegionSelectorWidget();
00057
00063 void setPixmap( const QPixmap &pixmap );
00064
00069 QPixmap pixmap() const { return m_unzoomedPixmap; }
00070
00074 void setSelectedRegion(const QRect &rect);
00075
00079 QRect selectedRegion() const;
00080
00084 QRect unzoomedSelectedRegion() const;
00085
00089 void resetSelection();
00090
00095 QImage selectedImage() const;
00096
00102 void setSelectionAspectRatio(int width, int height);
00103
00109 void setFreeSelectionAspectRatio();
00110
00116 void setMaximumWidgetSize( int width, int height );
00117
00124 void rotate(KImageEffect::RotateDirection direction);
00125
00126 public slots:
00130 void rotateClockwise();
00134 void rotateCounterclockwise();
00135
00136 protected:
00140 virtual KPopupMenu *createPopupMenu();
00141
00142 private:
00143 bool eventFilter(QObject *obj, QEvent *ev);
00144
00149 void updatePixmap();
00150
00151 QRect calcSelectionRectangle( const QPoint &startPoint, const QPoint & endPoint );
00152
00153 enum CursorState { None=0, Resizing, Moving };
00154 CursorState m_state;
00155
00156 QPixmap m_unzoomedPixmap;
00157 QPixmap m_originalPixmap;
00158 QPixmap m_linedPixmap;
00159 QRect m_selectedRegion;
00160 QLabel *m_label;
00161
00162 QPoint m_tempFirstClick;
00163 double m_forcedAspectRatio;
00164
00165 int m_maxWidth, m_maxHeight;
00166 double m_zoomFactor;
00167 };
00168
00169 #endif
00170