Use wxSizerFlags instead of multiple argument Add() overload when constructing sizers in wxPG.

Set sizer flags in wxLongStringProperty::DisplayEditorDialog and wxPGArrayEditorDialog::Create in this more convenient way.
This commit is contained in:
Artur Wieczorek
2015-05-29 21:05:30 +02:00
parent a210cb0bbf
commit 6dfd6f4930

View File

@@ -2247,17 +2247,15 @@ bool wxLongStringProperty::DisplayEditorDialog( wxPGProperty* prop, wxPropertyGr
wxTextCtrl* ed = new wxTextCtrl(dlg,wxID_ANY,value, wxTextCtrl* ed = new wxTextCtrl(dlg,wxID_ANY,value,
wxDefaultPosition,wxDefaultSize,edStyle); wxDefaultPosition,wxDefaultSize,edStyle);
rowsizer->Add( ed, 1, wxEXPAND|wxALL, spacing ); rowsizer->Add(ed, wxSizerFlags(1).Expand().Border(wxALL, spacing));
topsizer->Add( rowsizer, 1, wxEXPAND, 0 ); topsizer->Add(rowsizer, wxSizerFlags(1).Expand());
wxStdDialogButtonSizer* buttonSizer = new wxStdDialogButtonSizer(); wxStdDialogButtonSizer* buttonSizer = new wxStdDialogButtonSizer();
if ( !prop->HasFlag(wxPG_PROP_READONLY) ) if ( !prop->HasFlag(wxPG_PROP_READONLY) )
buttonSizer->AddButton(new wxButton(dlg, wxID_OK)); buttonSizer->AddButton(new wxButton(dlg, wxID_OK));
buttonSizer->AddButton(new wxButton(dlg, wxID_CANCEL)); buttonSizer->AddButton(new wxButton(dlg, wxID_CANCEL));
buttonSizer->Realize(); buttonSizer->Realize();
topsizer->Add( buttonSizer, 0, topsizer->Add(buttonSizer, wxSizerFlags(0).Right().Border(wxBOTTOM|wxRIGHT, spacing));
wxALIGN_RIGHT|wxBOTTOM|wxRIGHT,
spacing );
dlg->SetSizer( topsizer ); dlg->SetSizer( topsizer );
topsizer->SetSizeHints( dlg ); topsizer->SetSizeHints( dlg );
@@ -2396,7 +2394,7 @@ bool wxPGArrayEditorDialog::Create( wxWindow *parent,
// Message // Message
if ( !message.empty() ) if ( !message.empty() )
topsizer->Add( new wxStaticText(this,-1,message), topsizer->Add( new wxStaticText(this,-1,message),
0, wxALIGN_LEFT|wxALL, spacing ); wxSizerFlags(0).Left().Border(wxALL, spacing) );
m_elb = new wxEditableListBox(this, wxID_ANY, message, m_elb = new wxEditableListBox(this, wxID_ANY, message,
wxDefaultPosition, wxDefaultPosition,
@@ -2444,16 +2442,14 @@ bool wxPGArrayEditorDialog::Create( wxWindow *parent,
wxListEventHandler(wxPGArrayEditorDialog::OnEndLabelEdit), wxListEventHandler(wxPGArrayEditorDialog::OnEndLabelEdit),
NULL, this); NULL, this);
topsizer->Add( m_elb, 1, wxEXPAND, spacing ); topsizer->Add(m_elb, wxSizerFlags(1).Expand().Border(0, spacing));
// Standard dialog buttons // Standard dialog buttons
wxStdDialogButtonSizer* buttonSizer = new wxStdDialogButtonSizer(); wxStdDialogButtonSizer* buttonSizer = new wxStdDialogButtonSizer();
buttonSizer->AddButton(new wxButton(this, wxID_OK)); buttonSizer->AddButton(new wxButton(this, wxID_OK));
buttonSizer->AddButton(new wxButton(this, wxID_CANCEL)); buttonSizer->AddButton(new wxButton(this, wxID_CANCEL));
buttonSizer->Realize(); buttonSizer->Realize();
topsizer->Add( buttonSizer, 0, topsizer->Add(buttonSizer, wxSizerFlags(0).Right().Border(wxALL, spacing));
wxALIGN_RIGHT|wxALL,
spacing );
m_elb->SetFocus(); m_elb->SetFocus();