querystring_gui.h
Go to the documentation of this file.00001
00002
00005 #ifndef QUERYSTRING_GUI_H
00006 #define QUERYSTRING_GUI_H
00007
00008 #include "textbuf_gui.h"
00009 #include "window_gui.h"
00010
00014 enum HandleEditBoxResult
00015 {
00016 HEBR_EDITING = 0,
00017 HEBR_CONFIRM,
00018 HEBR_CANCEL,
00019 HEBR_NOT_FOCUSED,
00020 };
00021
00025 struct QueryString {
00026 StringID caption;
00027 Textbuf text;
00028 const char *orig;
00029 CharSetFilter afilter;
00030 bool handled;
00031
00035 QueryString() : orig(NULL)
00036 {
00037 }
00038
00042 ~QueryString()
00043 {
00044 free((void*)this->orig);
00045 }
00046
00047 bool HasEditBoxFocus(const Window *w, int wid) const;
00048 void DrawEditBox(Window *w, int wid);
00049 void HandleEditBox(Window *w, int wid);
00050 HandleEditBoxResult HandleEditBoxKey(Window *w, int wid, uint16 key, uint16 keycode, Window::EventState &state);
00051 };
00052
00053 struct QueryStringBaseWindow : public Window, public QueryString {
00054 char *edit_str_buf;
00055 char *orig_str_buf;
00056 const uint16 edit_str_size;
00057
00058 QueryStringBaseWindow(uint16 size, const WindowDesc *desc, WindowNumber window_number = 0) : Window(desc, window_number), edit_str_size(size)
00059 {
00060 assert(size != 0);
00061 this->edit_str_buf = CallocT<char>(size);
00062 }
00063
00064 ~QueryStringBaseWindow()
00065 {
00066 free(this->edit_str_buf);
00067 }
00068
00069 void DrawEditBox(int wid);
00070 void HandleEditBox(int wid);
00071 HandleEditBoxResult HandleEditBoxKey(int wid, uint16 key, uint16 keycode, EventState &state);
00072 virtual void OnOpenOSKWindow(int wid);
00073 virtual void OnOSKInput(int wid) {}
00074 };
00075
00076 void ShowOnScreenKeyboard(QueryStringBaseWindow *parent, int button, int cancel, int ok);
00077
00078 #endif