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 <tqstring.h> 00016 #include <tqsimplerichtext.h> 00017 #include <tqpainter.h> 00018 #include <tqfont.h> 00019 #include <tqfontmetrics.h> 00020 #include <tqrect.h> 00021 #include <tqsize.h> 00022 #include "karamba.h" 00023 00024 class RichTextLabel : public Meter 00025 { 00026 Q_OBJECT 00027 TQ_OBJECT 00028 public: 00029 RichTextLabel(karamba*); 00030 RichTextLabel(karamba* k, int x, int y, int w, int h); 00031 ~RichTextLabel(); 00032 00033 void setText(TQString text, bool linkUnderline = false); 00034 void setValue(TQString text); 00035 void setValue(long v); 00036 TQString getStringValue() { return source; }; 00037 00038 void setFont(TQString font); 00039 TQString getFont() const; 00040 void setFontSize(int); 00041 int getFontSize() const; 00042 void setFixedPitch(bool); 00043 bool getFixedPitch() const; 00044 void setTextProps( TextField* t ); 00045 void setColorGroup(const TQColorGroup &colorg); 00046 const TQColorGroup &getColorGroup() const; 00047 void setWidth(int width); 00048 00049 virtual bool insideActiveArea(int, int); 00050 00051 virtual bool click(TQMouseEvent*); 00052 virtual void mUpdate(TQPainter*); 00053 00054 TQString anchorAt(int, int); 00055 00056 private: 00057 TQSimpleRichText* text; 00058 TQString source; 00059 TQFont font; 00060 TQColorGroup colorGrp; 00061 bool underlineLinks; 00062 TQSize originalSize; 00063 }; 00064 00065 #endif