querystring_gui.h
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_gui.h"
00016 #include "window_gui.h"
00017
00021 enum HandleEditBoxResult
00022 {
00023 HEBR_EDITING = 0,
00024 HEBR_CONFIRM,
00025 HEBR_CANCEL,
00026 HEBR_NOT_FOCUSED,
00027 };
00028
00032 struct QueryString {
00033 StringID caption;
00034 Textbuf text;
00035 const char *orig;
00036 CharSetFilter afilter;
00037 bool handled;
00038
00042 QueryString() : orig(NULL)
00043 {
00044 }
00045
00049 ~QueryString()
00050 {
00051 free((void*)this->orig);
00052 }
00053
00054 private:
00055 bool HasEditBoxFocus(const Window *w, int wid) const;
00056 public:
00057 void DrawEditBox(Window *w, int wid);
00058 void HandleEditBox(Window *w, int wid);
00059 HandleEditBoxResult HandleEditBoxKey(Window *w, int wid, uint16 key, uint16 keycode, Window::EventState &state);
00060 };
00061
00062 struct QueryStringBaseWindow : public Window, public QueryString {
00063 char *edit_str_buf;
00064 const uint16 edit_str_size;
00065
00066 QueryStringBaseWindow(uint16 size) : Window(), edit_str_size(size)
00067 {
00068 assert(size != 0);
00069 this->edit_str_buf = CallocT<char>(size);
00070 }
00071
00072 ~QueryStringBaseWindow()
00073 {
00074 free(this->edit_str_buf);
00075 }
00076
00077 void DrawEditBox(int wid);
00078 void HandleEditBox(int wid);
00079 HandleEditBoxResult HandleEditBoxKey(int wid, uint16 key, uint16 keycode, EventState &state);
00080 virtual void OnOpenOSKWindow(int wid);
00081 virtual void OnOSKInput(int wid) {}
00082 };
00083
00084 void ShowOnScreenKeyboard(QueryStringBaseWindow *parent, int button, int cancel, int ok);
00085 void UpdateOSKOriginalText(const QueryStringBaseWindow *parent, int button);
00086
00087 #endif