mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 15:52:55 +01:00
Refactor window flags to be read with the helper methods
This commit is contained in:
@@ -719,28 +719,22 @@ void Window::InvalidateWidget(rct_widgetindex widgetIndex)
|
||||
|
||||
bool Window::IsWidgetDisabled(rct_widgetindex widgetIndex) const
|
||||
{
|
||||
return (disabled_widgets & (1LL << widgetIndex)) != 0;
|
||||
return WidgetIsDisabled(this, widgetIndex);
|
||||
}
|
||||
|
||||
bool Window::IsWidgetPressed(rct_widgetindex widgetIndex) const
|
||||
{
|
||||
return (pressed_widgets & (1LL << widgetIndex)) != 0;
|
||||
return WidgetIsPressed(this, widgetIndex);
|
||||
}
|
||||
|
||||
void Window::SetWidgetDisabled(rct_widgetindex widgetIndex, bool value)
|
||||
{
|
||||
if (value)
|
||||
disabled_widgets |= (1ULL << widgetIndex);
|
||||
else
|
||||
disabled_widgets &= ~(1ULL << widgetIndex);
|
||||
WidgetSetDisabled(this, widgetIndex, value);
|
||||
}
|
||||
|
||||
void Window::SetWidgetPressed(rct_widgetindex widgetIndex, bool value)
|
||||
{
|
||||
if (value)
|
||||
pressed_widgets |= (1ULL << widgetIndex);
|
||||
else
|
||||
pressed_widgets &= ~(1ULL << widgetIndex);
|
||||
WidgetSetPressed(this, widgetIndex, value);
|
||||
}
|
||||
|
||||
void Window::SetCheckboxValue(rct_widgetindex widgetIndex, bool value)
|
||||
@@ -764,3 +758,20 @@ void Window::TextInputOpen(
|
||||
{
|
||||
WindowTextInputOpen(this, callWidget, title, description, descriptionArgs, existingText, existingArgs, maxLength);
|
||||
}
|
||||
|
||||
void window_align_tabs(rct_window* w, rct_widgetindex start_tab_id, rct_widgetindex end_tab_id)
|
||||
{
|
||||
int32_t i, x = w->widgets[start_tab_id].left;
|
||||
int32_t tab_width = w->widgets[start_tab_id].width();
|
||||
|
||||
for (i = start_tab_id; i <= end_tab_id; i++)
|
||||
{
|
||||
if (!WidgetIsDisabled(w, i))
|
||||
{
|
||||
auto& widget = w->widgets[i];
|
||||
widget.left = x;
|
||||
widget.right = x + tab_width;
|
||||
x += tab_width + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user