From 5f635db3bf330c05a3942943b4b619dff9be3db3 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 6 Sep 2019 14:33:00 +0200 Subject: [PATCH] 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. --- samples/dialogs/dialogs.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index 9f7dc652f7..1f9f8b37c0 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -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 ); }