Minor cleanup of a dialog in the dialogs sample

Use wxSizerFlags()-based API for clarity high DPI-friendliness, i.e.
don't hard code 5px as border/margin sizes.

No real changes.
This commit is contained in:
Vadim Zeitlin 2019-09-06 14:33:00 +02:00
parent 32eb6f1a2c
commit 5f635db3bf

View File

@ -2588,7 +2588,8 @@ TestDefaultActionDialog::TestDefaultActionDialog( wxWindow *parent ) :
wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer *grid_sizer = new wxFlexGridSizer( 2, 5, 5 );
const int border = wxSizerFlags::GetDefaultBorder();
wxFlexGridSizer *grid_sizer = new wxFlexGridSizer(2, wxSize(border, border));
#if wxUSE_LISTBOX
wxListBox *listbox = new wxListBox( this, ID_LISTBOX );
@ -2599,22 +2600,29 @@ TestDefaultActionDialog::TestDefaultActionDialog( wxWindow *parent ) :
grid_sizer->Add( listbox );
#endif // wxUSE_LISTBOX
grid_sizer->Add( new wxCheckBox( this, ID_CATCH_LISTBOX_DCLICK, "Catch DoubleClick from wxListBox" ), 0, wxALIGN_CENTRE_VERTICAL );
grid_sizer->Add(new wxCheckBox(this, ID_CATCH_LISTBOX_DCLICK, "Catch DoubleClick from wxListBox"),
wxSizerFlags().CentreVertical());
grid_sizer->Add( new wxTextCtrl( this, -1, "", wxDefaultPosition, wxSize(80,-1), 0 ), 0, wxALIGN_CENTRE_VERTICAL );
grid_sizer->Add( new wxStaticText( this, -1, "wxTextCtrl without wxTE_PROCESS_ENTER" ), 0, wxALIGN_CENTRE_VERTICAL );
grid_sizer->Add(new wxTextCtrl(this, wxID_ANY, ""),
wxSizerFlags().CentreVertical());
grid_sizer->Add(new wxStaticText(this, wxID_ANY, "wxTextCtrl without wxTE_PROCESS_ENTER"),
wxSizerFlags().CentreVertical());
grid_sizer->Add( new wxTextCtrl( this, -1, "", wxDefaultPosition, wxSize(80,-1), wxTE_PROCESS_ENTER ), 0, wxALIGN_CENTRE_VERTICAL );
grid_sizer->Add( new wxStaticText( this, -1, "wxTextCtrl with wxTE_PROCESS_ENTER" ), 0, wxALIGN_CENTRE_VERTICAL );
grid_sizer->Add(new wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER),
wxSizerFlags().CentreVertical());
grid_sizer->Add(new wxStaticText(this, wxID_ANY, "wxTextCtrl with wxTE_PROCESS_ENTER"),
wxSizerFlags().CentreVertical());
grid_sizer->Add( new wxCheckBox(this, ID_DISABLE_OK, "Disable \"OK\""), 0, wxALIGN_CENTRE_VERTICAL );
grid_sizer->Add( new wxCheckBox(this, ID_DISABLE_CANCEL, "Disable \"Cancel\""), 0, wxALIGN_CENTRE_VERTICAL );
grid_sizer->Add(new wxCheckBox(this, ID_DISABLE_OK, "Disable \"OK\""),
wxSizerFlags().CentreVertical());
grid_sizer->Add(new wxCheckBox(this, ID_DISABLE_CANCEL, "Disable \"Cancel\""),
wxSizerFlags().CentreVertical());
main_sizer->Add( grid_sizer, 0, wxALL, 10 );
main_sizer->Add(grid_sizer, wxSizerFlags().DoubleBorder());
wxSizer *button_sizer = CreateSeparatedButtonSizer( wxOK|wxCANCEL );
if ( button_sizer )
main_sizer->Add( button_sizer, 0, wxALL|wxGROW, 5 );
main_sizer->Add(button_sizer, wxSizerFlags().Expand().Border());
SetSizerAndFit( main_sizer );
}