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
00027 public:
00028 enum ScrollType { ScrollNone, ScrollNormal,
00029 ScrollBackAndForth, ScrollOnePass };
00030
00031 TextLabel(karamba *k, int x,int y,int w,int h);
00032 TextLabel(karamba *k);
00033 ~TextLabel();
00034
00035 void setTextProps( TextField* );
00036 void setValue( TQString );
00037 void setValue( long );
00038
00039 TQString getStringValue() const { return value.join("\n"); };
00040 void setFontSize( int );
00041 void setBGColor(TQColor clr);
00042 void setFont( TQString );
00043 void setAlignment( TQString );
00044 void setFixedPitch( bool );
00045 void setShadow( int );
00046 void mUpdate( TQPainter * );
00047
00048 virtual void show();
00049 virtual void hide();
00050 int getFontSize() const;
00051 TQColor getBGColor() const;
00052 TQString getFont() const;
00053 TQString getAlignment() const;
00054 bool getFixedPitch() const;
00055 int getShadow() const;
00056 void setScroll(ScrollType type, TQPoint speed, int gap, int pause);
00057 void setScroll(char* type, TQPoint speed, int gap, int pause);
00058
00059 void attachClickArea(TQString leftMouseButton, TQString middleMouseButton,
00060 TQString rightMouseButton);
00061
00062 virtual bool click(TQMouseEvent*);
00063
00064 private:
00065 int alignment;
00066 int clip;
00067 TQStringList value;
00068 TQFont font;
00069 TQColor bgColor;
00070 int lineHeight;
00071 TQSize textSize;
00072 int shadow;
00073 TextField text;
00074 TQPoint scrollSpeed;
00075 TQPoint scrollPos;
00076 int scrollGap;
00077 int scrollPause;
00078 int pauseCounter;
00079 ScrollType scrollType;
00080
00081 int drawText(TQPainter *p, int x, int y, int width, int height,
00082 TQString text);
00083 bool calculateScrollCoords(TQRect meterRect, TQRect &textRect,
00084 TQPoint &next, int &x, int &y);
00085 void calculateTextSize();
00086 };
00087
00088 #endif // TEXTLABEL_H