superkaramba
textlabel.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef TEXTLABEL_H
00011 #define TEXTLABEL_H
00012 #include "meter.h"
00013 #include <tqstring.h>
00014 #include <tqpainter.h>
00015 #include <tqcolor.h>
00016 #include <tqfont.h>
00017 #include <tqfontmetrics.h>
00018 #include <tqstringlist.h>
00019 #include <tqrect.h>
00020
00021 #include "textfield.h"
00022
00023 class TextLabel : public Meter
00024 {
00025 Q_OBJECT
00026 public:
00027 enum ScrollType { ScrollNone, ScrollNormal,
00028 ScrollBackAndForth, ScrollOnePass };
00029
00030 TextLabel(karamba *k, int x,int y,int w,int h);
00031 TextLabel(karamba *k);
00032 ~TextLabel();
00033
00034 void setTextProps( TextField* );
00035 void setValue( TQString );
00036 void setValue( long );
00037
00038 TQString getStringValue() const { return value.join("\n"); };
00039 void setFontSize( int );
00040 void setBGColor(TQColor clr);
00041 void setFont( TQString );
00042 void setAlignment( TQString );
00043 void setFixedPitch( bool );
00044 void setShadow( int );
00045 void mUpdate( TQPainter * );
00046
00047 virtual void show();
00048 virtual void hide();
00049 int getFontSize() const;
00050 TQColor getBGColor() const;
00051 TQString getFont() const;
00052 TQString getAlignment() const;
00053 bool getFixedPitch() const;
00054 int getShadow() const;
00055 void setScroll(ScrollType type, TQPoint speed, int gap, int pause);
00056 void setScroll(char* type, TQPoint speed, int gap, int pause);
00057
00058 void attachClickArea(TQString leftMouseButton, TQString middleMouseButton,
00059 TQString rightMouseButton);
00060
00061 virtual bool click(TQMouseEvent*);
00062
00063 private:
00064 int alignment;
00065 int clip;
00066 TQStringList value;
00067 TQFont font;
00068 TQColor bgColor;
00069 int lineHeight;
00070 TQSize textSize;
00071 int shadow;
00072 TextField text;
00073 TQPoint scrollSpeed;
00074 TQPoint scrollPos;
00075 int scrollGap;
00076 int scrollPause;
00077 int pauseCounter;
00078 ScrollType scrollType;
00079
00080 int drawText(TQPainter *p, int x, int y, int width, int height,
00081 TQString text);
00082 bool calculateScrollCoords(TQRect meterRect, TQRect &textRect,
00083 TQPoint &next, int &x, int &y);
00084 void calculateTextSize();
00085 };
00086
00087 #endif // TEXTLABEL_H