Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

qwt_text.h

00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
00002  * Qwt Widget Library
00003  * Copyright (C) 1997   Josef Wilgen
00004  * Copyright (C) 2003   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 // vim: expandtab
00011 
00012 #ifndef QWT_TEXT_H
00013 #define QWT_TEXT_H
00014 
00015 #include <qstring.h>
00016 #include <qsize.h>
00017 #include <qfont.h>
00018 #include "qwt_global.h"
00019 
00020 class QColor;
00021 class QPen;
00022 class QBrush;
00023 class QRect;
00024 class QPainter;
00025 class QwtTextEngine;
00026 
00027 class QWT_EXPORT QwtText
00028 {
00029 public:
00030     enum TextFormat
00031     {
00032         AutoText = 0,
00033         
00034         PlainText,
00035         RichText
00036     };
00037 
00038     enum PaintAttributes
00039     {
00040         PaintUsingPainter = 0,
00041 
00042         PaintUsingTextFont = 1,
00043         PaintUsingTextColor = 2,
00044 
00045         PaintBackground = 4
00046     };
00047 
00048     enum LayoutAttributes
00049     {
00050         DefaultLayout = 0,
00051         MinimumLayout = 1
00052     };
00053 
00054     QwtText(const QString & = QString::null, 
00055         TextFormat textFormat = AutoText);
00056     QwtText(const QwtText &);
00057     ~QwtText();
00058 
00059     QwtText &operator=(const QwtText &);
00060 
00061     int operator==(const QwtText &) const;
00062     int operator!=(const QwtText &) const;
00063 
00064     void setText(const QString &, 
00065         QwtText::TextFormat textFormat = AutoText);
00066     QString text() const;
00067 
00068     inline bool isNull() const { return text().isNull(); }
00069     inline bool isEmpty() const { return text().isEmpty(); }
00070 
00071     void setFont(const QFont &);
00072     QFont font() const;
00073 
00074     QFont usedFont(const QFont &) const;
00075 
00076     void setFlags(int flags);
00077     int flags() const;
00078 
00079     void setColor(const QColor &);
00080     QColor color() const;
00081 
00082     QColor usedColor(const QColor &) const;
00083 
00084     void setBackgroundPen(const QPen &);
00085     QPen backgroundPen() const;
00086 
00087     void setBackgroundBrush(const QBrush &);
00088     QBrush backgroundBrush() const;
00089 
00090     void setPaintAttributes(int);
00091     int paintAttributes() const;
00092 
00093     void setLayoutAttributes(int);
00094     int layoutAttributes() const;
00095 
00096     int heightForWidth(int width, const QFont & = QFont()) const;
00097     QSize textSize(const QFont & = QFont()) const;
00098 
00099     void draw(QPainter *painter, const QRect &rect) const;
00100 
00101 private:
00102     QwtTextEngine *textEngine(const QString &text,
00103         QwtText::TextFormat textFormat = AutoText) const;
00104 
00105     class PrivateData;
00106     PrivateData *d_data;
00107 
00108     class LayoutCache;
00109     LayoutCache *d_layoutCache;
00110 };
00111 
00112 #endif

Generated on Mon Jan 30 22:16:26 2006 for Qwt User's Guide by  doxygen 1.4.4