mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r24726) -Codechange: Move editbox mouseloop handling to Window class.
This commit is contained in:
parent
2614ed18f9
commit
137adb3496
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -723,11 +723,6 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual void OnMouseLoop()
|
||||
{
|
||||
this->HandleEditBox(WID_NCL_FILTER);
|
||||
}
|
||||
|
||||
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
|
||||
{
|
||||
switch (keycode) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue