kivio

stencilbardockmanager.h
1/*
2 * Kivio - Visual Modelling and Flowcharting
3 * Copyright (C) 2000-2001 theKompany.com & Dave Marotti
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19#ifndef STENCILBARDOCKMANAGER_H
20#define STENCILBARDOCKMANAGER_H
21
22#ifdef Q_MOC_RUN
23#define TQ_WS_X11
24#endif // Q_MOC_RUN
25
26#include <tqwidget.h>
27#include <tqptrlist.h>
28#if defined TQ_WS_X11 && !defined K_WS_TQTONLY
29#include <X11/X.h>
30#include <X11/Xlib.h>
31#include <X11/Xutil.h>
32#endif
33#include <koffice_export.h>
34class TQTimer;
35
36class TQSplitter;
37namespace Kivio {
38class DragBarButton;
39}
40class KivioStackBar;
42class KivioDoc;
43class KivioView;
44
45class StencilBarDockManager : public TQWidget
46{
47 TQ_OBJECT
48
49 public:
50 enum BarPos {
51 Left = 0,
52 Top = 1,
53 Right = 2,
54 Bottom = 3,
55 OnDesktop = 4,
56 AutoSelect = 5,
57 OnTopLevelBar = 6
58 };
59
60 StencilBarDockManager( KivioView* parent, const char* name = 0 );
61 ~StencilBarDockManager();
62
63 void insertStencilSet( TQWidget*, const TQString&, BarPos = AutoSelect,
64 TQRect r = TQRect(), KivioStackBar* destinationBar = 0L );
65
66 public slots:
67 void slotDeleteStencilSet( DragBarButton*,TQWidget*,KivioStackBar* );
68 void setAllStackBarsShown(bool shown);
69
70 protected slots:
71 void slotBeginDragPage( DragBarButton* );
72 void slotFinishDragPage( DragBarButton* );
73 void slotMoving();
74
75 private:
76 KivioDoc *m_pDoc;
77 DragBarButton* dragButton;
78 TQWidget* dragWidget;
79 KoToolDockMoveManager* moveManager;
80 TQPtrList<KivioStackBar> m_pBars;
81 TQSplitter* split1;
82 TQSplitter* split2;
83 KivioView* m_pView;
84
85 BarPos dragPos;
86 KivioStackBar* m_destinationBar;
87};
88
89
94class KoToolDockMoveManager: public TQObject
95{
96 TQ_OBJECT
97
98
99 public:
100
101 KoToolDockMoveManager();
102 ~KoToolDockMoveManager();
103
104 bool isWorking() const { return working; }
105
106 void doXResize( TQWidget*, bool mirror );
107 void doYResize( TQWidget*, bool mirror );
108 void doXYResize( TQWidget*, bool _mirrorX, bool _mirrorY );
109
110 void doMove( TQWidget* );
111 void movePause( bool horizontal = true, bool vertical = true );
112 void moveContinue();
113
114 void setGeometry( const TQRect& r );
115 void setGeometry(int x, int y, int w, int h);
116
117 TQRect geometry();
118
119 void resize( const TQSize& s ) { setGeometry(xp, yp, s.width(), s.height()); }
120 void resize(int rw, int rh) { setGeometry(xp, yp, rw, rh); }
121 void move( int rx, int ry) { setGeometry(rx, ry, w, h); }
122 void move( const TQPoint& p ) {setGeometry(p.x(), p.y(), w, h); }
123
124 int x()const { return xp; }
125 int y() const { return yp; }
126 int width()const { return w; }
127 int height()const { return h; }
128
129 bool isXMirror() const { return mirrorX; }
130 bool isYMirror() const{ return mirrorY; }
131
132 void stop ();
133 TQWidget* getWidget()const{ return widget; }
134
135 signals:
136
137 void positionChanged();
138 void sizeChanged();
139 void fixPosition(int& x, int& y, int& w, int& h);
140 void fixSize(int& x, int& y, int& w, int& h);
141
142 protected:
143
144 void doResize( TQWidget* );
145 void setWidget( TQWidget* );
146 void drawRectangle (int x, int y, int w, int h);
147 void paintProcess( bool onlyDeelete = true, int _x = 0, int _y = 0, int _w = 0, int _h = 0 );
148 bool check(int& x, int& y, int& w, int& h, bool change = false);
149
150 private slots:
151
152 void doMoveInternal();
153 void doResizeInternal();
154
155 private:
156
157 bool pauseMoveX;
158 bool pauseMoveY;
159 int xp, yp, w, h;
160 int ox, oy, ow, oh;
161 int orig_x, orig_y, orig_w, orig_h;
162 bool noLast;
163 bool working;
164
165 TQSize maxSize;
166 TQSize minSize;
167 TQWidget* widget;
168 TQTimer* timer;
169
170 int rx, ry, sx, sy;
171 int offX, offY;
172
173 /* X-stuff */
174#if defined TQ_WS_X11 && !defined K_WS_TQTONLY
175 Window root;
176 GC rootgc;
177 int scr;
178 XEvent ev;
179#endif
180
181 bool mirrorX;
182 bool mirrorY;
183 bool xOnly;
184 bool yOnly;
185
186 bool isDoMove;
187 TQRect rr;
188 TQPoint p;
189};
190
191#endif
192
The move manager handles moving tooldocks or other widgets that it can manage, such as the Kivio sten...