richtextlabel.h

00001 /***************************************************************************
00002  *   Copyright (C) 2003 by Wilfried Huss                                   *
00003  *   Wilfried.Huss@gmx.at                                                  *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  ***************************************************************************/
00010 
00011 #ifndef RICHTEXTLABEL_H
00012 #define RICHTEXTLABEL_H
00013 
00014 #include "meter.h"
00015 #include <qstring.h>
00016 #include <qsimplerichtext.h>
00017 #include <qpainter.h>
00018 #include <qfont.h>
00019 #include <qfontmetrics.h>
00020 #include <qrect.h>
00021 #include <qsize.h>
00022 #include "karamba.h"
00023 
00024 class RichTextLabel : public Meter
00025 {
00026     Q_OBJECT
00027   public:
00028     RichTextLabel(karamba*);
00029     RichTextLabel(karamba* k, int x, int y, int w, int h);
00030     ~RichTextLabel();
00031 
00032     void setText(QString text, bool linkUnderline = false);
00033     void setValue(QString text);
00034     void setValue(int v);
00035     QString getStringValue() { return source; };
00036 
00037     void setFont(QString font);
00038     QString getFont() const;
00039     void setFontSize(int);
00040     int getFontSize() const;
00041     void setFixedPitch(bool);
00042     bool getFixedPitch() const;
00043     void setTextProps( TextField* t );
00044     void setColorGroup(const QColorGroup &colorg);
00045     const QColorGroup &getColorGroup() const;
00046     void setWidth(int width);
00047 
00048     virtual bool insideActiveArea(int, int);
00049 
00050     virtual bool click(QMouseEvent*);
00051     virtual void mUpdate(QPainter*);
00052 
00053     QString anchorAt(int, int);
00054 
00055   private:
00056     QSimpleRichText* text;
00057     QString source;
00058     QFont font;
00059     QColorGroup colorGrp;
00060     bool underlineLinks;
00061     QSize originalSize;
00062 };
00063 
00064 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys