mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-27 19:17:06 +08:00
Wrap wxGenericMessageDialog text to make it more readable
Prevent the text from being clipped and also improve readability by wrapping it at (arbitrarily hard coded) 70 characters boundary. Closes #24412.
This commit is contained in:
committed by
Vadim Zeitlin
parent
e6335d6c82
commit
75c552811f
@@ -184,6 +184,12 @@ void wxGenericMessageDialog::DoCreateMsgdialog()
|
||||
|
||||
wxBoxSizer * const textsizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
// To prevent clipping
|
||||
int maxWidth = wxSystemSettings::GetMetric(wxSYS_SCREEN_X, this) - FromDIP(25);
|
||||
|
||||
// To enhance readability
|
||||
maxWidth = wxMin( maxWidth, GetCharWidth() * 70 );
|
||||
|
||||
// We want to show the main message in a different font to make it stand
|
||||
// out if the extended message is used as well. This looks better and is
|
||||
// more consistent with the native dialogs under MSW and GTK.
|
||||
@@ -191,7 +197,7 @@ void wxGenericMessageDialog::DoCreateMsgdialog()
|
||||
if ( !m_extendedMessage.empty() )
|
||||
{
|
||||
wxTitleTextWrapper titleWrapper(this);
|
||||
textsizer->Add(CreateTextSizer(GetMessage(), titleWrapper),
|
||||
textsizer->Add(CreateTextSizer(GetMessage(), titleWrapper, maxWidth),
|
||||
wxSizerFlags().Border(wxBOTTOM, 20));
|
||||
|
||||
lowerMessage = GetExtendedMessage();
|
||||
@@ -201,7 +207,7 @@ void wxGenericMessageDialog::DoCreateMsgdialog()
|
||||
lowerMessage = GetMessage();
|
||||
}
|
||||
|
||||
textsizer->Add(CreateTextSizer(lowerMessage));
|
||||
textsizer->Add(CreateTextSizer(lowerMessage, maxWidth));
|
||||
|
||||
icon_text->Add(textsizer, 0, wxALIGN_CENTER, 10);
|
||||
topsizer->Add( icon_text, 1, wxLEFT|wxRIGHT|wxTOP, 10 );
|
||||
|
||||
Reference in New Issue
Block a user