qwt_text.h
Go to the documentation of this file.
00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
00002  * Qwt Widget Library
00003  * Copyright (C) 1997   Josef Wilgen
00004  * Copyright (C) 2002   Uwe Rathmann
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the Qwt License, Version 1.0
00008  *****************************************************************************/
00009 
00010 #ifndef QWT_TEXT_H
00011 #define QWT_TEXT_H
00012 
00013 #include "qwt_global.h"
00014 #include <qstring.h>
00015 #include <qsize.h>
00016 #include <qfont.h>
00017 #include <qmetatype.h>
00018 
00019 class QColor;
00020 class QPen;
00021 class QBrush;
00022 class QRectF;
00023 class QPainter;
00024 class QwtTextEngine;
00025 
00051 class QWT_EXPORT QwtText
00052 {
00053 public:
00054 
00064     enum TextFormat
00065     {
00072         AutoText = 0,
00073 
00075         PlainText,
00076 
00078         RichText,
00079 
00088         MathMLText,
00089 
00094         TeXText,
00095 
00100         OtherFormat = 100
00101     };
00102 
00109     enum PaintAttribute
00110     {
00112         PaintUsingTextFont = 0x01,
00113 
00115         PaintUsingTextColor = 0x02,
00116 
00118         PaintBackground = 0x04
00119     };
00120 
00122     typedef QFlags<PaintAttribute> PaintAttributes;
00123 
00128     enum LayoutAttribute
00129     {
00136         MinimumLayout = 0x01
00137     };
00138 
00140     typedef QFlags<LayoutAttribute> LayoutAttributes;
00141 
00142     QwtText( const QString & = QString::null,
00143              TextFormat textFormat = AutoText );
00144     QwtText( const QwtText & );
00145     ~QwtText();
00146 
00147     QwtText &operator=( const QwtText & );
00148 
00149     bool operator==( const QwtText & ) const;
00150     bool operator!=( const QwtText & ) const;
00151 
00152     void setText( const QString &,
00153         QwtText::TextFormat textFormat = AutoText );
00154     QString text() const;
00155 
00156     bool isNull() const;
00157     bool isEmpty() const;
00158 
00159     void setFont( const QFont & );
00160     QFont font() const;
00161 
00162     QFont usedFont( const QFont & ) const;
00163 
00164     void setRenderFlags( int flags );
00165     int renderFlags() const;
00166 
00167     void setColor( const QColor & );
00168     QColor color() const;
00169 
00170     QColor usedColor( const QColor & ) const;
00171 
00172     void setBorderRadius( double );
00173     double borderRadius() const;
00174 
00175     void setBorderPen( const QPen & );
00176     QPen borderPen() const;
00177 
00178     void setBackgroundBrush( const QBrush & );
00179     QBrush backgroundBrush() const;
00180 
00181     void setPaintAttribute( PaintAttribute, bool on = true );
00182     bool testPaintAttribute( PaintAttribute ) const;
00183 
00184     void setLayoutAttribute( LayoutAttribute, bool on = true );
00185     bool testLayoutAttribute( LayoutAttribute ) const;
00186 
00187     double heightForWidth( double width, const QFont & = QFont() ) const;
00188     QSizeF textSize( const QFont & = QFont() ) const;
00189 
00190     void draw( QPainter *painter, const QRectF &rect ) const;
00191 
00192     static const QwtTextEngine *textEngine( 
00193         const QString &text, QwtText::TextFormat = AutoText );
00194 
00195     static const QwtTextEngine *textEngine( QwtText::TextFormat );
00196     static void setTextEngine( QwtText::TextFormat, QwtTextEngine * );
00197 
00198 private:
00199     class PrivateData;
00200     PrivateData *d_data;
00201 
00202     class LayoutCache;
00203     LayoutCache *d_layoutCache;
00204 };
00205 
00207 inline bool QwtText::isNull() const
00208 {
00209     return text().isNull();
00210 }
00211 
00213 inline bool QwtText::isEmpty() const
00214 {
00215     return text().isEmpty();
00216 }
00217 
00218 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtText::PaintAttributes )
00219 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtText::LayoutAttributes )
00220 
00221 Q_DECLARE_METATYPE( QwtText )
00222 
00223 #endif


plotjuggler
Author(s): Davide Faconti
autogenerated on Fri Sep 1 2017 02:41:57