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

  1. /**********************************************************************
  2. ** $Id:  qt/qlabel.h   3.0.0   edited Sep 21 17:17 $
  3. **
  4. ** Definition of QLabel widget class
  5. **
  6. ** Created : 941215
  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 QLABEL_H
  39. #define QLABEL_H
  40.  
  41. #ifndef QT_H
  42. #include "qframe.h"
  43. #endif // QT_H
  44.  
  45. #ifndef QT_NO_LABEL
  46.  
  47. class QSimpleRichText;
  48. class QLabelPrivate;
  49.  
  50. class Q_EXPORT QLabel : public QFrame
  51. {
  52.     Q_OBJECT
  53.     Q_PROPERTY( QString text READ text WRITE setText )
  54.     Q_PROPERTY( TextFormat textFormat READ textFormat WRITE setTextFormat )
  55.     Q_PROPERTY( QPixmap pixmap READ pixmap WRITE setPixmap )
  56.     Q_PROPERTY( bool scaledContents READ hasScaledContents WRITE setScaledContents )
  57.     Q_PROPERTY( Alignment alignment READ alignment WRITE setAlignment )
  58.     Q_PROPERTY( int indent READ indent WRITE setIndent )
  59.  
  60. public:
  61.     QLabel( QWidget *parent, const char* name=0, WFlags f=0 );
  62.     QLabel( const QString &text, QWidget *parent, const char* name=0,
  63.         WFlags f=0 );
  64.     QLabel( QWidget *buddy, const QString &,
  65.         QWidget *parent, const char* name=0, WFlags f=0 );
  66.     ~QLabel();
  67.  
  68.     QString     text()        const    { return ltext; }
  69.     QPixmap     *pixmap()    const    { return lpixmap; }
  70. #ifndef QT_NO_PICTURE
  71.     QPicture    *picture()    const    { return lpicture; }
  72. #endif
  73. #ifndef QT_NO_MOVIE
  74.     QMovie      *movie()        const;
  75. #endif
  76.  
  77.     TextFormat textFormat() const;
  78.     void      setTextFormat( TextFormat );
  79.  
  80.     int         alignment() const    { return align; }
  81.     virtual void setAlignment( int );
  82.     int         indent() const        { return extraMargin; }
  83.     void      setIndent( int );
  84.  
  85.     bool      autoResize() const    { return autoresize; }
  86.     virtual void setAutoResize( bool );
  87. #ifndef QT_NO_IMAGE_SMOOTHSCALE
  88.     bool     hasScaledContents() const;
  89.     void     setScaledContents( bool );
  90. #endif
  91.     QSize     sizeHint() const;
  92.     QSize     minimumSizeHint() const;
  93. #ifndef QT_NO_ACCEL
  94.     virtual void setBuddy( QWidget * );
  95.     QWidget     *buddy() const;
  96. #endif
  97.     int         heightForWidth(int) const;
  98.  
  99.     void setFont( const QFont &f );
  100.  
  101. public slots:
  102.     virtual void setText( const QString &);
  103.     virtual void setPixmap( const QPixmap & );
  104. #ifndef QT_NO_PICTURE
  105.     virtual void setPicture( const QPicture & );
  106. #endif
  107. #ifndef QT_NO_MOVIE
  108.     virtual void setMovie( const QMovie & );
  109. #endif
  110.     virtual void setNum( int );
  111.     virtual void setNum( double );
  112.     void     clear();
  113.  
  114. protected:
  115.     void     drawContents( QPainter * );
  116.     void     fontChange( const QFont & );
  117.     void     resizeEvent( QResizeEvent* );
  118.  
  119. private slots:
  120. #ifndef QT_NO_ACCEL
  121.     void     acceleratorSlot();
  122.     void     buddyDied();
  123. #endif
  124. #ifndef QT_NO_MOVIE
  125.     void     movieUpdated(const QRect&);
  126.     void     movieResized(const QSize&);
  127. #endif
  128.  
  129. private:
  130.     void    init();
  131.     void    clearContents();
  132.     void    updateLabel( QSize oldSizeHint );
  133.     QSize    sizeForWidth( int w ) const;
  134.     QString    ltext;
  135.     QPixmap    *lpixmap;
  136. #ifndef QT_NO_PICTURE
  137.     QPicture   *lpicture;
  138. #endif
  139. #ifndef QT_NO_MOVIE
  140.     QMovie *    lmovie;
  141. #endif
  142. #ifndef QT_NO_ACCEL
  143.     QWidget *    lbuddy;
  144. #endif
  145.     ushort    align;
  146.     short    extraMargin;
  147.     uint    autoresize:1;
  148.     uint    scaledcontents :1;
  149.     TextFormat textformat;
  150. #ifndef QT_NO_RICHTEXT
  151.     QSimpleRichText* doc;
  152. #endif
  153. #ifndef QT_NO_ACCEL
  154.     QAccel *    accel;
  155. #endif
  156.     QLabelPrivate* d;
  157.  
  158. private:    // Disabled copy constructor and operator=
  159. #if defined(Q_DISABLE_COPY)
  160.     QLabel( const QLabel & );
  161.     QLabel &operator=( const QLabel & );
  162. #endif
  163. };
  164.  
  165.  
  166. #endif // QT_NO_LABEL
  167.  
  168. #endif // QLABEL_H
  169.