Allow specifying the maximum width of static text in dialogs

This patch allows specification of the maximum width of static texts
created with wxDialog::CreateTextSizer.

The patch preserves backwards compatibility by setting the previous
width value as the default argument value.

Closes https://github.com/wxWidgets/wxWidgets/pull/355
This commit is contained in:
Tobias Schlager
2016-12-01 09:43:29 +01:00
committed by Vadim Zeitlin
parent aad8663698
commit 73f6f622f9
3 changed files with 18 additions and 10 deletions

View File

@@ -196,19 +196,19 @@ wxDialogBase::GetParentForModalDialog(wxWindow *parent, long style) const
#if wxUSE_STATTEXT
wxSizer *wxDialogBase::CreateTextSizer(const wxString& message)
wxSizer *wxDialogBase::CreateTextSizer(const wxString& message, int widthMax)
{
wxTextSizerWrapper wrapper(this);
return CreateTextSizer(message, wrapper);
return CreateTextSizer(message, wrapper, widthMax);
}
wxSizer *wxDialogBase::CreateTextSizer(const wxString& message,
wxTextSizerWrapper& wrapper)
wxTextSizerWrapper& wrapper,
int widthMax)
{
// I admit that this is complete bogus, but it makes
// message boxes work for pda screens temporarily..
int widthMax = -1;
const bool is_pda = wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA;
if (is_pda)
{