libtdepim
kpixmapregionselectorwidget.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __KPIXMAPREGIONSELECTORWIDGET_H__
00023 #define __KPIXMAPREGIONSELECTORWIDGET_H__
00024
00025 #include <tqvbox.h>
00026 #include <tqpixmap.h>
00027 #include <tqrect.h>
00028 #include <tqlabel.h>
00029 #include <kimageeffect.h>
00030
00031 class TDEPopupMenu;
00032
00033 namespace KPIM {
00034
00047 class KPixmapRegionSelectorWidget : public TQWidget
00048 {
00049 Q_OBJECT
00050
00051
00052 public:
00056 KPixmapRegionSelectorWidget( TQWidget *parent = 0L, const char *name=0L);
00057
00061 ~KPixmapRegionSelectorWidget();
00062
00067 void setPixmap( const TQPixmap &pixmap );
00068
00073 TQPixmap pixmap() const { return m_unzoomedPixmap; }
00074
00078 void setSelectedRegion(const TQRect &rect);
00079
00083 TQRect selectedRegion() const;
00084
00088 TQRect unzoomedSelectedRegion() const;
00089
00093 void resetSelection();
00094
00099 TQImage selectedImage() const;
00100
00106 void setSelectionAspectRatio(int width, int height);
00107
00113 void setFreeSelectionAspectRatio();
00114
00120 void setMaximumWidgetSize( int width, int height );
00121
00128 void rotate(KImageEffect::RotateDirection direction);
00129
00130 public slots:
00134 void rotateClockwise();
00138 void rotateCounterclockwise();
00139
00140 protected:
00144 virtual TDEPopupMenu *createPopupMenu();
00145
00146
00147 private:
00148 bool eventFilter(TQObject *obj, TQEvent *ev);
00149
00154 void updatePixmap();
00155
00156 TQRect calcSelectionRectangle( const TQPoint &startPoint, const TQPoint & endPoint );
00157
00158 enum CursorState { None=0, Resizing, Moving };
00159 CursorState m_state;
00160
00161 TQPixmap m_unzoomedPixmap;
00162 TQPixmap m_originalPixmap;
00163 TQPixmap m_linedPixmap;
00164 TQRect m_selectedRegion;
00165 TQLabel *m_label;
00166
00167 TQPoint m_tempFirstClick;
00168 double m_forcedAspectRatio;
00169
00170 int m_maxWidth, m_maxHeight;
00171 double m_zoomFactor;
00172 };
00173
00174 }
00175
00176 #endif
|