kexi

ksplitter.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 <qwidget.h>
00028 #include <qpushbutton.h>
00029 
00030 #include <kdeversion.h>
00031 
00032 #ifndef NO_KDE2
00033 #include <netwm_def.h>
00034 #endif
00035 
00036 class QFrame;
00037 class KDockContainer;
00038 class KDockWidget;
00039 
00040 
00047 class KDockSplitter : public QWidget
00048 {
00049   //Q_OBJECT
00050 public:
00058   KDockSplitter(QWidget *parent= 0, const char *name= 0, Orientation orient= Vertical, int pos= 50);
00059   virtual ~KDockSplitter(){};
00060 
00069   void activate(QWidget *c0, QWidget *c1 = 0L);
00073   void deactivate();
00074 
00079   int separatorPosInPercent() 
00080 #if KDE_IS_VERSION(3,4,89)
00081     ;
00082 #else
00083     {
00084 //      kdDebug() << "^^^^^^^^^^^^^^^^^^^^^ separatorPosInPercent() " << separatorPos() / (factor/100) << " " << separatorPos() / 100 << endl;
00085         return separatorPos() / 100;
00086     }
00087 #endif
00088 
00092   void setSeparatorPosInPercent(int percent)
00093 #if KDE_IS_VERSION(3,4,89)
00094     ;
00095 #else
00096     {
00097 //      kdDebug() << "^^^^^^^^^^^^^^^^^^^^^ setSeparatorPosInPercent() " << percent << " " << separatorPos() / 100 << endl;
00098         setSeparatorPos( percent * 100, false );
00099     }
00100 #endif
00101 
00110   int separatorPos() const;
00116   void setSeparatorPos(int pos, bool do_resize = true);
00125   // ### please come up with a nicer name
00126   void setSeparatorPosX(int pos, bool do_resize=false);
00127 
00132   virtual bool eventFilter(QObject *, QEvent *);
00133   virtual bool event( QEvent * );
00134 
00138   QWidget* getFirst() const { return child0; }
00142   QWidget* getLast() const { return child1; }
00147   QWidget* getAnother( QWidget* w ) const;
00148   void updateName();
00149 
00155   void setOpaqueResize(bool b=true);
00156   bool opaqueResize() const;
00157 
00162   void setKeepSize(bool b=true);
00163   bool keepSize() const;
00164 
00165 
00166   void setForcedFixedWidth(KDockWidget *dw,int w);
00167   void setForcedFixedHeight(KDockWidget *dw,int h);
00168   void restoreFromForcedFixedSize(KDockWidget *dw);
00169 
00173   Orientation orientation(){return m_orientation;}
00174 
00175 protected:
00176   friend class  KDockContainer;
00182   int checkValue(int position) const;
00190   int checkValueOverlapped(int position, QWidget* child) const;
00191 
00206   virtual void resizeEvent(QResizeEvent *ev);
00207 
00208 /*
00209 protected slots:
00210   void delayedResize();*/
00211 
00212 private:
00218   void setupMinMaxSize();
00224   QWidget *child0, *child1;
00225   Orientation m_orientation;
00229   bool initialised;
00234   QFrame* divider;
00245   int xpos, savedXPos;
00246   bool mOpaqueResize, mKeepSize;
00247   int fixedWidth0,fixedWidth1;
00248   int fixedHeight0,fixedHeight1;
00249   bool m_dontRecalc;
00253   static const int factor = 100000;
00254 };
00255 
00256 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys