mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-20 02:42:42 +01:00
This commit is contained in:
committed by
GitHub
parent
92e895a37a
commit
abf8438a1b
@@ -3476,3 +3476,20 @@ std::unique_ptr<NWidgetBase> MakeCompanyButtonRows(WidgetID widget_first, Widget
|
||||
if (hor != nullptr) vert->Add(std::move(hor));
|
||||
return vert;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unfocuses the focused widget of the window,
|
||||
* if the focused widget is contained inside the container.
|
||||
* @param parent_window Window which contains this container.
|
||||
*/
|
||||
void NWidgetContainer::UnfocusWidgets(Window *parent_window)
|
||||
{
|
||||
assert(parent_window != nullptr);
|
||||
if (parent_window->nested_focus != nullptr) {
|
||||
for (auto &widget : this->children) {
|
||||
if (parent_window->nested_focus == widget.get()) {
|
||||
parent_window->UnfocusFocusedWidget();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user