mirror of https://github.com/OpenTTD/OpenTTD
(svn r18675) -Add [FS#3256]: function to remove focus from all widgets in a window
parent
739aea3e1a
commit
de3cff9e1a
|
@ -132,6 +132,18 @@ bool EditBoxInGlobalFocus()
|
||||||
return _focused_window->nested_focus != NULL && _focused_window->nested_focus->type == WWT_EDITBOX;
|
return _focused_window->nested_focus != NULL && _focused_window->nested_focus->type == WWT_EDITBOX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes no widget on this window have focus. The function however doesn't change which window has focus.
|
||||||
|
*/
|
||||||
|
void Window::UnfocusFocusedWidget()
|
||||||
|
{
|
||||||
|
if (this->nested_focus != NULL) {
|
||||||
|
/* Repaint the widget that lost focus. A focused edit box may else leave the caret on the screen. */
|
||||||
|
this->nested_focus->SetDirty(this);
|
||||||
|
this->nested_focus = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set focus within this window to the given widget. The function however doesn't change which window has focus.
|
* Set focus within this window to the given widget. The function however doesn't change which window has focus.
|
||||||
* @param widget_index Index of the widget in the window to set the focus to.
|
* @param widget_index Index of the widget in the window to set the focus to.
|
||||||
|
|
|
@ -519,6 +519,7 @@ public:
|
||||||
return this->GetWidget<NWidgetCore>(widget_index)->IsLowered();
|
return this->GetWidget<NWidgetCore>(widget_index)->IsLowered();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UnfocusFocusedWidget();
|
||||||
bool SetFocusedWidget(byte widget_index);
|
bool SetFocusedWidget(byte widget_index);
|
||||||
|
|
||||||
void HandleButtonClick(byte widget);
|
void HandleButtonClick(byte widget);
|
||||||
|
|
Loading…
Reference in New Issue