Codechange: Add utility function for whether the focused window is a console

pull/115/head
Jonathan G Rennison 5 years ago committed by Charles Pigott
parent 81f159434d
commit 1dba06656d

@ -466,6 +466,15 @@ bool EditBoxInGlobalFocus()
return _focused_window->nested_focus != nullptr && _focused_window->nested_focus->type == WWT_EDITBOX;
}
/**
* Check if a console is focused.
* @return returns true if the focused window is a console, else false
*/
bool FocusedWindowIsConsole()
{
return _focused_window && _focused_window->window_class == WC_CONSOLE;
}
/**
* Makes no widget on this window have focus. The function however doesn't change which window has focus.
*/

@ -55,6 +55,7 @@ void DeleteWindowById(WindowClass cls, WindowNumber number, bool force = true);
void DeleteWindowByClass(WindowClass cls);
bool EditBoxInGlobalFocus();
bool FocusedWindowIsConsole();
Point GetCaretPosition();
#endif /* WINDOW_FUNC_H */

Loading…
Cancel
Save