All Classes Functions Variables Typedefs Enumerations Enumerator Pages
qwt_text_engine.h
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2003 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_TEXT_ENGINE_H
#define QWT_TEXT_ENGINE_H 1
#include "qwt_global.h"
#include <qsize.h>
class QFont;
class QRectF;
class QString;
class QPainter;
class QWT_EXPORT QwtTextEngine
{
public:
virtual ~QwtTextEngine();
virtual double heightForWidth( const QFont &font, int flags,
const QString &text, double width ) const = 0;
virtual QSizeF textSize( const QFont &font, int flags,
const QString &text ) const = 0;
virtual bool mightRender( const QString &text ) const = 0;
virtual void textMargins( const QFont &font, const QString &text,
double &left, double &right, double &top, double &bottom ) const = 0;
virtual void draw( QPainter *painter, const QRectF &rect,
int flags, const QString &text ) const = 0;
protected:
QwtTextEngine();
};
class QWT_EXPORT QwtPlainTextEngine: public QwtTextEngine
{
public:
QwtPlainTextEngine();
virtual ~QwtPlainTextEngine();
virtual double heightForWidth( const QFont &font, int flags,
const QString &text, double width ) const;
virtual QSizeF textSize( const QFont &font, int flags,
const QString &text ) const;
virtual void draw( QPainter *painter, const QRectF &rect,
int flags, const QString &text ) const;
virtual bool mightRender( const QString & ) const;
virtual void textMargins( const QFont &, const QString &,
double &left, double &right, double &top, double &bottom ) const;
private:
class PrivateData;
PrivateData *d_data;
};
#ifndef QT_NO_RICHTEXT
class QWT_EXPORT QwtRichTextEngine: public QwtTextEngine
{
public:
QwtRichTextEngine();
virtual double heightForWidth( const QFont &font, int flags,
const QString &text, double width ) const;
virtual QSizeF textSize( const QFont &font, int flags,
const QString &text ) const;
virtual void draw( QPainter *painter, const QRectF &rect,
int flags, const QString &text ) const;
virtual bool mightRender( const QString & ) const;
virtual void textMargins( const QFont &, const QString &,
double &left, double &right, double &top, double &bottom ) const;
private:
QString taggedText( const QString &, int flags ) const;
};
#endif // !QT_NO_RICHTEXT
#endif