You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
koffice/kivio/kiviopart/stencilbardockmanager.h

193 lines
4.7 KiB

/*
* 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
{
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
{
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 geometry();
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