tdeui
kpixmapregionselectorwidget.h
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 <tqvbox.h>
00023 #include <tqpixmap.h>
00024 #include <tqrect.h>
00025 #include <tqlabel.h>
00026 #include <kimageeffect.h>
00027
00028 class TDEPopupMenu;
00029
00030 #include <tdelibs_export.h>
00031
00044 class TDEUI_EXPORT KPixmapRegionSelectorWidget : public TQWidget
00045 {
00046 Q_OBJECT
00047 public:
00051 KPixmapRegionSelectorWidget( TQWidget *parent = 0L, const char *name=0L);
00052
00056 ~KPixmapRegionSelectorWidget();
00057
00063 void setPixmap( const TQPixmap &pixmap );
00064
00069 TQPixmap pixmap() const { return m_unzoomedPixmap; }
00070
00074 void setSelectedRegion(const TQRect &rect);
00075
00079 TQRect selectedRegion() const;
00080
00084 TQRect unzoomedSelectedRegion() const;
00085
00089 void resetSelection();
00090
00095 TQImage 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 TDEPopupMenu *createPopupMenu();
00141
00142 private:
00143 bool eventFilter(TQObject *obj, TQEvent *ev);
00144
00149 void updatePixmap();
00150
00151 TQRect calcSelectionRectangle( const TQPoint &startPoint, const TQPoint & endPoint );
00152
00153 enum CursorState { None=0, Resizing, Moving };
00154 CursorState m_state;
00155
00156 TQPixmap m_unzoomedPixmap;
00157 TQPixmap m_originalPixmap;
00158 TQPixmap m_linedPixmap;
00159 TQRect m_selectedRegion;
00160 TQLabel *m_label;
00161
00162 TQPoint m_tempFirstClick;
00163 double m_forcedAspectRatio;
00164
00165 int m_maxWidth, m_maxHeight;
00166 double m_zoomFactor;
00167 };
00168
00169 #endif
00170