00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef TEXTWIDGET_H_INCLUDED
00020 #define TEXTWIDGET_H_INCLUDED
00021
00022
00023
00024
00025
00026 #include "Gump.h"
00027
00028 #include "Font.h"
00029
00030 using Pentagram::Font;
00031
00032 class RenderedText;
00033
00034 class TextWidget : public Gump
00035 {
00036 protected:
00037 std::string text;
00038 bool gamefont;
00039 int fontnum;
00040 uint32 blendColour;
00041 int tx, ty;
00042
00043 unsigned int current_start;
00044 unsigned int current_end;
00045
00046 int targetwidth, targetheight;
00047
00048 RenderedText* cached_text;
00049 Font::TextAlign textalign;
00050 public:
00051 ENABLE_RUNTIME_CLASSTYPE();
00052
00053 TextWidget();
00054 TextWidget(int X, int Y, std::string txt, bool gamefont, int fontnum,
00055 int width = 0, int height = 0,
00056 Font::TextAlign align = Font::TEXT_LEFT);
00057 virtual ~TextWidget(void);
00058
00059
00060 virtual void InitGump(Gump* newparent, bool take_focus=true);
00061
00062
00063 virtual void PaintThis(RenderSurface*, sint32 lerp_factor, bool scaled);
00064
00065 virtual void PaintComposited(RenderSurface* surf, sint32 lerp_factor, sint32 scalex, sint32 scaley);
00066
00067 virtual Gump* OnMouseMotion(int mx, int my);
00068
00071 bool setupNextText();
00072
00074 void rewind();
00075
00079 void getCurrentText(unsigned int& start, unsigned int& end) const {
00080 start = current_start; end = current_end;
00081 }
00082
00084 void setBlendColour(uint32 col) { blendColour = col; }
00085
00087 int getVlead();
00088
00089 protected:
00090 void renderText();
00091
00092 Pentagram::Font* getFont() const;
00093
00094 public:
00095 bool loadData(IDataSource* ids, uint32 version);
00096
00097 protected:
00098 virtual void saveData(ODataSource* ods);
00099 };
00100
00101 #endif