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 MMSINPUTWIDGET_H_
00034 #define MMSINPUTWIDGET_H_
00035
00036 #include "mmsgui/mmswidget.h"
00037
00038
00039
00040
00041
00042
00043 class MMSInputWidget : public MMSWidget {
00044
00045 private:
00046 string className;
00047 MMSInputWidgetClass *inputWidgetClass;
00048 MMSInputWidgetClass myInputWidgetClass;
00049
00050
00051 MMSLanguage lang;
00052
00053
00054 MMSFBFont *font;
00055
00056
00057 string fontpath;
00058
00059
00060 string fontname;
00061
00062
00063 unsigned int fontsize;
00064
00065
00066 bool load_font;
00067
00068 int cursor_pos;
00069 bool cursor_on;
00070 int scroll_x;
00071 MMSFBRectangle cursor_rect;
00072
00073 class MMSInputWidgetThread *iwt;
00074
00075
00076 bool current_fgset;
00077
00078
00079 MMSFBColor current_fgcolor;
00080
00081 bool create(MMSWindow *root, string className, MMSTheme *theme);
00082
00083 void initLanguage(MMSInputWidget *widget = NULL);
00084 void loadFont(MMSInputWidget *widget = NULL);
00085
00086 void handleInput(MMSInputEvent *inputevent);
00087
00088 bool init();
00089 bool release();
00090
00091 void getForeground(MMSFBColor *color);
00092 bool enableRefresh(bool enable = true);
00093 bool checkRefreshStatus();
00094
00095 bool draw(bool *backgroundFilled = NULL);
00096 void drawCursor(bool cursor_on);
00097
00098
00099 void targetLangChanged(MMSLanguage lang);
00100
00101 public:
00102 MMSInputWidget(MMSWindow *root, string className, MMSTheme *theme = NULL);
00103 ~MMSInputWidget();
00104
00105 MMSWidget *copyWidget();
00106
00107 void setCursorPos(int cursor_pos, bool refresh = true);
00108 bool addTextAfterCursorPos(string text, bool refresh = true);
00109 bool removeTextBeforeCursorPos(int textlen, bool refresh = true);
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147 sigc::signal<bool, MMSWidget*, string, bool, MMSFBRectangle>::accumulated<bool_accumulator> *onBeforeChange;
00148
00149 public:
00150
00151 string getFontPath();
00152 string getFontName(MMSLanguage lang = MMSLANG_NONE);
00153 unsigned int getFontSize();
00154 MMSALIGNMENT getAlignment();
00155 MMSFBColor getColor();
00156 MMSFBColor getSelColor();
00157 MMSFBColor getColor_p();
00158 MMSFBColor getSelColor_p();
00159 MMSFBColor getColor_i();
00160 MMSFBColor getSelColor_i();
00161 string getText();
00162 void getText(string &text);
00163 MMSSTATE getCursorState();
00164 MMSFBColor getShadowColor(MMSPOSITION position);
00165 MMSFBColor getSelShadowColor(MMSPOSITION position);
00166
00167 void setFontPath(string fontpath, bool load = true, bool refresh = true);
00168 void setFontName(MMSLanguage lang, string fontname, bool load = true, bool refresh = true);
00169 void setFontName(string fontname, bool load = true, bool refresh = true);
00170 void setFontSize(unsigned int fontsize, bool load = true, bool refresh = true);
00171 void setFont(MMSLanguage lang, string fontpath, string fontname, unsigned int fontsize, bool load = true, bool refresh = true);
00172 void setFont(string fontpath, string fontname, unsigned int fontsize, bool load = true, bool refresh = true);
00173 void setAlignment(MMSALIGNMENT alignment, bool refresh = true);
00174 void setColor(MMSFBColor color, bool refresh = true);
00175 void setSelColor(MMSFBColor selcolor, bool refresh = true);
00176 void setColor_p(MMSFBColor color_p, bool refresh = true);
00177 void setSelColor_p(MMSFBColor selcolor_p, bool refresh = true);
00178 void setColor_i(MMSFBColor color_i, bool refresh = true);
00179 void setSelColor_i(MMSFBColor selcolor_i, bool refresh = true);
00180 void setText(string text, bool refresh = true, bool reset_cursor = true);
00181 void setCursorState(MMSSTATE cursor_state, bool refresh = true);
00182 void setShadowColor(MMSPOSITION position, MMSFBColor color, bool refresh = true);
00183 void setSelShadowColor(MMSPOSITION position, MMSFBColor selcolor, bool refresh = true);
00184
00185 void updateFromThemeClass(MMSInputWidgetClass *themeClass);
00186
00187 friend class MMSWindow;
00188 friend class MMSInputWidgetThread;
00189 };
00190
00191 #endif