summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-11-13 21:46:33 +0000
committerfrosch <frosch@openttd.org>2012-11-13 21:46:33 +0000
commit137adb3496a47f79d4e0a15463c756341f8217a9 (patch)
treeccaf9feb2bd4c017c4684e220f0fcbff96e388e6
parent2614ed18f9345dd41d461ea81e4cc1e5ec428e72 (diff)
downloadopenttd-137adb3496a47f79d4e0a15463c756341f8217a9.tar.xz
(svn r24726) -Codechange: Move editbox mouseloop handling to Window class.
-rw-r--r--src/ai/ai_gui.cpp5
-rw-r--r--src/fios_gui.cpp7
-rw-r--r--src/genworld_gui.cpp5
-rw-r--r--src/misc_gui.cpp10
-rw-r--r--src/network/network_chat_gui.cpp5
-rw-r--r--src/network/network_content_gui.cpp5
-rw-r--r--src/network/network_gui.cpp15
-rw-r--r--src/newgrf_gui.cpp5
-rw-r--r--src/querystring_gui.h1
-rw-r--r--src/settings_gui.cpp5
-rw-r--r--src/signs_gui.cpp10
-rw-r--r--src/town_gui.cpp5
-rw-r--r--src/window.cpp10
13 files changed, 10 insertions, 78 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp
index e08fac4db..a1c0616c2 100644
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -1337,11 +1337,6 @@ struct AIDebugWindow : public QueryStringBaseWindow {
}
}
- virtual void OnMouseLoop()
- {
- this->HandleEditBox(WID_AID_BREAK_STR_EDIT_BOX);
- }
-
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
EventState state = ES_NOT_HANDLED;
diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp
index b0e03fe02..5f49341a7 100644
--- a/src/fios_gui.cpp
+++ b/src/fios_gui.cpp
@@ -609,13 +609,6 @@ public:
}
}
- virtual void OnMouseLoop()
- {
- if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO || _saveload_mode == SLD_SAVE_HEIGHTMAP) {
- this->HandleEditBox(WID_SL_SAVE_OSK_TITLE);
- }
- }
-
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
if (keycode == WKC_ESC) {
diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp
index b28c968ae..4eb1f8f51 100644
--- a/src/genworld_gui.cpp
+++ b/src/genworld_gui.cpp
@@ -694,11 +694,6 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
}
}
- virtual void OnMouseLoop()
- {
- this->HandleEditBox(WID_GL_RANDOM_EDITBOX);
- }
-
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
EventState state = ES_NOT_HANDLED;
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index b99440230..d941f0633 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -813,11 +813,6 @@ HandleEditBoxResult QueryStringBaseWindow::HandleEditBoxKey(int wid, uint16 key,
return this->QueryString::HandleEditBoxKey(this, wid, key, keycode, state);
}
-void QueryStringBaseWindow::HandleEditBox(int wid)
-{
- this->QueryString::HandleEditBox(this, wid);
-}
-
void QueryStringBaseWindow::OnOpenOSKWindow(int wid)
{
ShowOnScreenKeyboard(this, wid, 0, 0);
@@ -899,11 +894,6 @@ struct QueryStringWindow : public QueryStringBaseWindow
}
}
- virtual void OnMouseLoop()
- {
- this->HandleEditBox(WID_QS_TEXT);
- }
-
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
EventState state = ES_NOT_HANDLED;
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp
index 7cab48730..9e7115d9e 100644
--- a/src/network/network_chat_gui.cpp
+++ b/src/network/network_chat_gui.cpp
@@ -502,11 +502,6 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
}
}
- virtual void OnMouseLoop()
- {
- this->HandleEditBox(WID_NC_TEXTBOX);
- }
-
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
EventState state = ES_NOT_HANDLED;
diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp
index 1137d36a9..bb9ca07f0 100644
--- a/src/network/network_content_gui.cpp
+++ b/src/network/network_content_gui.cpp
@@ -723,11 +723,6 @@ public:
}
}
- virtual void OnMouseLoop()
- {
- this->HandleEditBox(WID_NCL_FILTER);
- }
-
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
switch (keycode) {
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 34d9d9276..d01f20e28 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -775,11 +775,6 @@ public:
this->SetDirty();
}
- virtual void OnMouseLoop()
- {
- this->HandleEditBox(WID_NG_CLIENT);
- }
-
/**
* Some data on this window has become invalid.
* @param data Information about the changed data.
@@ -1179,11 +1174,6 @@ struct NetworkStartServerWindow : public QueryStringBaseWindow {
this->SetDirty();
}
- virtual void OnMouseLoop()
- {
- this->HandleEditBox(WID_NSS_GAMENAME);
- }
-
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
EventState state = ES_NOT_HANDLED;
@@ -2164,11 +2154,6 @@ struct NetworkCompanyPasswordWindow : public QueryStringBaseWindow {
}
}
- virtual void OnMouseLoop()
- {
- this->HandleEditBox(WID_NCP_PASSWORD);
- }
-
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
EventState state = ES_NOT_HANDLED;
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index 80010c301..331431356 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -1227,11 +1227,6 @@ struct NewGRFWindow : public QueryStringBaseWindow, NewGRFScanCallback {
this->SetWidgetDisabledState(WID_NS_PRESET_SAVE, has_missing);
}
- virtual void OnMouseLoop()
- {
- if (this->editable) this->HandleEditBox(WID_NS_FILTER);
- }
-
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
if (!this->editable) return ES_NOT_HANDLED;
diff --git a/src/querystring_gui.h b/src/querystring_gui.h
index db4216aa6..5c1156546 100644
--- a/src/querystring_gui.h
+++ b/src/querystring_gui.h
@@ -76,7 +76,6 @@ struct QueryStringBaseWindow : public Window, public QueryString {
free(this->edit_str_buf);
}
- void HandleEditBox(int wid);
HandleEditBoxResult HandleEditBoxKey(int wid, uint16 key, uint16 keycode, EventState &state);
/**
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 29f64415d..6d11042d3 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -2406,11 +2406,6 @@ struct GameSettingsWindow : QueryStringBaseWindow {
this->SetWidgetDisabledState(WID_GS_COLLAPSE_ALL, all_folded);
}
- virtual void OnMouseLoop()
- {
- this->HandleEditBox(WID_GS_FILTER);
- }
-
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
/* Handle editbox input */
diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp
index 2d2d1529d..ba7e669c7 100644
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -335,11 +335,6 @@ struct SignListWindow : QueryStringBaseWindow, SignList {
if (widget == WID_SIL_FILTER_TEXT) this->SetFilterString(this->text.buf);
}
- virtual void OnMouseLoop()
- {
- this->HandleEditBox(WID_SIL_FILTER_TEXT);
- }
-
void BuildSortSignList()
{
if (this->signs.NeedRebuild()) {
@@ -574,11 +569,6 @@ struct SignWindow : QueryStringBaseWindow, SignList {
return state;
}
- virtual void OnMouseLoop()
- {
- this->HandleEditBox(WID_QES_TEXT);
- }
-
virtual void OnOpenOSKWindow(int wid)
{
ShowOnScreenKeyboard(this, wid, WID_QES_CANCEL, WID_QES_OK);
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index 9afbf5c8b..2f31ad736 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -1101,11 +1101,6 @@ public:
}
}
- virtual void OnMouseLoop()
- {
- this->HandleEditBox(WID_TF_TOWN_NAME_EDITBOX);
- }
-
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
EventState state = ES_NOT_HANDLED;
diff --git a/src/window.cpp b/src/window.cpp
index 26e93dfa1..0ef7f8007 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -1620,6 +1620,16 @@ static void DecreaseWindowCounters()
}
}
}
+
+ /* Handle editboxes */
+ for (uint i = 0; i < w->nested_array_size; i++) {
+ NWidgetBase *nwid = w->nested_array[i];
+ if (nwid != NULL && nwid->type == WWT_EDITBOX) {
+ QueryString *query = dynamic_cast<QueryString*>(w);
+ if (query != NULL) query->HandleEditBox(w, i);
+ }
+ }
+
w->OnMouseLoop();
}