mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-24 00:03:11 +01:00
Add shift and control modifiers to close window button (#18537)
Shift closes all but current window. Control closes all windows of the same window class/type. Co-authored-by: Chris Higgins <chrissywissywoo@hotmail.com> Co-authored-by: Tulio Leao <tupaschoal@gmail.com>
This commit is contained in:
@@ -746,7 +746,44 @@ void Window::DrawWidgets(rct_drawpixelinfo& dpi)
|
||||
|
||||
void Window::Close()
|
||||
{
|
||||
window_close(*this);
|
||||
CloseWindowModifier modifier = GetCloseModifier();
|
||||
|
||||
if (modifier == CloseWindowModifier::Shift)
|
||||
{
|
||||
CloseOthers();
|
||||
}
|
||||
else if (modifier == CloseWindowModifier::Control)
|
||||
{
|
||||
CloseOthersOfThisClass();
|
||||
}
|
||||
else
|
||||
{
|
||||
window_close(*this);
|
||||
}
|
||||
}
|
||||
|
||||
void Window::CloseOthers()
|
||||
{
|
||||
window_close_all_except_number_and_class(number, classification);
|
||||
}
|
||||
|
||||
void Window::CloseOthersOfThisClass()
|
||||
{
|
||||
window_close_by_class(classification);
|
||||
}
|
||||
|
||||
CloseWindowModifier Window::GetCloseModifier()
|
||||
{
|
||||
CloseWindowModifier lastModifier = CloseWindowModifier::None;
|
||||
|
||||
if (gLastCloseModifier.window.number == number && gLastCloseModifier.window.classification == classification)
|
||||
{
|
||||
lastModifier = gLastCloseModifier.modifier;
|
||||
}
|
||||
|
||||
gLastCloseModifier.modifier = CloseWindowModifier::None;
|
||||
|
||||
return lastModifier;
|
||||
}
|
||||
|
||||
void Window::TextInputOpen(
|
||||
|
||||
Reference in New Issue
Block a user