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

  1. /****************************************************************************
  2. ** $Id:  qt/qframe.h   3.0.0   edited Sep 21 17:17 $
  3. **
  4. ** Definition of QFrame widget class
  5. **
  6. ** Created : 950201
  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.  
  38. #ifndef QFRAME_H
  39. #define QFRAME_H
  40.  
  41. #ifndef QT_H
  42. #include "qwidget.h"
  43. #endif // QT_H
  44.  
  45. #ifndef QT_NO_FRAME
  46.  
  47. class Q_EXPORT QFrame : public QWidget
  48. {
  49.     Q_OBJECT
  50.     Q_ENUMS( Shape Shadow )
  51.     Q_PROPERTY( int frameWidth READ frameWidth )
  52.     Q_PROPERTY( QRect contentsRect READ contentsRect )
  53.     Q_PROPERTY( Shape frameShape READ frameShape WRITE setFrameShape )
  54.     Q_PROPERTY( Shadow frameShadow READ frameShadow WRITE setFrameShadow )
  55.     Q_PROPERTY( int lineWidth READ lineWidth WRITE setLineWidth )
  56.     Q_PROPERTY( int margin READ margin WRITE setMargin )
  57.     Q_PROPERTY( int midLineWidth READ midLineWidth WRITE setMidLineWidth )
  58.     Q_PROPERTY( QRect frameRect READ frameRect WRITE setFrameRect DESIGNABLE false )
  59.  
  60. public:
  61.     QFrame( QWidget* parent=0, const char* name=0, WFlags f=0 );
  62.  
  63.     int         frameStyle()    const;
  64.     virtual void setFrameStyle( int );
  65.  
  66.     int         frameWidth()    const;
  67.     QRect       contentsRect()  const;
  68.  
  69. #ifndef Q_QDOC
  70.     bool        lineShapesOk()  const { return TRUE; }
  71. #endif
  72.  
  73.     QSize       sizeHint() const;
  74.  
  75.     enum Shape { NoFrame  = 0,                  // no frame
  76.                  Box      = 0x0001,             // rectangular box
  77.                  Panel    = 0x0002,             // rectangular panel
  78.                  WinPanel = 0x0003,             // rectangular panel (Windows)
  79.                  HLine    = 0x0004,             // horizontal line
  80.                  VLine    = 0x0005,             // vertical line
  81.                  StyledPanel = 0x0006,          // rectangular panel depending on the GUI style
  82.                  PopupPanel = 0x0007,           // rectangular panel depending on the GUI style
  83.                  MenuBarPanel = 0x0008,
  84.                  ToolBarPanel = 0x0009,
  85.                  MShape   = 0x000f              // mask for the shape
  86.     };
  87.     enum Shadow { Plain    = 0x0010,            // plain line
  88.                   Raised   = 0x0020,            // raised shadow effect
  89.                   Sunken   = 0x0030,            // sunken shadow effect
  90.                   MShadow  = 0x00f0 };          // mask for the shadow
  91.  
  92.     Shape       frameShape()    const;
  93.     void        setFrameShape( Shape );
  94.     Shadow      frameShadow()   const;
  95.     void        setFrameShadow( Shadow );
  96.  
  97.     int         lineWidth()     const;
  98.     virtual void setLineWidth( int );
  99.  
  100.     int         margin()        const;
  101.     virtual void setMargin( int );
  102.  
  103.     int         midLineWidth()  const;
  104.     virtual void setMidLineWidth( int );
  105.  
  106.     QRect       frameRect()     const;
  107.     virtual void setFrameRect( const QRect & );
  108.  
  109. protected:
  110.     void        paintEvent( QPaintEvent * );
  111.     void        resizeEvent( QResizeEvent * );
  112.     virtual void drawFrame( QPainter * );
  113.     virtual void drawContents( QPainter * );
  114.     virtual void frameChanged();
  115.  
  116. private:
  117.     void        updateFrameWidth();
  118.     QRect       frect;
  119.     int         fstyle;
  120.     short       lwidth;
  121.     short       mwidth;
  122.     short       mlwidth;
  123.     short       fwidth;
  124.  
  125.     void * d;
  126. private:        // Disabled copy constructor and operator=
  127. #if defined(Q_DISABLE_COPY)
  128.     QFrame( const QFrame & );
  129.     QFrame &operator=( const QFrame & );
  130. #endif
  131. };
  132.  
  133.  
  134. inline int QFrame::frameStyle() const
  135. { return fstyle; }
  136.  
  137. inline QFrame::Shape QFrame::frameShape() const
  138. { return (Shape) ( fstyle & MShape ); }
  139.  
  140. inline QFrame::Shadow QFrame::frameShadow() const
  141. { return (Shadow) ( fstyle & MShadow ); }
  142.  
  143. inline void QFrame::setFrameShape( QFrame::Shape s )
  144. { setFrameStyle( ( fstyle & MShadow ) | s ); }
  145.  
  146. inline void QFrame::setFrameShadow( QFrame::Shadow s )
  147. { setFrameStyle( ( fstyle & MShape ) | s ); }
  148.  
  149. inline int QFrame::lineWidth() const
  150. { return lwidth; }
  151.  
  152. inline int QFrame::midLineWidth() const
  153. { return mlwidth; }
  154.  
  155. inline int QFrame::margin() const
  156. { return mwidth; }
  157.  
  158. inline int QFrame::frameWidth() const
  159. { return fwidth; }
  160.  
  161.  
  162. #endif // QT_NO_FRAME
  163.  
  164. #endif // QFRAME_H
  165.