Files @ r10116:be292ddefbc7
Branch filter:

Location: cpp/openttd-patchpack/source/src/querystring_gui.h

translators
(svn r14300) -Update: WebTranslator2 update to 2008-09-12 17:41:59
brazilian_portuguese - 13 fixed by tucalipe (13)
catalan - 12 fixed by arnaullv (12)
danish - 9 fixed, 7 changed by ThomasA (16)
dutch - 1 changed by habell (1)
estonian - 5 fixed by kristjans (5)
galician - 98 fixed, 6 changed by Condex (104)
german - 7 fixed, 83 changed by sulai (69), dih (21)
korean - 12 fixed by leejaeuk5 (12)
romanian - 20 fixed by kneekoo (20)
slovenian - 5 fixed by Necrolyte (5)
/* $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"

/**
 * 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);
	}

	void DrawEditBox(Window *w, int wid);
	void HandleEditBox(Window *w, int wid);
	int 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;

	QueryStringBaseWindow(uint16 size, const WindowDesc *desc, WindowNumber window_number = 0) : Window(desc, window_number), edit_str_size(size)
	{
		this->edit_str_buf = CallocT<char>(size);
	}

	~QueryStringBaseWindow()
	{
		free(this->edit_str_buf);
	}

	void DrawEditBox(int wid);
	void HandleEditBox(int wid);
	int HandleEditBoxKey(int wid, uint16 key, uint16 keycode, EventState &state);
};

void ShowOnScreenKeyboard(QueryStringBaseWindow *parent, int button, int cancel, int ok);

#endif /* QUERYSTRING_GUI_H */