00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef KO_TOOLDOCK_MOVEMANAGER_H
00020 #define KO_TOOLDOCK_MOVEMANAGER_H
00021
00022 #include <qobject.h>
00023
00024 #if defined Q_WS_X11 && !defined K_WS_QTONLY
00025 #include <X11/X.h>
00026 #include <X11/Xlib.h>
00027 #include <X11/Xutil.h>
00028 #endif
00029 #include <koffice_export.h>
00030 class QTimer;
00031 class QWidget;
00032
00033
00038 class KOFFICEUI_EXPORT KoToolDockMoveManager: public QObject
00039 {
00040 Q_OBJECT
00041
00042 public:
00043
00044 KoToolDockMoveManager();
00045 ~KoToolDockMoveManager();
00046
00047 bool isWorking() const { return working; }
00048
00049 void doXResize( QWidget*, bool mirror );
00050 void doYResize( QWidget*, bool mirror );
00051 void doXYResize( QWidget*, bool _mirrorX, bool _mirrorY );
00052
00053 void doMove( QWidget* );
00054 void movePause( bool horizontal = true, bool vertical = true );
00055 void moveContinue();
00056
00057 void setGeometry( const QRect& r );
00058 void setGeometry(int x, int y, int w, int h);
00059
00060 QRect geometry();
00061
00062 void resize( const QSize& s ) { setGeometry(xp, yp, s.width(), s.height()); }
00063 void resize(int rw, int rh) { setGeometry(xp, yp, rw, rh); }
00064 void move( int rx, int ry) { setGeometry(rx, ry, w, h); }
00065 void move( const QPoint& p ) {setGeometry(p.x(), p.y(), w, h); }
00066
00067 int x()const { return xp; }
00068 int y() const { return yp; }
00069 int width()const { return w; }
00070 int height()const { return h; }
00071
00072 bool isXMirror() const { return mirrorX; }
00073 bool isYMirror() const{ return mirrorY; }
00074
00075 void stop ();
00076 QWidget* getWidget()const{ return widget; }
00077
00078 signals:
00079
00080 void positionChanged();
00081 void sizeChanged();
00082 void fixPosition(int& x, int& y, int& w, int& h);
00083 void fixSize(int& x, int& y, int& w, int& h);
00084
00085 protected:
00086
00087 void doResize( QWidget* );
00088 void setWidget( QWidget* );
00089 void drawRectangle (int x, int y, int w, int h);
00090 void paintProcess( bool onlyDeelete = true, int _x = 0, int _y = 0, int _w = 0, int _h = 0 );
00091 bool check(int& x, int& y, int& w, int& h, bool change = false);
00092
00093 private slots:
00094
00095 void doMoveInternal();
00096 void doResizeInternal();
00097
00098 private:
00099
00100 bool pauseMoveX;
00101 bool pauseMoveY;
00102 int xp, yp, w, h;
00103 int ox, oy, ow, oh;
00104 int orig_x, orig_y, orig_w, orig_h;
00105 bool noLast;
00106 bool working;
00107
00108 QSize maxSize;
00109 QSize minSize;
00110 QWidget* widget;
00111 QTimer* timer;
00112
00113 int rx, ry, sx, sy;
00114 int offX, offY;
00115
00116
00117 #if defined Q_WS_X11 && !defined K_WS_QTONLY
00118 Window root;
00119 GC rootgc;
00120 int scr;
00121 XEvent ev;
00122 #endif
00123
00124 bool mirrorX;
00125 bool mirrorY;
00126 bool xOnly;
00127 bool yOnly;
00128
00129 bool isDoMove;
00130 QRect rr;
00131 QPoint p;
00132 };
00133
00134 #endif // KO_TOOLDOCK_MOVEMANAGER_H
00135