Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef QUERYSTRING_GUI_H
00013 #define QUERYSTRING_GUI_H
00014
00015 #include "textbuf_type.h"
00016 #include "textbuf_gui.h"
00017 #include "window_gui.h"
00018
00022 enum HandleEditBoxResult
00023 {
00024 HEBR_EDITING,
00025 HEBR_CURSOR,
00026 HEBR_CONFIRM,
00027 HEBR_CANCEL,
00028 HEBR_NOT_FOCUSED,
00029 };
00030
00034 struct QueryString {
00035
00036 static const int ACTION_NOTHING = -1;
00037 static const int ACTION_DESELECT = -2;
00038 static const int ACTION_CLEAR = -3;
00039
00040 StringID caption;
00041 int ok_button;
00042 int cancel_button;
00043 Textbuf text;
00044 const char *orig;
00045 CharSetFilter afilter;
00046 bool handled;
00047
00053 QueryString(uint16 size, uint16 chars = UINT16_MAX) : ok_button(ACTION_NOTHING), cancel_button(ACTION_DESELECT), text(size, chars), orig(NULL)
00054 {
00055 }
00056
00060 ~QueryString()
00061 {
00062 free(this->orig);
00063 }
00064
00065 public:
00066 void DrawEditBox(const Window *w, int wid) const;
00067 void ClickEditBox(Window *w, Point pt, int wid, int click_count, bool focus_changed);
00068 void HandleEditBox(Window *w, int wid);
00069 HandleEditBoxResult HandleEditBoxKey(Window *w, int wid, uint16 key, uint16 keycode, EventState &state);
00070 };
00071
00072 void ShowOnScreenKeyboard(Window *parent, int button);
00073 void UpdateOSKOriginalText(const Window *parent, int button);
00074 bool IsOSKOpenedFor(const Window *w, int button);
00075
00076 #endif