Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef QWT_TEXT_ENGINE_H
00011 #define QWT_TEXT_ENGINE_H 1
00012
00013 #include "qwt_global.h"
00014 #include <qsize.h>
00015
00016 class QFont;
00017 class QRectF;
00018 class QString;
00019 class QPainter;
00020
00035 class QWT_EXPORT QwtTextEngine
00036 {
00037 public:
00038 virtual ~QwtTextEngine();
00039
00050 virtual double heightForWidth( const QFont &font, int flags,
00051 const QString &text, double width ) const = 0;
00052
00062 virtual QSizeF textSize( const QFont &font, int flags,
00063 const QString &text ) const = 0;
00064
00071 virtual bool mightRender( const QString &text ) const = 0;
00072
00088 virtual void textMargins( const QFont &font, const QString &text,
00089 double &left, double &right, double &top, double &bottom ) const = 0;
00090
00099 virtual void draw( QPainter *painter, const QRectF &rect,
00100 int flags, const QString &text ) const = 0;
00101
00102 protected:
00103 QwtTextEngine();
00104
00105 private:
00106 Q_DISABLE_COPY(QwtTextEngine)
00107 };
00108
00109
00116 class QWT_EXPORT QwtPlainTextEngine: public QwtTextEngine
00117 {
00118 public:
00119 QwtPlainTextEngine();
00120 virtual ~QwtPlainTextEngine();
00121
00122 virtual double heightForWidth( const QFont &font, int flags,
00123 const QString &text, double width ) const;
00124
00125 virtual QSizeF textSize( const QFont &font, int flags,
00126 const QString &text ) const;
00127
00128 virtual void draw( QPainter *painter, const QRectF &rect,
00129 int flags, const QString &text ) const;
00130
00131 virtual bool mightRender( const QString & ) const;
00132
00133 virtual void textMargins( const QFont &, const QString &,
00134 double &left, double &right, double &top, double &bottom ) const;
00135
00136 private:
00137 class PrivateData;
00138 PrivateData *d_data;
00139 };
00140
00141
00142 #ifndef QT_NO_RICHTEXT
00143
00150 class QWT_EXPORT QwtRichTextEngine: public QwtTextEngine
00151 {
00152 public:
00153 QwtRichTextEngine();
00154
00155 virtual double heightForWidth( const QFont &font, int flags,
00156 const QString &text, double width ) const;
00157
00158 virtual QSizeF textSize( const QFont &font, int flags,
00159 const QString &text ) const;
00160
00161 virtual void draw( QPainter *painter, const QRectF &rect,
00162 int flags, const QString &text ) const;
00163
00164 virtual bool mightRender( const QString & ) const;
00165
00166 virtual void textMargins( const QFont &, const QString &,
00167 double &left, double &right, double &top, double &bottom ) const;
00168
00169 private:
00170 QString taggedText( const QString &, int flags ) const;
00171 };
00172
00173 #endif // !QT_NO_RICHTEXT
00174
00175 #endif