kdockwidget_private.h
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 <tqwidget.h> 00028 #include <tqpushbutton.h> 00029 00030 #ifndef NO_KDE2 00031 #include <netwm_def.h> 00032 #endif 00033 00034 class TQFrame; 00035 class KDockContainer; 00036 00037 00044 class TDEUI_EXPORT KDockSplitter : public TQWidget 00045 { 00046 // NOTE: in theory the TDEUI_EXPORT above shouldn't be there, but it's needed for kexi, 00047 // which copies the whole definition of the class to be able to access separatorPosInPercent etc. 00048 // This needs real fixing in KDE4. 00049 00050 Q_OBJECT 00051 public: 00059 KDockSplitter(TQWidget *parent= 0, const char *name= 0, Orientation orient= Qt::Vertical, int pos= 50); 00060 virtual ~KDockSplitter(){} 00061 00070 void activate(TQWidget *c0, TQWidget *c1 = 0L); 00074 void deactivate(); 00075 00080 int separatorPosInPercent(); 00085 void setSeparatorPosInPercent(int percent); 00086 00095 int separatorPos() const; 00102 void setSeparatorPos(int pos, bool do_resize = true); 00111 // ### please come up with a nicer name 00112 void setSeparatorPosX(int pos, bool do_resize=false); 00113 00118 virtual bool eventFilter(TQObject *, TQEvent *); 00119 virtual bool event( TQEvent * ); 00120 00124 TQWidget* getFirst() const { return child0; } 00128 TQWidget* getLast() const { return child1; } 00133 TQWidget* getAnother( TQWidget* w ) const; 00134 void updateName(); 00135 00141 void setOpaqueResize(bool b=true); 00142 bool opaqueResize() const; 00143 00148 void setKeepSize(bool b=true); 00149 bool keepSize() const; 00150 00151 00152 void setForcedFixedWidth(KDockWidget *dw,int w); 00153 void setForcedFixedHeight(KDockWidget *dw,int h); 00154 void restoreFromForcedFixedSize(KDockWidget *dw); 00155 00159 Orientation orientation(){return m_orientation;} 00160 00161 protected: 00162 friend class KDockContainer; 00168 int checkValue(int position) const; 00176 int checkValueOverlapped(int position, TQWidget* child) const; 00177 00192 virtual void resizeEvent(TQResizeEvent *ev); 00193 00194 /* 00195 protected slots: 00196 void delayedResize();*/ 00197 00198 private: 00204 void setupMinMaxSize(); 00210 TQWidget *child0, *child1; 00211 Orientation m_orientation; 00215 bool initialised; 00220 TQFrame* divider; 00231 int xpos, savedXPos; 00232 bool mOpaqueResize, mKeepSize; 00233 int fixedWidth0,fixedWidth1; 00234 int fixedHeight0,fixedHeight1; 00235 bool m_dontRecalc; 00239 static const int factor = 100000; 00240 }; 00241 00248 class TDEUI_EXPORT KDockButton_Private : public TQPushButton 00249 { 00250 Q_OBJECT 00251 public: 00252 KDockButton_Private( TQWidget *parent=0, const char *name=0 ); 00253 ~KDockButton_Private(); 00254 00255 protected: 00256 virtual void drawButton( TQPainter * ); 00257 virtual void enterEvent( TQEvent * ); 00258 virtual void leaveEvent( TQEvent * ); 00259 00260 private: 00261 bool moveMouse; 00262 }; 00263 00273 class KDockWidgetPrivate : public TQObject 00274 { 00275 Q_OBJECT 00276 public: 00277 KDockWidgetPrivate(); 00278 ~KDockWidgetPrivate(); 00279 00280 public slots: 00284 void slotFocusEmbeddedWidget(TQWidget* w = 0L); 00285 00286 public: 00287 enum KDockWidgetResize 00288 {ResizeLeft,ResizeTop,ResizeRight,ResizeBottom,ResizeBottomLeft,ResizeTopLeft,ResizeBottomRight,ResizeTopRight}; 00289 00290 int index; 00291 int splitPosInPercent; 00292 bool pendingFocusInEvent; 00293 bool blockHasUndockedSignal; 00294 bool pendingDtor; 00295 int forcedWidth; 00296 int forcedHeight; 00297 bool isContainer; 00298 00299 #ifndef NO_KDE2 00300 NET::WindowType windowType; 00301 #endif 00302 00303 TQWidget *_parent; 00304 bool transient; 00305 00306 TQGuardedPtr<TQWidget> container; 00307 00308 TQPoint resizePos; 00309 bool resizing; 00310 KDockWidgetResize resizeMode; 00311 }; 00312 00313 class KDockWidgetHeaderPrivate 00314 : public TQObject 00315 { 00316 public: 00317 KDockWidgetHeaderPrivate( TQObject* parent ) 00318 : TQObject( parent ) 00319 { 00320 forceCloseButtonHidden=false; 00321 toDesktopButton = 0; 00322 showToDesktopButton = true; 00323 topLevel = false; 00324 dummy=0; 00325 } 00326 KDockButton_Private* toDesktopButton; 00327 00328 bool showToDesktopButton; 00329 bool topLevel; 00330 TQPtrList<KDockButton_Private> btns; 00331 bool forceCloseButtonHidden; 00332 TQWidget *dummy; 00333 }; 00334 00335 #endif