Fix staticbox content margin on macOS (#9901)

This commit is contained in:
Noisyfox 2025-06-14 11:32:31 +08:00 committed by GitHub
parent 0999cb057d
commit ec44768eb9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -258,10 +258,10 @@ void OptionsGroup::activate_line(Line& line)
) {
// BBS: new layout
const auto h_sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(h_sizer, 1, wxEXPAND | wxALL, wxOSX ? 0 : 15);
sizer->Add(h_sizer, 1, wxEXPAND | wxALL, (wxOSX && !staticbox) ? 0 : 15);
if (line.widget != nullptr) {
// description lines
sizer->Add(line.widget(this->ctrl_parent()), 0, wxEXPAND | wxALL, wxOSX ? 0 : 15);
sizer->Add(line.widget(this->ctrl_parent()), 0, wxEXPAND | wxALL, (wxOSX && !staticbox) ? 0 : 15);
return;
}
if (!line.get_extra_widgets().empty()) {
@ -282,9 +282,9 @@ void OptionsGroup::activate_line(Line& line)
// BBS: new layout
custom_ctrl->SetLabel("");
if (is_legend_line)
sizer->Add(custom_ctrl, 0, wxEXPAND | wxLEFT, wxOSX ? 0 : 10);
sizer->Add(custom_ctrl, 0, wxEXPAND | wxLEFT, (wxOSX && !staticbox) ? 0 : 10);
else
sizer->Add(custom_ctrl, 0, wxEXPAND | wxALL, wxOSX || !staticbox ? 0 : 5);
sizer->Add(custom_ctrl, 0, wxEXPAND | wxALL, !staticbox ? 0 : 5);
}
// Set sidetext width for a better alignment of options in line
@ -304,7 +304,7 @@ void OptionsGroup::activate_line(Line& line)
// BBS: new layout
const auto h_sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(h_sizer, 1, wxEXPAND | wxALL, wxOSX ? 0 : 5);
sizer->Add(h_sizer, 1, wxEXPAND | wxALL, (wxOSX && !staticbox) ? 0 : 5);
if (is_window_field(field))
h_sizer->Add(field->getWindow(), 1, wxEXPAND | wxLEFT, option.opt.multiline ? 0 : titleWidth * wxGetApp().em_unit());
if (is_sizer_field(field))
@ -509,7 +509,7 @@ bool OptionsGroup::activate(std::function<void()> throw_if_canceled/* = [](){}*/
static_cast<wxFlexGridSizer*>(m_grid_sizer)->SetFlexibleDirection(wxBOTH);
static_cast<wxFlexGridSizer*>(m_grid_sizer)->AddGrowableCol(grow_col);
sizer->Add(m_grid_sizer, 0, wxEXPAND | wxALL, wxOSX || !staticbox ? 0 : 5);
sizer->Add(m_grid_sizer, 0, wxEXPAND | wxALL, !staticbox ? 0 : 5);
// activate lines
for (Line& line: m_lines) {