Files
@ r11270:7b8efbc5d599
Branch filter:
Location: cpp/openttd-patchpack/source/src/querystring_gui.h - annotation
r11270:7b8efbc5d599
1.9 KiB
text/x-c
(svn r15624) -Fix (r15621): warning about comparing signed and unsigned integer types
r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9897:9cbe1cc406a0 r10295:c0e73453a31c r10295:c0e73453a31c r10295:c0e73453a31c r10295:c0e73453a31c r10295:c0e73453a31c r10295:c0e73453a31c r10295:c0e73453a31c r11081:725ce4237987 r10295:c0e73453a31c r10295:c0e73453a31c r10295:c0e73453a31c r9897:9cbe1cc406a0 r9897:9cbe1cc406a0 r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9897:9cbe1cc406a0 r9897:9cbe1cc406a0 r9897:9cbe1cc406a0 r9897:9cbe1cc406a0 r9897:9cbe1cc406a0 r9897:9cbe1cc406a0 r9897:9cbe1cc406a0 r9897:9cbe1cc406a0 r9897:9cbe1cc406a0 r9897:9cbe1cc406a0 r9897:9cbe1cc406a0 r9897:9cbe1cc406a0 r9897:9cbe1cc406a0 r9897:9cbe1cc406a0 r9897:9cbe1cc406a0 r11081:725ce4237987 r9179:660680ae613d r9179:660680ae613d r10295:c0e73453a31c r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9897:9cbe1cc406a0 r9897:9cbe1cc406a0 r10276:22abdd1aa57a r9179:660680ae613d r9916:dfe4035b061f r9179:660680ae613d r10276:22abdd1aa57a r9897:9cbe1cc406a0 r9897:9cbe1cc406a0 r9897:9cbe1cc406a0 r9897:9cbe1cc406a0 r9897:9cbe1cc406a0 r9897:9cbe1cc406a0 r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r10563:12d6e31fa9ad r10547:46e9c74ed423 r11030:4d8ca8b9bddb r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d | /* $Id$ */
/** @file querystring_gui.h Base for the GUIs that have an edit box in them. */
#ifndef QUERYSTRING_GUI_H
#define QUERYSTRING_GUI_H
#include "textbuf_gui.h"
#include "window_gui.h"
/**
* Return values for HandleEditBoxKey
*/
enum HandleEditBoxResult
{
HEBR_EDITING = 0, // Other key pressed.
HEBR_CONFIRM, // Return or enter key pressed.
HEBR_CANCEL, // Escape key pressed.
HEBR_NOT_FOCUSED, // Edit box widget not focused.
};
/**
* Data stored about a string that can be modified in the GUI
*/
struct QueryString {
StringID caption;
Textbuf text;
const char *orig;
CharSetFilter afilter;
bool handled;
/**
* Make sure everything gets initialized properly.
*/
QueryString() : orig(NULL)
{
}
/**
* Make sure everything gets freed.
*/
~QueryString()
{
free((void*)this->orig);
}
bool HasEditBoxFocus(const Window *w, int wid) const;
void DrawEditBox(Window *w, int wid);
void HandleEditBox(Window *w, int wid);
HandleEditBoxResult HandleEditBoxKey(Window *w, int wid, uint16 key, uint16 keycode, Window::EventState &state);
};
struct QueryStringBaseWindow : public Window, public QueryString {
char *edit_str_buf;
char *orig_str_buf;
const uint16 edit_str_size; ///< maximum length of string (in bytes), including terminating '\0'
QueryStringBaseWindow(uint16 size, const WindowDesc *desc, WindowNumber window_number = 0) : Window(desc, window_number), edit_str_size(size)
{
assert(size != 0);
this->edit_str_buf = CallocT<char>(size);
}
~QueryStringBaseWindow()
{
free(this->edit_str_buf);
}
void DrawEditBox(int wid);
void HandleEditBox(int wid);
HandleEditBoxResult HandleEditBoxKey(int wid, uint16 key, uint16 keycode, EventState &state);
virtual void OnOpenOSKWindow(int wid);
virtual void OnOSKInput(int wid) {}
};
void ShowOnScreenKeyboard(QueryStringBaseWindow *parent, int button, int cancel, int ok);
#endif /* QUERYSTRING_GUI_H */
|