Eneboo - Documentación para desarrolladores
src/qt/include/qfont.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qfont.h   3.3.8   edited Jan 11 14:38 $
00003 **
00004 ** Definition of QFont class
00005 **
00006 ** Created : 940514
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 QFONT_H
00039 #define QFONT_H
00040 
00041 #ifndef QT_H
00042 #include "qwindowdefs.h"
00043 #include "qstring.h"
00044 #endif // QT_H
00045 
00046 
00047 class QFontPrivate;                                     /* don't touch */
00048 class QStringList;
00049 class QTextFormatCollection;
00050 
00051 class Q_EXPORT QFont
00052 {
00053 public:
00054     enum StyleHint {
00055         Helvetica,  SansSerif = Helvetica,
00056         Times,      Serif = Times,
00057         Courier,    TypeWriter = Courier,
00058         OldEnglish, Decorative = OldEnglish,
00059         System,
00060         AnyStyle
00061     };
00062 
00063     enum StyleStrategy {
00064         PreferDefault    = 0x0001,
00065         PreferBitmap     = 0x0002,
00066         PreferDevice     = 0x0004,
00067         PreferOutline    = 0x0008,
00068         ForceOutline     = 0x0010,
00069         PreferMatch      = 0x0020,
00070         PreferQuality    = 0x0040,
00071         PreferAntialias  = 0x0080,
00072         NoAntialias      = 0x0100,
00073         OpenGLCompatible = 0x0200
00074     };
00075 
00076     enum Weight {
00077         Light    = 25,
00078         Normal   = 50,
00079         DemiBold = 63,
00080         Bold     = 75,
00081         Black    = 87
00082     };
00083 
00084     enum Stretch {
00085         UltraCondensed =  50,
00086         ExtraCondensed =  62,
00087         Condensed      =  75,
00088         SemiCondensed  =  87,
00089         Unstretched    = 100,
00090         SemiExpanded   = 112,
00091         Expanded       = 125,
00092         ExtraExpanded  = 150,
00093         UltraExpanded  = 200
00094     };
00095 
00096     // default font
00097     QFont();
00098     // specific font
00099 #ifdef Q_QDOC
00100     QFont( const QString &family, int pointSize = 12, int weight = Normal,
00101            bool italic = FALSE );
00102 #else
00103     QFont( const QString &family, int pointSize = -1, int weight = -1,
00104            bool italic = FALSE );
00105 #endif
00106     // copy constructor
00107     QFont( const QFont & );
00108 
00109     ~QFont();
00110 
00111     QString family() const;
00112     void setFamily( const QString &);
00113 
00114     int pointSize() const;
00115     float pointSizeFloat() const;
00116     void setPointSize( int );
00117     void setPointSizeFloat( float );
00118 
00119     int pixelSize() const;
00120     void setPixelSize( int );
00121     void setPixelSizeFloat( float );
00122 
00123     int weight() const;
00124     void setWeight( int );
00125 
00126     bool bold() const;
00127     void setBold( bool );
00128 
00129     bool italic() const;
00130     void setItalic( bool );
00131 
00132     bool underline() const;
00133     void setUnderline( bool );
00134 
00135     bool overline() const;
00136     void setOverline( bool );
00137 
00138     bool strikeOut() const;
00139     void setStrikeOut( bool );
00140 
00141     bool fixedPitch() const;
00142     void setFixedPitch( bool );
00143 
00144     StyleHint styleHint() const;
00145     StyleStrategy styleStrategy() const;
00146     void setStyleHint( StyleHint, StyleStrategy = PreferDefault );
00147     void setStyleStrategy( StyleStrategy s );
00148 
00149     int stretch() const;
00150     void setStretch( int );
00151 
00152     // is raw mode still needed?
00153     bool rawMode() const;
00154     void setRawMode( bool );
00155 
00156     // dupicated from QFontInfo
00157     bool exactMatch() const;
00158 
00159     QFont &operator=( const QFont & );
00160     bool operator==( const QFont & ) const;
00161     bool operator!=( const QFont & ) const;
00162     bool isCopyOf( const QFont & ) const;
00163 
00164 
00165 #ifdef Q_WS_WIN
00166     HFONT handle() const;
00167 #else // !Q_WS_WIN
00168     Qt::HANDLE handle() const;
00169 #endif // Q_WS_WIN
00170 
00171 
00172     // needed for X11
00173     void setRawName( const QString & );
00174     QString rawName() const;
00175 
00176     QString key() const;
00177 
00178     QString toString() const;
00179     bool fromString(const QString &);
00180 
00181 #ifndef QT_NO_STRINGLIST
00182     static QString substitute(const QString &);
00183     static QStringList substitutes(const QString &);
00184     static QStringList substitutions();
00185     static void insertSubstitution(const QString&, const QString &);
00186     static void insertSubstitutions(const QString&, const QStringList &);
00187     static void removeSubstitution(const QString &);
00188 #endif //QT_NO_STRINGLIST
00189     static void initialize();
00190     static void cleanup();
00191 #ifndef Q_WS_QWS
00192     static void cacheStatistics();
00193 #endif
00194 
00195 #if defined(Q_WS_QWS)
00196     void qwsRenderToDisk(bool all=TRUE);
00197 #endif
00198 
00199 
00200     // a copy of this lives in qunicodetables.cpp, as we can't include
00201     // qfont.h it in tools/. Do not modify without changing the script
00202     // enum in qunicodetable_p.h aswell.
00203     enum Script {
00204         // European Alphabetic Scripts
00205         Latin,
00206         Greek,
00207         Cyrillic,
00208         Armenian,
00209         Georgian,
00210         Runic,
00211         Ogham,
00212         SpacingModifiers,
00213         CombiningMarks,
00214 
00215         // Middle Eastern Scripts
00216         Hebrew,
00217         Arabic,
00218         Syriac,
00219         Thaana,
00220 
00221         // South and Southeast Asian Scripts
00222         Devanagari,
00223         Bengali,
00224         Gurmukhi,
00225         Gujarati,
00226         Oriya,
00227         Tamil,
00228         Telugu,
00229         Kannada,
00230         Malayalam,
00231         Sinhala,
00232         Thai,
00233         Lao,
00234         Tibetan,
00235         Myanmar,
00236         Khmer,
00237 
00238         // East Asian Scripts
00239         Han,
00240         Hiragana,
00241         Katakana,
00242         Hangul,
00243         Bopomofo,
00244         Yi,
00245 
00246         // Additional Scripts
00247         Ethiopic,
00248         Cherokee,
00249         CanadianAboriginal,
00250         Mongolian,
00251 
00252         // Symbols
00253         CurrencySymbols,
00254         LetterlikeSymbols,
00255         NumberForms,
00256         MathematicalOperators,
00257         TechnicalSymbols,
00258         GeometricSymbols,
00259         MiscellaneousSymbols,
00260         EnclosedAndSquare,
00261         Braille,
00262 
00263         Unicode,
00264 
00265         // some scripts added in Unicode 3.2
00266         Tagalog,
00267         Hanunoo,
00268         Buhid,
00269         Tagbanwa,
00270 
00271         KatakanaHalfWidth,
00272 
00273         // from Unicode 4.0
00274         Limbu,
00275         TaiLe,
00276 
00277         // End
00278 #if !defined(Q_QDOC)
00279         NScripts,
00280         UnknownScript = NScripts,
00281 
00282         NoScript,
00283 
00284         // ----------------------------------------
00285         // Dear User, you can see values > NScript,
00286         // but they are internal - do not touch.
00287 
00288         Han_Japanese,
00289         Han_SimplifiedChinese,
00290         Han_TraditionalChinese,
00291         Han_Korean,
00292 
00293         LastPrivateScript
00294 #endif
00295     };
00296 
00297     QString defaultFamily() const;
00298     QString lastResortFamily() const;
00299     QString lastResortFont() const;
00300 
00301 #ifndef QT_NO_COMPAT
00302 
00303     static QFont defaultFont();
00304     static void setDefaultFont( const QFont & );
00305 
00306 #endif // QT_NO_COMPAT
00307 
00308     QFont resolve( const QFont & ) const;
00309 
00310 protected:
00311     // why protected?
00312     bool dirty() const;
00313     int deciPointSize() const;
00314 
00315 private:
00316     QFont( QFontPrivate *, QPaintDevice *pd );
00317 
00318     void detach();
00319 
00320 #if defined(Q_WS_MAC)
00321     void macSetFont(QPaintDevice *);
00322 #elif defined(Q_WS_X11)
00323     void x11SetScreen( int screen = -1 );
00324     int x11Screen() const;
00325 #endif
00326 
00327     friend class QFontMetrics;
00328     friend class QFontInfo;
00329     friend class QPainter;
00330     friend class QPSPrinterFont;
00331     friend class QApplication;
00332     friend class QWidget;
00333     friend class QTextFormatCollection;
00334     friend class QTextLayout;
00335     friend class QTextItem;
00336     friend class QGLContext;
00337 #if defined(Q_WS_X11) && !defined(QT_NO_XFTFREETYPE)
00338     friend Qt::HANDLE qt_xft_handle(const QFont &font);
00339 #endif
00340 #ifndef QT_NO_DATASTREAM
00341     friend Q_EXPORT QDataStream &operator<<( QDataStream &, const QFont & );
00342     friend Q_EXPORT QDataStream &operator>>( QDataStream &, QFont & );
00343 #endif
00344 
00345     QFontPrivate *d;
00346 };
00347 
00348 
00349 inline bool QFont::bold() const
00350 { return weight() > Normal; }
00351 
00352 
00353 inline void QFont::setBold( bool enable )
00354 { setWeight( enable ? Bold : Normal ); }
00355 
00356 
00357 
00358 
00359 /*****************************************************************************
00360   QFont stream functions
00361  *****************************************************************************/
00362 
00363 #ifndef QT_NO_DATASTREAM
00364 Q_EXPORT QDataStream &operator<<( QDataStream &, const QFont & );
00365 Q_EXPORT QDataStream &operator>>( QDataStream &, QFont & );
00366 #endif
00367 
00368 
00369 #endif // QFONT_H
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'