mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 18:40:29 +00:00
Codechange: Add EditBoxGainedFocus method to VideoDriver base class
This commit is contained in:
parent
46f7c6a641
commit
81f159434d
@ -374,6 +374,11 @@ struct IConsoleWindow : Window
|
||||
this->Scroll(-wheel);
|
||||
}
|
||||
|
||||
void OnFocus() override
|
||||
{
|
||||
VideoDriver::GetInstance()->EditBoxGainedFocus();
|
||||
}
|
||||
|
||||
void OnFocusLost() override
|
||||
{
|
||||
VideoDriver::GetInstance()->EditBoxLostFocus();
|
||||
|
@ -93,6 +93,11 @@ public:
|
||||
*/
|
||||
virtual void EditBoxLostFocus() {}
|
||||
|
||||
/**
|
||||
* An edit box gained the input focus
|
||||
*/
|
||||
virtual void EditBoxGainedFocus() {}
|
||||
|
||||
/**
|
||||
* Get the currently active instance of the video driver.
|
||||
*/
|
||||
|
@ -499,11 +499,20 @@ bool Window::SetFocusedWidget(int widget_index)
|
||||
if (this->nested_focus->type == WWT_EDITBOX) VideoDriver::GetInstance()->EditBoxLostFocus();
|
||||
}
|
||||
this->nested_focus = this->GetWidget<NWidgetCore>(widget_index);
|
||||
if (this->nested_focus->type == WWT_EDITBOX) VideoDriver::GetInstance()->EditBoxGainedFocus();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when window looses focus
|
||||
* Called when window gains focus
|
||||
*/
|
||||
void Window::OnFocus()
|
||||
{
|
||||
if (this->nested_focus != nullptr && this->nested_focus->type == WWT_EDITBOX) VideoDriver::GetInstance()->EditBoxGainedFocus();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when window loses focus
|
||||
*/
|
||||
void Window::OnFocusLost()
|
||||
{
|
||||
|
@ -592,10 +592,7 @@ public:
|
||||
*/
|
||||
virtual void SetStringParameters(int widget) const {}
|
||||
|
||||
/**
|
||||
* Called when window gains focus
|
||||
*/
|
||||
virtual void OnFocus() {}
|
||||
virtual void OnFocus();
|
||||
|
||||
virtual void OnFocusLost();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user