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