lib Library API Documentation

kotooldockbase.h

00001 /* This file is part of the KDE project
00002  * Copyright (C) 2000-2001 theKompany.com & Dave Marotti
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017  */
00018 #ifndef KO_TOOLDOCKBASE_H
00019 #define KO_TOOLDOCKBASE_H
00020 
00021 #include <qwidget.h>
00022 #include <qintdict.h>
00023 #include <qframe.h>
00024 #include <qtimer.h>
00025 #include <koffice_export.h>
00026 class QGridLayout;
00027 class QTabWidget;
00028 
00029 class KoToolDockMoveManager;
00030 
00031 enum KoToolDockPosition {
00032     KoToolDockLeft,
00033     KoToolDockRight,
00034     KoToolDockTop,
00035     KoToolDockBottom,
00036     KoToolDockCenter
00037 };
00038 
00039 class KoToolDockBase;
00040 class KoToolDockManager;
00041 
00045 class KoToolDockBaseBorder
00046     : public QWidget
00047 {
00048 
00049     Q_OBJECT
00050 
00051 public:
00052     enum Position { Left, Right, Top, Bottom, TopLeft, TopRight, BottomLeft, BottomRight };
00053 
00054     KoToolDockBaseBorder( Position, KoToolDockBase* parent, const char* name = 0 );
00055     ~KoToolDockBaseBorder();
00056 
00057     Position position() const { return pos; }
00058 
00059 signals:
00060     void resizeStart();
00061     void resizeStop();
00062 
00063 protected:
00064     void paintEvent( QPaintEvent* );
00065     void mousePressEvent( QMouseEvent* );
00066     void mouseReleaseEvent( QMouseEvent* );
00067 
00068 private:
00069     Position pos;
00070 };
00071 
00072 /******************************************************************************/
00073 
00077 class KoToolDockButton : public QFrame
00078 {
00079     Q_OBJECT
00080 
00081 public:
00082     KoToolDockButton( QWidget* parent, const char* name = 0 );
00083     ~KoToolDockButton();
00084 
00085     void setPixmap( const QPixmap& );
00086     void setToggled( bool );
00087     void setDown( bool );
00088 
00089 signals:
00090     void clicked();
00091     void toggled(bool);
00092 
00093 protected:
00094     void paintEvent( QPaintEvent* );
00095     void mousePressEvent( QMouseEvent* );
00096     void mouseReleaseEvent( QMouseEvent* );
00097     void enterEvent( QEvent* );
00098     void leaveEvent( QEvent* );
00099 
00100 private:
00101     QPixmap* pixmap;
00102     bool tg;
00103     bool down;
00104     bool isin;
00105     bool mdown;
00106 };
00107 
00108 
00109 /******************************************************************************/
00110 
00114 class KoToolDockBaseCaption : public QWidget
00115 {
00116 
00117     Q_OBJECT
00118 
00119 public:
00120 
00121     KoToolDockBaseCaption( KoToolDockPosition, KoToolDockBase* parent, const char* name = 0 );
00122     ~KoToolDockBaseCaption();
00123 
00124 signals:
00125     void moveStart();
00126     void moveStop();
00127 
00128     void doClose();
00129     void doStick( bool );
00130     void doLock( bool );
00131 
00132 public slots:
00133 
00134     void stick( bool );
00135     void lock( bool );
00136 
00137 protected slots:
00138 
00139     void slotClose();
00140     void slotStick( bool );
00141     void slotLock( bool );
00142 
00143 protected:
00144 
00145     void paintEvent( QPaintEvent* );
00146     void mousePressEvent( QMouseEvent* );
00147     void mouseMoveEvent( QMouseEvent* );
00148     void mouseReleaseEvent( QMouseEvent* );
00149 
00150 private:
00151 
00152     bool m_bPressed;
00153     bool m_bMove;
00154     QPoint m_ppoint;
00155     KoToolDockPosition position;
00156     KoToolDockButton* closeButton;
00157     KoToolDockButton* stickButton;
00158     KoToolDockButton* lockButton;
00159 };
00160 
00161 /******************************************************************************/
00162 
00166 class KoToolDockBaseCaptionManager : public QObject
00167 {
00168 
00169     Q_OBJECT
00170 
00171 public:
00172 
00173     KoToolDockBaseCaptionManager( KoToolDockBase* parent, const char* name = 0 );
00174     ~KoToolDockBaseCaptionManager();
00175 
00176     void setView( KoToolDockPosition );
00177     KoToolDockBaseCaption* captionWidget( KoToolDockPosition );
00178     int captionHeight() const;
00179 
00180 signals:
00181     void doClose();
00182     void doStick(bool);
00183     void doLock( bool );
00184 
00185 protected slots:
00186 
00187     void slotClose();
00188     void slotStick(bool);
00189     void slotLock( bool );
00190 
00191 private:
00192 
00193     KoToolDockBaseCaption* m_pLeft;
00194     KoToolDockBaseCaption* m_pRight;
00195     KoToolDockBaseCaption* m_pTop;
00196     KoToolDockBaseCaption* m_pBottom;
00197 };
00198 
00199 /******************************************************************************/
00200 
00204 class KoToolDockSnap
00205 {
00206 public:
00207     void clear();
00208     void set(KoToolDockPosition,QWidget*);
00209     QWidget* get(KoToolDockPosition);
00210 
00211 private:
00212     QIntDict<QWidget> snaps;
00213 };
00214 
00215 
00216 /******************************************************************************/
00217 
00218 
00231 class KOFFICEUI_EXPORT KoToolDockBase : public QWidget
00232 {
00233 
00234     Q_OBJECT
00235     friend class KoToolDockManager;
00236 
00237 public:
00238 
00239     virtual ~KoToolDockBase();
00240 
00241     void activate();
00242     void restore();
00243 protected:
00244 
00245     KoToolDockBase( QWidget* parent, const char* name = 0 );
00246 
00247     void setView( QWidget* );
00248 
00249 public slots:
00250 
00251     void show();
00252     void hide();
00253     void makeVisible(bool);
00254 
00255 signals:
00256 
00257     void visibleChange(bool);
00258 
00259 protected slots:
00260 
00261     void beginResize();
00262     void stopResize();
00263 
00264     void beginMove();
00265     void stopMove();
00266 
00267     void positionChanged();
00268     void sizeChanged();
00269 
00270     void fixPosition(int& x, int& y, int& w, int& h);
00271     void fixSize(int& x, int& y, int& w, int& h);
00272 
00273     void slotStick(bool);
00274     bool isStick() const { return stick; }
00275 
00276     void slotLock( bool );
00277     bool isLocked() const { return lock; }
00278 
00279 protected:
00280 
00281     void enterEvent( QEvent* );
00282     void mousePressEvent( QMouseEvent* );
00283     void resizeEvent( QResizeEvent* );
00284     void paintEvent( QPaintEvent* );
00285 
00286     void updateCaption();
00287     KoToolDockPosition getCaptionPos( bool* = 0L );
00288     void mouseStatus(bool);
00289 
00290 protected slots:
00291 
00292     void slotHideTimeOut();
00293     void slotHideProcessTimeOut();
00294     void hideProcessStop();
00295     void showProcessStop();
00296 
00297 private:
00298     bool stick;
00299     bool lock;
00300     QWidget* m_pView;
00301     QGridLayout* m_pBaseLayout;
00302 
00303     KoToolDockBaseBorder* m_pBorderLeft;
00304     KoToolDockBaseBorder* m_pBorderRight;
00305     KoToolDockBaseBorder* m_pBorderTop;
00306     KoToolDockBaseBorder* m_pBorderBottom;
00307 
00308     KoToolDockBaseBorder* m_pBorderTopLeft;
00309     KoToolDockBaseBorder* m_pBorderTopRight;
00310     KoToolDockBaseBorder* m_pBorderBottomRight;
00311     KoToolDockBaseBorder* m_pBorderBottomLeft;
00312 
00313     KoToolDockBaseCaptionManager* m_pCaptionManager;
00314 
00315     KoToolDockMoveManager* mrManager;
00316     KoToolDockSnap snaps;
00317 
00318     QGridLayout* m_pLayout;
00319 
00320     int hdx;
00321     QPixmap* hpixmap;
00322     QSize hminsize;
00323     QSize hmaxsize;
00324     QSize hsize;
00325     QTimer hideTimer;
00326     QTimer hideProcessTimer;
00327     KoToolDockPosition hideDirection;
00328     enum hstatus { hnone, hstarthide, hprocesshide, hdonehide, hprocessshow };
00329     hstatus hStatus;
00330 };
00331 
00332 /*******************************************************************************/
00333 
00334 class KOFFICEUI_EXPORT KoTabbedToolDock : public KoToolDockBase {
00335 
00336     Q_OBJECT
00337 
00338 public:
00339 
00340     KoTabbedToolDock ( QWidget* parent = 0, const char* name = 0 );
00341     ~KoTabbedToolDock();
00342 
00343     void plug(QWidget *w);
00344     void unplug(QWidget *w);
00345     void showPage(QWidget *w);
00346 
00347 private:
00348 
00349     QTabWidget *m_tabwidget;
00350 
00351 };
00352 
00353 #endif
KDE Logo
This file is part of the documentation for lib Library Version 1.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Feb 13 09:40:13 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003