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

  1. /****************************************************************************
  2. ** $Id:  qt/qstylesheet.h   3.0.0   edited Sep 28 15:51 $
  3. **
  4. ** Definition of the QStyleSheet class
  5. **
  6. ** Created : 990101
  7. **
  8. ** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
  9. **
  10. ** This file is part of the kernel 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 QSTYLESHEET_H
  39. #define QSTYLESHEET_H
  40.  
  41. #ifndef QT_H
  42. #include "qstring.h"
  43. #include "qvaluelist.h"
  44. #include "qptrvector.h"
  45. #include "qdict.h"
  46. #include "qobject.h"
  47. #endif // QT_H
  48.  
  49. #ifndef QT_NO_RICHTEXT
  50.  
  51. class QStyleSheet;
  52. class QTextDocument;
  53. template<class Key, class T> class QMap;
  54. class QStyleSheetItemData;
  55.  
  56. class Q_EXPORT QStyleSheetItem : public Qt
  57. {
  58. public:
  59.     QStyleSheetItem( QStyleSheet* parent, const QString& name );
  60.     QStyleSheetItem( const QStyleSheetItem & );
  61.     ~QStyleSheetItem();
  62.  
  63.     QString name() const;
  64.  
  65.     QStyleSheet* styleSheet();
  66.     const QStyleSheet* styleSheet() const;
  67.  
  68.     enum AdditionalStyleValues { Undefined  = - 1};
  69.  
  70.     enum DisplayMode {
  71.     DisplayBlock,
  72.     DisplayInline,
  73.     DisplayListItem,
  74.     DisplayNone
  75.     };
  76.  
  77.     DisplayMode displayMode() const;
  78.     void setDisplayMode(DisplayMode m);
  79.  
  80.     int alignment() const;
  81.     void setAlignment( int f);
  82.     
  83.     enum VerticalAlignment {
  84.     VAlignBaseline,
  85.     VAlignSub,
  86.     VAlignSuper
  87.     };
  88.     
  89.     VerticalAlignment verticalAlignment() const;
  90.     void setVerticalAlignment( VerticalAlignment valign );
  91.  
  92.     int fontWeight() const;
  93.     void setFontWeight(int w);
  94.  
  95.     int logicalFontSize() const;
  96.     void setLogicalFontSize(int s);
  97.  
  98.     int logicalFontSizeStep() const;
  99.     void setLogicalFontSizeStep( int s );
  100.  
  101.     int fontSize() const;
  102.     void setFontSize(int s);
  103.  
  104.     QString fontFamily() const;
  105.     void setFontFamily( const QString& );
  106.  
  107.     int numberOfColumns() const;
  108.     void setNumberOfColumns(int ncols);
  109.  
  110.     QColor color() const;
  111.     void setColor( const QColor &);
  112.  
  113.     bool fontItalic() const;
  114.     void setFontItalic( bool );
  115.     bool definesFontItalic() const;
  116.  
  117.     bool fontUnderline() const;
  118.     void setFontUnderline( bool );
  119.     bool definesFontUnderline() const;
  120.  
  121.     bool isAnchor() const;
  122.     void setAnchor(bool anc);
  123.  
  124.     enum WhiteSpaceMode { WhiteSpaceNormal, WhiteSpacePre, WhiteSpaceNoWrap };
  125.     WhiteSpaceMode whiteSpaceMode() const;
  126.     void setWhiteSpaceMode(WhiteSpaceMode m);
  127.  
  128.     enum Margin {
  129.     MarginLeft,
  130.     MarginRight,
  131.     MarginTop,
  132.     MarginBottom,
  133.     MarginFirstLine,
  134.     MarginAll,
  135.     MarginVertical,
  136.     MarginHorizontal
  137.     };
  138.  
  139.     int margin( Margin m) const;
  140.     void setMargin( Margin, int);
  141.  
  142.     enum ListStyle {
  143.     ListDisc,
  144.     ListCircle,
  145.     ListSquare,
  146.     ListDecimal,
  147.     ListLowerAlpha,
  148.     ListUpperAlpha
  149.     };
  150.  
  151.     ListStyle listStyle() const;
  152.     void setListStyle( ListStyle );
  153.  
  154.     QString contexts() const;
  155.     void setContexts( const QString& );
  156.     bool allowedInContext( const QStyleSheetItem* ) const;
  157.  
  158.     bool selfNesting() const;
  159.     void setSelfNesting( bool );
  160.  
  161.     void setLineSpacing( int ls );
  162.     int lineSpacing() const;
  163.  
  164. private:
  165.     void init();
  166.     QStyleSheetItemData* d;
  167. };
  168.  
  169.  
  170. #if defined(Q_TEMPLATEDLL)
  171. // MOC_SKIP_BEGIN
  172. template class Q_EXPORT QDict<QStyleSheetItem>;
  173. template class Q_EXPORT QValueList< QPtrVector<QStyleSheetItem> >;
  174. template class Q_EXPORT QPtrVector<QStyleSheetItem>;
  175. template class Q_EXPORT QValueList<QStyleSheetItem::ListStyle>;
  176. // MOC_SKIP_END
  177. #endif
  178.  
  179. class QTextCustomItem;
  180.  
  181. class Q_EXPORT QStyleSheet : public QObject
  182. {
  183.     Q_OBJECT
  184. public:
  185.     QStyleSheet( QObject *parent=0, const char *name=0 );
  186.     virtual ~QStyleSheet();
  187.  
  188.     static QStyleSheet* defaultSheet();
  189.     static void setDefaultSheet( QStyleSheet* );
  190.  
  191.  
  192.     QStyleSheetItem* item( const QString& name);
  193.     const QStyleSheetItem* item( const QString& name) const;
  194.  
  195.     void insert( QStyleSheetItem* item);
  196.  
  197.     virtual QTextCustomItem* tag( const QString& name,
  198.                 const QMap<QString, QString> &attr,
  199.                 const QString& context,
  200.                 const QMimeSourceFactory& factory,
  201.                 bool emptyTag, QTextDocument *doc ) const;
  202.  
  203.     static QString escape( const QString& );
  204.     static QString convertFromPlainText( const QString&, QStyleSheetItem::WhiteSpaceMode mode = QStyleSheetItem::WhiteSpacePre );
  205.     static bool mightBeRichText( const QString& );
  206.  
  207.     virtual void scaleFont( QFont& font, int logicalSize ) const;
  208.  
  209.     virtual void error( const QString& ) const;
  210.  
  211. private:
  212.     void init();
  213.     QDict<QStyleSheetItem> styles;
  214.     QStyleSheetItem* nullstyle;
  215. };
  216.  
  217. #endif // QT_NO_RICHTEXT
  218.  
  219. #endif // QSTYLESHEET_H
  220.