Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

qstylesheet.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 ** $Id: qstylesheet.h,v 1.2 2002/07/15 23:22:50 leseb Exp $
00003 **
00004 ** Definition of the QStyleSheet class
00005 **
00006 ** Created : 990101
00007 **
00008 ** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
00009 **
00010 ** This file is part of the kernel module of the Qt GUI Toolkit.
00011 **
00012 ** This file may be distributed under the terms of the Q Public License
00013 ** as defined by Trolltech AS of Norway and appearing in the file
00014 ** LICENSE.QPL included in the packaging of this file.
00015 **
00016 ** This file may be distributed and/or modified under the terms of the
00017 ** GNU General Public License version 2 as published by the Free Software
00018 ** Foundation and appearing in the file LICENSE.GPL included in the
00019 ** packaging of this file.
00020 **
00021 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
00022 ** licenses may use this file in accordance with the Qt Commercial License
00023 ** Agreement provided with the Software.
00024 **
00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00027 **
00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00029 **   information about Qt Commercial License Agreements.
00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00032 **
00033 ** Contact info@trolltech.com if any conditions of this licensing are
00034 ** not clear to you.
00035 **
00036 **********************************************************************/
00037 
00038 #ifndef QSTYLESHEET_H
00039 #define QSTYLESHEET_H
00040 
00041 #ifndef QT_H
00042 #include "qt3namespace.h"
00043 #include "qstring.h"
00044 #include "qvaluelist.h"
00045 #include "qvector.h"
00046 #include "qdict.h"
00047 #include "qobject.h"
00048 #endif // QT_H
00049 
00050 template<class Key, class T> class QMap;
00051 
00052 namespace Qt3 {
00053 
00054 class QStyleSheet;
00055 class QTextDocument;
00056 class QStyleSheetItemData;
00057 
00058 class Q_EXPORT QStyleSheetItem : public Qt
00059 {
00060 public:
00061     QStyleSheetItem( QStyleSheet* parent, const QString& name );
00062     QStyleSheetItem( const QStyleSheetItem & );
00063     ~QStyleSheetItem();
00064 
00065     QString name() const;
00066 
00067     QStyleSheet* styleSheet();
00068     const QStyleSheet* styleSheet() const;
00069 
00070     enum AdditionalStyleValues { Undefined  = - 1};
00071 
00072     enum DisplayMode {
00073         DisplayBlock,
00074         DisplayInline,
00075         DisplayListItem,
00076         DisplayNone
00077     };
00078 
00079     DisplayMode displayMode() const;
00080     void setDisplayMode(DisplayMode m);
00081 
00082     int alignment() const;
00083     void setAlignment( int f);
00084 
00085     enum VerticalAlignment {
00086         VAlignBaseline,
00087         VAlignSub,
00088         VAlignSuper
00089     };
00090 
00091     VerticalAlignment verticalAlignment() const;
00092     void setVerticalAlignment( VerticalAlignment valign );
00093 
00094     int fontWeight() const;
00095     void setFontWeight(int w);
00096 
00097     int logicalFontSize() const;
00098     void setLogicalFontSize(int s);
00099 
00100     int logicalFontSizeStep() const;
00101     void setLogicalFontSizeStep( int s );
00102 
00103     int fontSize() const;
00104     void setFontSize(int s);
00105 
00106     QString fontFamily() const;
00107     void setFontFamily( const QString& );
00108 
00109     int numberOfColumns() const;
00110     void setNumberOfColumns(int ncols);
00111 
00112     QColor color() const;
00113     void setColor( const QColor &);
00114 
00115     bool fontItalic() const;
00116     void setFontItalic( bool );
00117     bool definesFontItalic() const;
00118 
00119     bool fontUnderline() const;
00120     void setFontUnderline( bool );
00121     bool definesFontUnderline() const;
00122 
00123     bool fontStrikeOut() const;
00124     void setFontStrikeOut( bool );
00125     bool definesFontStrikeOut() const;
00126 
00127     bool isAnchor() const;
00128     void setAnchor(bool anc);
00129 
00130     enum WhiteSpaceMode { WhiteSpaceNormal, WhiteSpacePre, WhiteSpaceNoWrap };
00131     WhiteSpaceMode whiteSpaceMode() const;
00132     void setWhiteSpaceMode(WhiteSpaceMode m);
00133 
00134     enum Margin {
00135         MarginLeft,
00136         MarginRight,
00137         MarginTop,
00138         MarginBottom,
00139         MarginFirstLine,
00140         MarginAll,
00141         MarginVertical,
00142         MarginHorizontal
00143     };
00144 
00145     int margin( Margin m) const;
00146     void setMargin( Margin, int);
00147 
00148     enum ListStyle {
00149         ListDisc,
00150         ListCircle,
00151         ListSquare,
00152         ListDecimal,
00153         ListLowerAlpha,
00154         ListUpperAlpha
00155     };
00156 
00157     ListStyle listStyle() const;
00158     void setListStyle( ListStyle );
00159 
00160     QString contexts() const;
00161     void setContexts( const QString& );
00162     bool allowedInContext( const QStyleSheetItem* ) const;
00163 
00164     bool selfNesting() const;
00165     void setSelfNesting( bool );
00166 
00167     void setLineSpacing( int ls );
00168     int lineSpacing() const;
00169 
00170 private:
00171     void init();
00172     QStyleSheetItemData* d;
00173 };
00174 
00175 
00176 #if defined(Q_TEMPLATEDLL)
00177 // MOC_SKIP_BEGIN
00178 Q_TEMPLATE_EXTERN template class Q_EXPORT QDict<QStyleSheetItem>;
00179 Q_TEMPLATE_EXTERN template class Q_EXPORT QValueList< QPtrVector<QStyleSheetItem> >;
00180 Q_TEMPLATE_EXTERN template class Q_EXPORT QPtrVector<QStyleSheetItem>;
00181 Q_TEMPLATE_EXTERN template class Q_EXPORT QValueList<QStyleSheetItem::ListStyle>;
00182 // MOC_SKIP_END
00183 #endif
00184 
00185 class QTextCustomItem;
00186 
00187 class Q_EXPORT QStyleSheet : public QObject
00188 {
00189     Q_OBJECT
00190 public:
00191     QStyleSheet( QObject *parent=0, const char *name=0 );
00192     virtual ~QStyleSheet();
00193 
00194     static QStyleSheet* defaultSheet();
00195     static void setDefaultSheet( QStyleSheet* );
00196 
00197 
00198     QStyleSheetItem* item( const QString& name);
00199     const QStyleSheetItem* item( const QString& name) const;
00200 
00201     void insert( QStyleSheetItem* item);
00202 
00203     virtual QTextCustomItem* tag( const QString& name,
00204                             const QMap<QString, QString> &attr,
00205                             const QString& context,
00206                             const QMimeSourceFactory& factory,
00207                             bool emptyTag, QTextDocument *doc ) const;
00208 
00209     static QString escape( const QString& );
00210     static QString convertFromPlainText( const QString&, QStyleSheetItem::WhiteSpaceMode mode = QStyleSheetItem::WhiteSpacePre );
00211     static bool mightBeRichText( const QString& );
00212 
00213     virtual void scaleFont( QFont& font, int logicalSize ) const;
00214 
00215     virtual void error( const QString& ) const;
00216 
00217 private:
00218     void init();
00219     QDict<QStyleSheetItem> styles;
00220     QStyleSheetItem* nullstyle;
00221 };
00222 
00223 } // namespace Qt3
00224 
00225 #endif // QSTYLESHEET_H

Generated on Sat Nov 5 16:17:06 2005 for OPIE by  doxygen 1.4.2