00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef STENCILBARDOCKMANAGER_H
00020 #define STENCILBARDOCKMANAGER_H
00021
00022 #include <qwidget.h>
00023 #include <qptrlist.h>
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
00032 class QSplitter;
00033 namespace Kivio {
00034 class DragBarButton;
00035 }
00036 class KivioStackBar;
00037 class KoToolDockMoveManager;
00038 class KivioDoc;
00039 class KivioView;
00040
00041 class StencilBarDockManager : public QWidget
00042 {
00043 Q_OBJECT
00044 public:
00045 enum BarPos {
00046 Left = 0,
00047 Top = 1,
00048 Right = 2,
00049 Bottom = 3,
00050 OnDesktop = 4,
00051 AutoSelect = 5,
00052 OnTopLevelBar = 6
00053 };
00054
00055 StencilBarDockManager( KivioView* parent, const char* name = 0 );
00056 ~StencilBarDockManager();
00057
00058 void insertStencilSet( QWidget*, const QString&, BarPos = AutoSelect,
00059 QRect r = QRect(), KivioStackBar* destinationBar = 0L );
00060
00061 public slots:
00062 void slotDeleteStencilSet( DragBarButton*,QWidget*,KivioStackBar* );
00063 void setAllStackBarsShown(bool shown);
00064
00065 protected slots:
00066 void slotBeginDragPage( DragBarButton* );
00067 void slotFinishDragPage( DragBarButton* );
00068 void slotMoving();
00069
00070 private:
00071 KivioDoc *m_pDoc;
00072 DragBarButton* dragButton;
00073 QWidget* dragWidget;
00074 KoToolDockMoveManager* moveManager;
00075 QPtrList<KivioStackBar> m_pBars;
00076 QSplitter* split1;
00077 QSplitter* split2;
00078 KivioView* m_pView;
00079
00080 BarPos dragPos;
00081 KivioStackBar* m_destinationBar;
00082 };
00083
00084
00089 class KoToolDockMoveManager: public QObject
00090 {
00091 Q_OBJECT
00092
00093 public:
00094
00095 KoToolDockMoveManager();
00096 ~KoToolDockMoveManager();
00097
00098 bool isWorking() const { return working; }
00099
00100 void doXResize( QWidget*, bool mirror );
00101 void doYResize( QWidget*, bool mirror );
00102 void doXYResize( QWidget*, bool _mirrorX, bool _mirrorY );
00103
00104 void doMove( QWidget* );
00105 void movePause( bool horizontal = true, bool vertical = true );
00106 void moveContinue();
00107
00108 void setGeometry( const QRect& r );
00109 void setGeometry(int x, int y, int w, int h);
00110
00111 QRect geometry();
00112
00113 void resize( const QSize& s ) { setGeometry(xp, yp, s.width(), s.height()); }
00114 void resize(int rw, int rh) { setGeometry(xp, yp, rw, rh); }
00115 void move( int rx, int ry) { setGeometry(rx, ry, w, h); }
00116 void move( const QPoint& p ) {setGeometry(p.x(), p.y(), w, h); }
00117
00118 int x()const { return xp; }
00119 int y() const { return yp; }
00120 int width()const { return w; }
00121 int height()const { return h; }
00122
00123 bool isXMirror() const { return mirrorX; }
00124 bool isYMirror() const{ return mirrorY; }
00125
00126 void stop ();
00127 QWidget* getWidget()const{ return widget; }
00128
00129 signals:
00130
00131 void positionChanged();
00132 void sizeChanged();
00133 void fixPosition(int& x, int& y, int& w, int& h);
00134 void fixSize(int& x, int& y, int& w, int& h);
00135
00136 protected:
00137
00138 void doResize( QWidget* );
00139 void setWidget( QWidget* );
00140 void drawRectangle (int x, int y, int w, int h);
00141 void paintProcess( bool onlyDeelete = true, int _x = 0, int _y = 0, int _w = 0, int _h = 0 );
00142 bool check(int& x, int& y, int& w, int& h, bool change = false);
00143
00144 private slots:
00145
00146 void doMoveInternal();
00147 void doResizeInternal();
00148
00149 private:
00150
00151 bool pauseMoveX;
00152 bool pauseMoveY;
00153 int xp, yp, w, h;
00154 int ox, oy, ow, oh;
00155 int orig_x, orig_y, orig_w, orig_h;
00156 bool noLast;
00157 bool working;
00158
00159 QSize maxSize;
00160 QSize minSize;
00161 QWidget* widget;
00162 QTimer* timer;
00163
00164 int rx, ry, sx, sy;
00165 int offX, offY;
00166
00167
00168 #if defined Q_WS_X11 && !defined K_WS_QTONLY
00169 Window root;
00170 GC rootgc;
00171 int scr;
00172 XEvent ev;
00173 #endif
00174
00175 bool mirrorX;
00176 bool mirrorY;
00177 bool xOnly;
00178 bool yOnly;
00179
00180 bool isDoMove;
00181 QRect rr;
00182 QPoint p;
00183 };
00184
00185 #endif
00186