KDE3Support
k3dockwidget_private.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2000 Max Judin <novaprint@mtu-net.ru> 00003 Copyright (C) 2005 Dominik Haumann <dhdev@gmx.de> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License version 2 as published by the Free Software Foundation. 00008 00009 This library 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 GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 /* 00021 IMPORTANT Note: This file compiles also in Qt-only mode by using the NO_KDE2 precompiler definition 00022 */ 00023 00024 #ifndef KDOCKWIDGET_PRIVATE_H 00025 #define KDOCKWIDGET_PRIVATE_H 00026 00027 #include <kde3support_export.h> 00028 00029 #include <QtCore/QPointer> 00030 #include <QtGui/QPushButton> 00031 #include <QtGui/QWidget> 00032 #include <Qt3Support/Q3PtrList> 00033 00034 #ifndef NO_KDE2 00035 #include <netwm_def.h> 00036 #endif 00037 00038 class QFrame; 00039 class K3DockContainer; 00040 class K3DockWidget; 00041 00042 00049 class KDE3SUPPORT_EXPORT K3DockSplitter : public QWidget 00050 { 00051 // NOTE: in theory the KDE3SUPPORT_EXPORT above shouldn't be there, but it's needed for kexi, 00052 // which copies the whole definition of the class to be able to access separatorPosInPercent etc. 00053 // This needs real fixing in KDE4. 00054 00055 Q_OBJECT 00056 public: 00064 K3DockSplitter(QWidget *parent= 0, const char *name= 0, Qt::Orientation orient= Qt::Vertical, int pos= 50); 00065 virtual ~K3DockSplitter(){} 00066 00075 void activate(QWidget *c0, QWidget *c1 = 0L); 00079 void deactivate(); 00080 00085 int separatorPosInPercent(); 00090 void setSeparatorPosInPercent(int percent); 00091 00100 int separatorPos() const; 00107 void setSeparatorPos(int pos, bool do_resize = true); 00116 // ### please come up with a nicer name 00117 void setSeparatorPosX(int pos, bool do_resize=false); 00118 00123 virtual bool eventFilter(QObject *, QEvent *); 00124 virtual bool event( QEvent * ); 00125 00129 QWidget* getFirst() const { return child0; } 00133 QWidget* getLast() const { return child1; } 00138 QWidget* getAnother( QWidget* w ) const; 00139 void updateName(); 00140 00146 void setOpaqueResize(bool b=true); 00147 bool opaqueResize() const; 00148 00153 void setKeepSize(bool b=true); 00154 bool keepSize() const; 00155 00156 00157 void setForcedFixedWidth(K3DockWidget *dw,int w); 00158 void setForcedFixedHeight(K3DockWidget *dw,int h); 00159 void restoreFromForcedFixedSize(K3DockWidget *dw); 00160 00164 Qt::Orientation orientation(){return m_orientation;} 00165 00166 protected: 00167 friend class K3DockContainer; 00173 int checkValue(int position) const; 00181 int checkValueOverlapped(int position, QWidget* child) const; 00182 00197 virtual void resizeEvent(QResizeEvent *ev); 00198 00199 /* 00200 protected Q_SLOTS: 00201 void delayedResize();*/ 00202 00203 private: 00209 void setupMinMaxSize(); 00215 QWidget *child0, *child1; 00216 Qt::Orientation m_orientation; 00220 bool initialised; 00225 QFrame* divider; 00236 int xpos, savedXPos; 00237 bool mOpaqueResize, mKeepSize; 00238 int fixedWidth0,fixedWidth1; 00239 int fixedHeight0,fixedHeight1; 00240 bool m_dontRecalc; 00244 static const int factor = 100000; 00245 }; 00246 00253 class KDE3SUPPORT_EXPORT K3DockButton_Private : public QPushButton 00254 { 00255 Q_OBJECT 00256 public: 00257 K3DockButton_Private( QWidget *parent=0, const char *name=0 ); 00258 ~K3DockButton_Private(); 00259 00260 protected: 00261 virtual void drawButton( QPainter * ); 00262 virtual void enterEvent( QEvent * ); 00263 virtual void leaveEvent( QEvent * ); 00264 virtual void paintEvent( QPaintEvent * ); 00265 00266 private: 00267 bool moveMouse; 00268 }; 00269 00279 class K3DockWidgetPrivate : public QObject 00280 { 00281 Q_OBJECT 00282 public: 00283 K3DockWidgetPrivate(); 00284 ~K3DockWidgetPrivate(); 00285 00286 public Q_SLOTS: 00290 void slotFocusEmbeddedWidget(QWidget* w = 0L); 00291 00292 public: 00293 enum K3DockWidgetResize 00294 {ResizeLeft,ResizeTop,ResizeRight,ResizeBottom,ResizeBottomLeft,ResizeTopLeft,ResizeBottomRight,ResizeTopRight}; 00295 00296 int index; 00297 int splitPosInPercent; 00298 bool pendingFocusInEvent; 00299 bool blockHasUndockedSignal; 00300 bool pendingDtor; 00301 int forcedWidth; 00302 int forcedHeight; 00303 bool isContainer; 00304 00305 #ifndef NO_KDE2 00306 NET::WindowType windowType; 00307 #endif 00308 00309 QWidget *_parent; 00310 bool transient; 00311 00312 QPointer<QWidget> container; 00313 00314 QPoint resizePos; 00315 bool resizing; 00316 K3DockWidgetResize resizeMode; 00317 }; 00318 00319 class K3DockWidgetHeaderPrivate 00320 : public QObject 00321 { 00322 public: 00323 K3DockWidgetHeaderPrivate( QObject* parent ) 00324 : QObject( parent ) 00325 { 00326 forceCloseButtonHidden=false; 00327 toDesktopButton = 0; 00328 showToDesktopButton = true; 00329 topLevel = false; 00330 dummy=0; 00331 } 00332 K3DockButton_Private* toDesktopButton; 00333 00334 bool showToDesktopButton; 00335 bool topLevel; 00336 Q3PtrList<K3DockButton_Private> btns; 00337 bool forceCloseButtonHidden; 00338 QWidget *dummy; 00339 }; 00340 00341 #endif
KDE 4.6 API Reference