Eneboo - Documentación para desarrolladores
src/qt/src/kernel/qstylesheet.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qstylesheet.h   3.3.8   edited Jan 11 14:38 $
00003 **
00004 ** Definition of the QStyleSheet class
00005 **
00006 ** Created : 990101
00007 **
00008 ** Copyright (C) 1992-2007 Trolltech ASA.  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 ASA 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 "qstring.h"
00043 #include "qvaluelist.h"
00044 #include "qptrvector.h"
00045 #include "qdict.h"
00046 #include "qobject.h"
00047 #endif // QT_H
00048 
00049 #ifndef QT_NO_RICHTEXT
00050 
00051 class QStyleSheet;
00052 class QTextDocument;
00053 template<class Key, class T> class QMap;
00054 class QStyleSheetItemData;
00055 
00056 class Q_EXPORT QStyleSheetItem : public Qt
00057 {
00058 public:
00059     QStyleSheetItem( QStyleSheet* parent, const QString& name );
00060     QStyleSheetItem( const QStyleSheetItem & );
00061     ~QStyleSheetItem();
00062 
00063     QStyleSheetItem& operator=( const QStyleSheetItem& other );
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 #ifndef Q_QDOC
00078         , DisplayModeUndefined = -1
00079 #endif
00080     };
00081 
00082     DisplayMode displayMode() const;
00083     void setDisplayMode(DisplayMode m);
00084 
00085     int alignment() const;
00086     void setAlignment( int f);
00087 
00088     enum VerticalAlignment {
00089         VAlignBaseline,
00090         VAlignSub,
00091         VAlignSuper
00092     };
00093 
00094     VerticalAlignment verticalAlignment() const;
00095     void setVerticalAlignment( VerticalAlignment valign );
00096 
00097     int fontWeight() const;
00098     void setFontWeight(int w);
00099 
00100     int logicalFontSize() const;
00101     void setLogicalFontSize(int s);
00102 
00103     int logicalFontSizeStep() const;
00104     void setLogicalFontSizeStep( int s );
00105 
00106     int fontSize() const;
00107     void setFontSize(int s);
00108 
00109     QString fontFamily() const;
00110     void setFontFamily( const QString& );
00111 
00112     int numberOfColumns() const;
00113     void setNumberOfColumns(int ncols);
00114 
00115     QColor color() const;
00116     void setColor( const QColor &);
00117 
00118     bool fontItalic() const;
00119     void setFontItalic( bool );
00120     bool definesFontItalic() const;
00121 
00122     bool fontUnderline() const;
00123     void setFontUnderline( bool );
00124     bool definesFontUnderline() const;
00125 
00126     bool fontStrikeOut() const;
00127     void setFontStrikeOut( bool );
00128     bool definesFontStrikeOut() const;
00129 
00130     bool isAnchor() const;
00131     void setAnchor(bool anc);
00132 
00133     enum WhiteSpaceMode {
00134         WhiteSpaceNormal,
00135         WhiteSpacePre,
00136         WhiteSpaceNoWrap
00137 #ifndef Q_QDOC
00138         , WhiteSpaceModeUndefined = -1
00139 #endif
00140     };
00141     WhiteSpaceMode whiteSpaceMode() const;
00142     void setWhiteSpaceMode(WhiteSpaceMode m);
00143 
00144     enum Margin {
00145         MarginLeft,
00146         MarginRight,
00147         MarginTop,
00148         MarginBottom,
00149         MarginFirstLine,
00150         MarginAll,
00151         MarginVertical,
00152         MarginHorizontal
00153 #ifndef Q_QDOC
00154         , MarginUndefined = -1
00155 #endif
00156     };
00157 
00158     int margin( Margin m) const;
00159     void setMargin( Margin, int);
00160 
00161     enum ListStyle {
00162         ListDisc,
00163         ListCircle,
00164         ListSquare,
00165         ListDecimal,
00166         ListLowerAlpha,
00167         ListUpperAlpha
00168 #ifndef Q_QDOC
00169         , ListStyleUndefined = -1
00170 #endif
00171     };
00172 
00173     ListStyle listStyle() const;
00174     void setListStyle( ListStyle );
00175 
00176     QString contexts() const;
00177     void setContexts( const QString& );
00178     bool allowedInContext( const QStyleSheetItem* ) const;
00179 
00180     bool selfNesting() const;
00181     void setSelfNesting( bool );
00182 
00183     void setLineSpacing( int ls );
00184     int lineSpacing() const;
00185 
00186 private:
00187     void init();
00188     QStyleSheetItemData* d;
00189 };
00190 
00191 
00192 #if defined(Q_TEMPLATEDLL)
00193 // MOC_SKIP_BEGIN
00194 Q_TEMPLATE_EXTERN template class Q_EXPORT QDict<QStyleSheetItem>;
00195 Q_TEMPLATE_EXTERN template class Q_EXPORT QValueList< QPtrVector<QStyleSheetItem> >;
00196 Q_TEMPLATE_EXTERN template class Q_EXPORT QPtrVector<QStyleSheetItem>;
00197 Q_TEMPLATE_EXTERN template class Q_EXPORT QValueList<QStyleSheetItem::ListStyle>;
00198 // MOC_SKIP_END
00199 #endif
00200 
00201 #ifndef QT_NO_TEXTCUSTOMITEM
00202 class QTextCustomItem;
00203 #endif
00204 
00205 class Q_EXPORT QStyleSheet : public QObject
00206 {
00207     Q_OBJECT
00208 public:
00209     QStyleSheet( QObject *parent=0, const char *name=0 );
00210     virtual ~QStyleSheet();
00211 
00212     static QStyleSheet* defaultSheet();
00213     static void setDefaultSheet( QStyleSheet* );
00214 
00215 
00216     QStyleSheetItem* item( const QString& name);
00217     const QStyleSheetItem* item( const QString& name) const;
00218 
00219     void insert( QStyleSheetItem* item);
00220 
00221 #ifndef QT_NO_TEXTCUSTOMITEM
00222     virtual QTextCustomItem* tag( const QString& name,
00223                                   const QMap<QString, QString> &attr,
00224                                   const QString& context,
00225                                   const QMimeSourceFactory& factory,
00226                                   bool emptyTag, QTextDocument *doc ) const;
00227 #endif
00228     static QString escape( const QString& );
00229     static QString convertFromPlainText( const QString&,
00230                                          QStyleSheetItem::WhiteSpaceMode mode = QStyleSheetItem::WhiteSpacePre );
00231     static bool mightBeRichText( const QString& );
00232 
00233     virtual void scaleFont( QFont& font, int logicalSize ) const;
00234 
00235     virtual void error( const QString& ) const;
00236 
00237 private:
00238     void init();
00239     QDict<QStyleSheetItem> styles;
00240     QStyleSheetItem* nullstyle;
00241 private:        // Disabled copy constructor and operator=
00242 #if defined(Q_DISABLE_COPY)
00243     QStyleSheet( const QStyleSheet & );
00244     QStyleSheet &operator=( const QStyleSheet & );
00245 #endif
00246 };
00247 
00248 #endif // QT_NO_RICHTEXT
00249 
00250 #endif // QSTYLESHEET_H
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'