home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / qt3_emx.zip / include / qsplitter.h < prev    next >
C/C++ Source or Header  |  2001-10-11  |  4KB  |  132 lines

  1. /****************************************************************************
  2. ** $Id:  qt/qsplitter.h   3.0.0   edited Sep 21 17:17 $
  3. **
  4. ** Defintion of  QSplitter class
  5. **
  6. **  Created:  980105
  7. **
  8. ** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
  9. **
  10. ** This file is part of the widgets module of the Qt GUI Toolkit.
  11. **
  12. ** This file may be distributed under the terms of the Q Public License
  13. ** as defined by Trolltech AS of Norway and appearing in the file
  14. ** LICENSE.QPL included in the packaging of this file.
  15. **
  16. ** This file may be distributed and/or modified under the terms of the
  17. ** GNU General Public License version 2 as published by the Free Software
  18. ** Foundation and appearing in the file LICENSE.GPL included in the
  19. ** packaging of this file.
  20. **
  21. ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
  22. ** licenses may use this file in accordance with the Qt Commercial License
  23. ** Agreement provided with the Software.
  24. **
  25. ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  26. ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  27. **
  28. ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
  29. **   information about Qt Commercial License Agreements.
  30. ** See http://www.trolltech.com/qpl/ for QPL licensing information.
  31. ** See http://www.trolltech.com/gpl/ for GPL licensing information.
  32. **
  33. ** Contact info@trolltech.com if any conditions of this licensing are
  34. ** not clear to you.
  35. **
  36. **********************************************************************/
  37. #ifndef QSPLITTER_H
  38. #define QSPLITTER_H
  39.  
  40. #ifndef QT_H
  41. #include "qframe.h"
  42. #include "qvaluelist.h"
  43. #endif // QT_H
  44.  
  45. #ifndef QT_NO_SPLITTER
  46.  
  47. class QSplitterHandle;
  48. class QSplitterData;
  49. class QSplitterLayoutStruct;
  50.  
  51. class Q_EXPORT QSplitter : public QFrame
  52. {
  53.     Q_OBJECT
  54.     Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation )
  55.  
  56. public:
  57.     enum ResizeMode { Stretch, KeepSize, FollowSizeHint };
  58.  
  59.     QSplitter( QWidget* parent=0, const char* name=0 );
  60.     QSplitter( Orientation, QWidget* parent=0, const char* name=0 );
  61.     ~QSplitter();
  62.  
  63.     virtual void setOrientation( Orientation );
  64.     Orientation orientation() const { return orient; }
  65.  
  66.     virtual void setResizeMode( QWidget *w, ResizeMode );
  67.     virtual void setOpaqueResize( bool = TRUE );
  68.     bool opaqueResize() const;
  69.  
  70.     void moveToFirst( QWidget * );
  71.     void moveToLast( QWidget * );
  72.  
  73.     void refresh() { recalc( TRUE ); }
  74.     QSize sizeHint() const;
  75.     QSize minimumSizeHint() const;
  76.  
  77.     QValueList<int> sizes() const;
  78.     void setSizes( QValueList<int> );
  79.  
  80. protected:
  81.     void childEvent( QChildEvent * );
  82.  
  83.     bool event( QEvent * );
  84.     void resizeEvent( QResizeEvent * );
  85.  
  86.     int idAfter( QWidget* ) const;
  87.  
  88.     void moveSplitter( QCOORD pos, int id );
  89.     virtual void drawSplitter( QPainter*, QCOORD x, QCOORD y,
  90.                    QCOORD w, QCOORD h );
  91.     void styleChange( QStyle& );
  92.     int adjustPos( int , int );
  93.     virtual void setRubberband( int );
  94.     void getRange( int id, int*, int* );
  95.  
  96. private:
  97.     void init();
  98.     void recalc( bool update = FALSE );
  99.     void doResize();
  100.     void storeSizes();
  101.     void processChildEvents();
  102.     QSplitterLayoutStruct *addWidget( QWidget*, bool first = FALSE );
  103.     void recalcId();
  104.     void moveBefore( int pos, int id, bool upLeft );
  105.     void moveAfter( int pos, int id, bool upLeft );
  106.     void setG( QWidget *w, int p, int s, bool isSplitter = FALSE );
  107.  
  108.     QCOORD pick( const QPoint &p ) const
  109.     { return orient == Horizontal ? p.x() : p.y(); }
  110.     QCOORD pick( const QSize &s ) const
  111.     { return orient == Horizontal ? s.width() : s.height(); }
  112.  
  113.     QCOORD trans( const QPoint &p ) const
  114.     { return orient == Vertical ? p.x() : p.y(); }
  115.     QCOORD trans( const QSize &s ) const
  116.     { return orient == Vertical ? s.width() : s.height(); }
  117.  
  118.     QSplitterData *data;
  119.  
  120.     Orientation orient;
  121.     friend class QSplitterHandle;
  122. private:    // Disabled copy constructor and operator=
  123. #if defined(Q_DISABLE_COPY)
  124.     QSplitter( const QSplitter & );
  125.     QSplitter& operator=( const QSplitter & );
  126. #endif
  127. };
  128.  
  129. #endif // QT_NO_SPLITTER
  130.  
  131. #endif // QSPLITTER_H
  132.