An attempt to fix weird sizer-related checkbox issues on Linux and macOS

This commit is contained in:
Lukas Matena 2023-12-08 21:56:46 +01:00
parent fd15c8cca5
commit 65610036d6
2 changed files with 15 additions and 0 deletions

View File

@ -304,7 +304,12 @@ RichMessageDialogBase::RichMessageDialogBase(wxWindow* parent, const HtmlContent
m_content = content; // We need a copy for the on_link_clicked lambda.
add_msg_content(this, content_sizer, m_content);
#ifdef _WIN32 // See comment in the header where m_checkBox is defined.
m_checkBox = new ::CheckBox(this, m_checkBoxText);
#else
m_checkBox = new wxCheckBox(this, wxID_ANY, m_checkBoxText);
#endif
wxGetApp().UpdateDarkUI(m_checkBox);
m_checkBox->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent&) { m_checkBoxValue = m_checkBox->GetValue(); });

View File

@ -110,7 +110,17 @@ wxString get_wraped_wxString(const wxString& text_in, size_t line_len = 80);
// Generic rich message dialog, used intead of wxRichMessageDialog
class RichMessageDialogBase : public MsgDialog
{
// Using CheckBox causes some weird sizer-related issues on Linux and macOS. To get around the problem before
// we find a better fix, we will fallback to wxCheckBox in this dialog. This makes little difference for most dialogs,
// We currently only use this class as a base for HtmlCapableRichMessageDialog on Linux and macOS. The normal
// RichMessageDialog is just an alias for wxRichMessageDialog on these platforms.
#ifdef _WIN32
CheckBox* m_checkBox{ nullptr };
#else
wxCheckBox* m_checkBox{ nullptr };
#endif
wxString m_checkBoxText;
bool m_checkBoxValue{ false };