Fixed a layout problem

This commit is contained in:
Zane U. Ji 2013-10-17 01:34:15 +08:00
parent e366b6ec48
commit c484660b4c
2 changed files with 4 additions and 23 deletions

View File

@ -54,18 +54,7 @@ CommandPanel::CommandPanel (
wxButton *fullpathButton = new wxButton ( this, ID_BUTTON_FULLPATH, fullpath, wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER ); wxButton *fullpathButton = new wxButton ( this, ID_BUTTON_FULLPATH, fullpath, wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER );
int editWidth, editHeight; commandEdit = new wxTextCtrl ( this, wxID_ANY );
parent->GetSize( &editWidth, &editHeight);
editWidth -= sizerOffset * 2;
commandEdit = new wxTextCtrl (
this,
wxID_ANY,
_T ( "" ),
wxDefaultPosition,
wxSize ( editWidth, -1 )
);
commandEdit->SetValue ( cmd ); commandEdit->SetValue ( cmd );
runButton = new wxButton ( runButton = new wxButton (
@ -137,27 +126,19 @@ CommandPanel::CommandPanel (
variablesSizer->Add ( extensionButton, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, sizerOffset ); variablesSizer->Add ( extensionButton, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, sizerOffset );
variablesSizer->Add ( fullpathButton, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, sizerOffset ); variablesSizer->Add ( fullpathButton, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, sizerOffset );
topSizer = new wxBoxSizer ( wxHORIZONTAL );
topSizer->Add ( commandEdit, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL | wxEXPAND, sizerOffset );
topSizer->Layout();
bottomSizer = new wxBoxSizer ( wxHORIZONTAL ); bottomSizer = new wxBoxSizer ( wxHORIZONTAL );
bottomSizer->Add ( runButton, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, sizerOffset ); bottomSizer->Add ( runButton, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, sizerOffset );
bottomSizer->Add ( syncBox, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, sizerOffset ); bottomSizer->Add ( syncBox, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, sizerOffset );
bottomSizer->Add ( variablesSizer, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, sizerOffset ); bottomSizer->Add ( variablesSizer, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, sizerOffset );
bottomSizer->Add ( outputSizer, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, sizerOffset ); bottomSizer->Add ( outputSizer, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, sizerOffset );
bottomSizer->Layout();
mainSizer = new wxBoxSizer ( wxVERTICAL ); mainSizer = new wxBoxSizer ( wxVERTICAL );
mainSizer->Add ( topSizer ); mainSizer->Add ( commandEdit, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL | wxEXPAND, sizerOffset );
mainSizer->Add ( bottomSizer ); mainSizer->Add ( bottomSizer );
mainSizer->Layout();
this->SetSizer ( mainSizer ); this->SetSizer ( mainSizer );
this->SetSize ( -1, ( runButton->GetSize().GetHeight() * 2 ) + 25 ); mainSizer->SetSizeHints ( this );
} }
CommandPanel::~CommandPanel() CommandPanel::~CommandPanel()

View File

@ -63,7 +63,7 @@ class CommandPanel : public wxPanel
wxButton *runButton; wxButton *runButton;
wxCheckBox *syncBox; wxCheckBox *syncBox;
wxRadioButton *outputIgnore, *outputInsert, *outputNewDocument; wxRadioButton *outputIgnore, *outputInsert, *outputNewDocument;
wxBoxSizer *topSizer, *bottomSizer, *mainSizer; wxBoxSizer *bottomSizer, *mainSizer;
MyFrame *parent; MyFrame *parent;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };