Changeset - r10547:46e9c74ed423
[Not reviewed]
master
0 8 0
rubidium - 16 years ago 2009-01-03 13:59:05
rubidium@openttd.org
(svn r14804) -Codechange: unify opening the OSK (Zuu)
8 files changed with 35 insertions and 33 deletions:
0 comments (0 inline, 0 general)
src/genworld_gui.cpp
Show inline comments
 
@@ -373,10 +373,6 @@ struct GenerateLandscapeWindow : public 
 
				this->SetDirty();
 
				break;
 

	
 
			case GLAND_RANDOM_EDITBOX: // edit box for random seed
 
				ShowOnScreenKeyboard(this, GLAND_RANDOM_EDITBOX, 0, 0);
 
				break;
 

	
 
			case GLAND_GENERATE_BUTTON: // Generate
 
				_settings_game = _settings_newgame;
 

	
src/misc_gui.cpp
Show inline comments
 
@@ -1061,6 +1061,11 @@ void QueryStringBaseWindow::DrawEditBox(
 
	this->QueryString::DrawEditBox(this, wid);
 
}
 

	
 
void QueryStringBaseWindow::OnOpenOSKWindow(int wid)
 
{
 
	ShowOnScreenKeyboard(this, wid, 0, 0);
 
}
 

	
 
enum QueryStringWidgets {
 
	QUERY_STR_WIDGET_TEXT = 3,
 
	QUERY_STR_WIDGET_DEFAULT,
 
@@ -1103,10 +1108,6 @@ struct QueryStringWindow : public QueryS
 
	virtual void OnClick(Point pt, int widget)
 
	{
 
		switch (widget) {
 
			case QUERY_STR_WIDGET_TEXT:
 
				ShowOnScreenKeyboard(this, QUERY_STR_WIDGET_TEXT, QUERY_STR_WIDGET_CANCEL, QUERY_STR_WIDGET_OK);
 
				break;
 

	
 
			case QUERY_STR_WIDGET_DEFAULT:
 
				this->text.buf[0] = '\0';
 
				/* Fallthrough */
 
@@ -1140,6 +1141,11 @@ struct QueryStringWindow : public QueryS
 
		return state;
 
	}
 

	
 
	virtual void OnOpenOSKWindow(int wid)
 
	{
 
		ShowOnScreenKeyboard(this, wid, QUERY_STR_WIDGET_CANCEL, QUERY_STR_WIDGET_OK);
 
	}
 

	
 
	~QueryStringWindow()
 
	{
 
		if (!this->handled && this->parent != NULL) {
 
@@ -1594,10 +1600,6 @@ struct SaveLoadWindow : public QueryStri
 
				break;
 
			}
 

	
 
			case 10: // edit box
 
				ShowOnScreenKeyboard(this, widget, 0, 0);
 
				break;
 

	
 
			case 11: case 12: // Delete, Save game
 
				break;
 
		}
src/network/network_chat_gui.cpp
Show inline comments
 
@@ -448,10 +448,6 @@ struct NetworkChatWindow : public QueryS
 
	virtual void OnClick(Point pt, int widget)
 
	{
 
		switch (widget) {
 
			case 2:
 
				ShowOnScreenKeyboard(this, 2, 0, 3);
 
				break;
 

	
 
			case 3: /* Send */
 
				SendChat(this->text.buf, this->dtype, this->dest);
 
			/* FALLTHROUGH */
 
@@ -485,6 +481,11 @@ struct NetworkChatWindow : public QueryS
 
		}
 
		return state;
 
	}
 

	
 
	virtual void OnOpenOSKWindow(int wid)
 
	{
 
		ShowOnScreenKeyboard(this, wid, 0, 3);
 
	}
 
};
 

	
 
static const Widget _chat_window_widgets[] = {
src/network/network_gui.cpp
Show inline comments
 
@@ -473,10 +473,6 @@ public:
 
	{
 
		this->field = widget;
 
		switch (widget) {
 
			case NGWW_CLIENT:
 
				ShowOnScreenKeyboard(this, NGWW_CLIENT, 0, 0);
 
				break;
 

	
 
			case NGWW_CANCEL: // Cancel button
 
				DeleteWindowById(WC_NETWORK_WINDOW, 0);
 
				break;
 
@@ -917,10 +913,6 @@ struct NetworkStartServerWindow : public
 
				ShowNetworkGameWindow();
 
				break;
 

	
 
			case NSSW_GAMENAME:
 
				ShowOnScreenKeyboard(this, NSSW_GAMENAME, 0, 0);
 
				break;
 

	
 
			case NSSW_SETPWD: // Set password button
 
				this->widget_id = NSSW_SETPWD;
 
				SetDParamStr(0, _settings_client.network.server_password);
 
@@ -1907,10 +1899,6 @@ struct NetworkCompanyPasswordWindow : pu
 
				this->ToggleWidgetLoweredState(NCPWW_SAVE_AS_DEFAULT_PASSWORD);
 
				this->SetDirty();
 
				break;
 

	
 
			case NCPWW_PASSWORD:
 
				ShowOnScreenKeyboard(this, NCPWW_PASSWORD, NCPWW_CANCEL, NCPWW_OK);
 
				break;
 
		}
 
	}
 

	
 
@@ -1935,6 +1923,11 @@ struct NetworkCompanyPasswordWindow : pu
 
		}
 
		return state;
 
	}
 

	
 
	virtual void OnOpenOSKWindow(int wid)
 
	{
 
		ShowOnScreenKeyboard(this, wid, NCPWW_CANCEL, NCPWW_OK);
 
	}
 
};
 

	
 
static const Widget _ncp_window_widgets[] = {
src/querystring_gui.h
Show inline comments
 
@@ -67,6 +67,7 @@ struct QueryStringBaseWindow : public Wi
 
	void DrawEditBox(int wid);
 
	void HandleEditBox(int wid);
 
	int HandleEditBoxKey(int wid, uint16 key, uint16 keycode, EventState &state);
 
	virtual void OnOpenOSKWindow(int wid);
 
};
 

	
 
void ShowOnScreenKeyboard(QueryStringBaseWindow *parent, int button, int cancel, int ok);
src/signs_gui.cpp
Show inline comments
 
@@ -278,10 +278,6 @@ struct SignWindow : QueryStringBaseWindo
 
				break;
 
			}
 

	
 
			case QUERY_EDIT_SIGN_WIDGET_TEXT:
 
				ShowOnScreenKeyboard(this, widget, QUERY_EDIT_SIGN_WIDGET_CANCEL, QUERY_EDIT_SIGN_WIDGET_OK);
 
				break;
 

	
 
			case QUERY_EDIT_SIGN_WIDGET_DELETE:
 
				/* Only need to set the buffer to null, the rest is handled as the OK button */
 
				RenameSign(this->cur_sign, "");
 
@@ -319,6 +315,11 @@ struct SignWindow : QueryStringBaseWindo
 
	{
 
		this->HandleEditBox(QUERY_EDIT_SIGN_WIDGET_TEXT);
 
	}
 

	
 
	virtual void OnOpenOSKWindow(int wid)
 
	{
 
		ShowOnScreenKeyboard(this, wid, QUERY_EDIT_SIGN_WIDGET_CANCEL, QUERY_EDIT_SIGN_WIDGET_OK);
 
	}
 
};
 

	
 
static const Widget _query_sign_edit_widgets[] = {
src/window.cpp
Show inline comments
 
@@ -24,6 +24,7 @@
 
#include "window_func.h"
 
#include "tilehighlight_func.h"
 
#include "network/network.h"
 
#include "querystring_gui.h"
 

	
 
#include "table/sprites.h"
 

	
 
@@ -184,6 +185,13 @@ static void DispatchLeftClickEvent(Windo
 
			}
 
		} else if (wi->type == WWT_SCROLLBAR || wi->type == WWT_SCROLL2BAR || wi->type == WWT_HSCROLLBAR) {
 
			ScrollbarClickHandler(w, wi, x, y);
 
		} else if (wi->type == WWT_EDITBOX)	{
 
			/* Open the OSK window if clicked on an edit box */
 
			QueryStringBaseWindow *qs = dynamic_cast<QueryStringBaseWindow*>(w);
 
			if (qs != NULL) {
 
				const int widget_index = wi - w->widget;
 
				qs->OnOpenOSKWindow(widget_index);
 
			}
 
		}
 

	
 
		if (w->desc_flags & WDF_STD_BTN) {
src/window_gui.h
Show inline comments
 
@@ -477,7 +477,7 @@ enum WindowWidgetTypes {
 
	WWT_CLOSEBOX,   ///< Close box (at top-left of a window)
 
	WWT_DROPDOWN,   ///< Raised drop down list (regular)
 
	WWT_DROPDOWNIN, ///< Inset drop down list (used on game options only)
 
	WWT_EDITBOX,    ///< a textbox for typing (don't forget to call ShowOnScreenKeyboard() when clicked)
 
	WWT_EDITBOX,    ///< a textbox for typing
 
	WWT_LAST,       ///< Last Item. use WIDGETS_END to fill up padding!!
 

	
 
	WWT_MASK = 0x1F,
0 comments (0 inline, 0 general)