Harmonize wxSizer::Add() calls in wx{Text,Number}EntryDialog

These dialogs are pretty similar, so use the same wxSizerFlags arguments
when constructing them for consistency.

Using wxSizerFlags::Border() instead of hard-coded 5 or 10px is also
more correct and improves wxNumberEntryDialog appearance in high DPI
under MSW.
This commit is contained in:
Vadim Zeitlin
2022-02-19 15:34:12 +01:00
parent a83fff2902
commit fab42c3e2c
2 changed files with 7 additions and 10 deletions

View File

@@ -88,7 +88,7 @@ bool wxNumberEntryDialog::Create(wxWindow *parent,
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
#if wxUSE_STATTEXT
// 1) text message
topsizer->Add( CreateTextSizer( message ), 0, wxALL, 10 );
topsizer->Add( CreateTextSizer( message ), wxSizerFlags().DoubleBorder() );
#endif
// 2) prompt and text ctrl
@@ -97,7 +97,8 @@ bool wxNumberEntryDialog::Create(wxWindow *parent,
#if wxUSE_STATTEXT
// prompt if any
if (!prompt.empty())
inputsizer->Add( new wxStaticText( this, wxID_ANY, prompt ), 0, wxCENTER | wxLEFT, 10 );
inputsizer->Add( new wxStaticText( this, wxID_ANY, prompt ),
wxSizerFlags().Center().DoubleBorder(wxLEFT) );
#endif
// spin ctrl
@@ -108,9 +109,9 @@ bool wxNumberEntryDialog::Create(wxWindow *parent,
#else
m_spinctrl = new wxTextCtrl(this, wxID_ANY, valStr, wxDefaultPosition, wxSize( 140, wxDefaultCoord ));
#endif
inputsizer->Add( m_spinctrl, 1, wxCENTER | wxLEFT | wxRIGHT, 10 );
inputsizer->Add( m_spinctrl, wxSizerFlags(1).Center().DoubleBorder(wxLEFT | wxRIGHT));
// add both
topsizer->Add( inputsizer, 0, wxEXPAND | wxLEFT|wxRIGHT, 5 );
topsizer->Add( inputsizer, wxSizerFlags().Expand().Border(wxLEFT | wxRIGHT));
// 3) buttons if any
wxSizer *buttonSizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL);

View File

@@ -85,13 +85,9 @@ bool wxTextEntryDialog::Create(wxWindow *parent,
m_value = value;
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
wxSizerFlags flagsBorder2;
flagsBorder2.DoubleBorder();
#if wxUSE_STATTEXT
// 1) text message
topsizer->Add(CreateTextSizer(message), flagsBorder2);
topsizer->Add(CreateTextSizer(message), wxSizerFlags().DoubleBorder());
#endif
// 2) text ctrl: create it with wxTE_RICH2 style to allow putting more than
@@ -112,7 +108,7 @@ bool wxTextEntryDialog::Create(wxWindow *parent,
wxSizer *buttonSizer = CreateSeparatedButtonSizer(style & (wxOK | wxCANCEL));
if ( buttonSizer )
{
topsizer->Add(buttonSizer, wxSizerFlags(flagsBorder2).Expand());
topsizer->Add(buttonSizer, wxSizerFlags().Expand().DoubleBorder());
}
SetSizer( topsizer );