00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef MMSLABELWIDGET_H_
00034 #define MMSLABELWIDGET_H_
00035
00036 #include "mmsgui/mmswidget.h"
00037 #include "mmsgui/mmslabelwidgetthread.h"
00038
00039
00040
00041
00042
00043
00044
00045 class MMSLabelWidget : public MMSWidget {
00046
00047 private:
00048 string className;
00049 MMSLabelWidgetClass *labelWidgetClass;
00050 MMSLabelWidgetClass myLabelWidgetClass;
00051
00052
00053 MMSLanguage lang;
00054
00055
00056 MMSFBFont *font;
00057
00058
00059 string fontpath;
00060
00061
00062 string fontname;
00063
00064
00065 unsigned int fontsize;
00066
00067
00068 bool load_font;
00069
00070
00071 int slide_width;
00072 int slide_offset;
00073
00074 unsigned int frame_delay;
00075 unsigned int frame_delay_set;
00076
00077 class MMSLabelWidgetThread *labelThread;
00078
00079
00080 string translated_text;
00081
00082
00083 bool translated;
00084
00085
00086 bool swap_left_right;
00087
00088
00089 bool current_fgset;
00090
00091
00092 MMSFBColor current_fgcolor;
00093
00094 bool create(MMSWindow *root, string className, MMSTheme *theme);
00095
00096 void initLanguage(MMSLabelWidget *widget = NULL);
00097 void loadFont(MMSLabelWidget *widget = NULL);
00098 bool init();
00099 bool release();
00100
00101 bool prepareText(int *width, int *height, bool recalc = false);
00102 void calcContentSize();
00103
00104 void getForeground(MMSFBColor *color);
00105 bool enableRefresh(bool enable = true);
00106 bool checkRefreshStatus();
00107
00108 bool draw(bool *backgroundFilled = NULL);
00109
00110
00111 void targetLangChanged(MMSLanguage lang);
00112
00113 public:
00114 MMSLabelWidget(MMSWindow *root, string className, MMSTheme *theme = NULL);
00115 ~MMSLabelWidget();
00116
00117 MMSWidget *copyWidget();
00118
00119 int getStringWidth(const char *text = NULL);
00120
00121 public:
00122
00123 string getFontPath();
00124 string getFontName(MMSLanguage lang = MMSLANG_NONE);
00125 unsigned int getFontSize();
00126 MMSALIGNMENT getAlignment();
00127 MMSFBColor getColor();
00128 MMSFBColor getSelColor();
00129 MMSFBColor getColor_p();
00130 MMSFBColor getSelColor_p();
00131 MMSFBColor getColor_i();
00132 MMSFBColor getSelColor_i();
00133 string getText();
00134 void getText(string &text);
00135 bool getSlidable();
00136 unsigned char getSlideSpeed();
00137 bool getTranslate();
00138 MMSFBColor getShadowColor(MMSPOSITION position);
00139 MMSFBColor getSelShadowColor(MMSPOSITION position);
00140
00141 void setFontPath(string fontpath, bool load = true, bool refresh = true);
00142 void setFontName(MMSLanguage lang, string fontname, bool load = true, bool refresh = true);
00143 void setFontName(string fontname, bool load = true, bool refresh = true);
00144 void setFontSize(unsigned int fontsize, bool load = true, bool refresh = true);
00145 void setFont(MMSLanguage lang, string fontpath, string fontname, unsigned int fontsize, bool load = true, bool refresh = true);
00146 void setFont(string fontpath, string fontname, unsigned int fontsize, bool load = true, bool refresh = true);
00147 void setAlignment(MMSALIGNMENT alignment, bool refresh = true);
00148 void setColor(MMSFBColor color, bool refresh = true);
00149 void setSelColor(MMSFBColor selcolor, bool refresh = true);
00150 void setColor_p(MMSFBColor color_p, bool refresh = true);
00151 void setSelColor_p(MMSFBColor selcolor_p, bool refresh = true);
00152 void setColor_i(MMSFBColor color_i, bool refresh = true);
00153 void setSelColor_i(MMSFBColor selcolor_i, bool refresh = true);
00154 void setText(string text, bool refresh = true);
00155 void setSlidable(bool slidable);
00156 void setSlideSpeed(unsigned char slidespeed);
00157 void setTranslate(bool translate, bool refresh = true);
00158 void setShadowColor(MMSPOSITION position, MMSFBColor color, bool refresh = true);
00159 void setSelShadowColor(MMSPOSITION position, MMSFBColor selcolor, bool refresh = true);
00160
00161 void updateFromThemeClass(MMSLabelWidgetClass *themeClass);
00162
00163
00164 friend class MMSWindow;
00165 friend class MMSLabelWidgetThread;
00166 };
00167
00168 #endif