| 10 | /////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | PortSelectorDialogBase::PortSelectorDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) |
| 13 | { |
| 14 | this->SetSizeHints( wxSize( 300,200 ), wxDefaultSize ); |
| 15 | |
| 16 | wxBoxSizer* dlgSizer; |
| 17 | dlgSizer = new wxBoxSizer( wxVERTICAL ); |
| 18 | |
| 19 | m_staticText1 = new wxStaticText( this, wxID_ANY, wxT("Select a detected port or enter your own"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 20 | m_staticText1->Wrap( -1 ); |
| 21 | dlgSizer->Add( m_staticText1, 0, wxALIGN_CENTER|wxTOP, 5 ); |
| 22 | |
| 23 | m_portList = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); |
| 24 | dlgSizer->Add( m_portList, 1, wxALL|wxEXPAND, 5 ); |
| 25 | |
| 26 | wxBoxSizer* bSizer3; |
| 27 | bSizer3 = new wxBoxSizer( wxHORIZONTAL ); |
| 28 | |
| 29 | bSizer3->SetMinSize( wxSize( -1,30 ) ); |
| 30 | m_staticText2 = new wxStaticText( this, wxID_ANY, wxT("Port"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 31 | m_staticText2->Wrap( -1 ); |
| 32 | bSizer3->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); |
| 33 | |
| 34 | m_portSelection = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); |
| 35 | bSizer3->Add( m_portSelection, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); |
| 36 | |
| 37 | |
| 38 | dlgSizer->Add( bSizer3, 0, wxEXPAND, 5 ); |
| 39 | |
| 40 | wxBoxSizer* bSizer2; |
| 41 | bSizer2 = new wxBoxSizer( wxHORIZONTAL ); |
| 42 | |
| 43 | m_cancelButton = new wxButton( this, wxID_ANY, wxT("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 44 | bSizer2->Add( m_cancelButton, 0, wxALL|wxALIGN_BOTTOM, 5 ); |
| 45 | |
| 46 | |
| 47 | bSizer2->Add( 0, 0, 1, wxEXPAND, 5 ); |
| 48 | |
| 49 | m_okButton = new wxButton( this, wxID_ANY, wxT("OK"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 50 | bSizer2->Add( m_okButton, 0, wxALL|wxALIGN_BOTTOM, 5 ); |
| 51 | |
| 52 | |
| 53 | dlgSizer->Add( bSizer2, 0, wxEXPAND, 5 ); |
| 54 | |
| 55 | |
| 56 | this->SetSizer( dlgSizer ); |
| 57 | this->Layout(); |
| 58 | |
| 59 | this->Centre( wxBOTH ); |
| 60 | |
| 61 | // Connect Events |
| 62 | this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PortSelectorDialogBase::onClose ) ); |
| 63 | m_portList->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( PortSelectorDialogBase::onListSelect ), NULL, this ); |
| 64 | m_cancelButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PortSelectorDialogBase::onCancelButton ), NULL, this ); |
| 65 | m_okButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PortSelectorDialogBase::onOKButton ), NULL, this ); |
| 66 | } |
| 67 | |
| 68 | PortSelectorDialogBase::~PortSelectorDialogBase() |
| 69 | { |