- // Add button
- m_butAdd = new wxButton(this,22,_("Add"));
- rowsizer->Add( m_butAdd,
- 0, wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, spacing );
- topsizer->Add( rowsizer, 0, wxEXPAND, spacing );
-
- // Separator line
- topsizer->Add( new wxStaticLine(this,-1),
- 0, wxEXPAND|wxBOTTOM|wxLEFT|wxRIGHT, spacing );
-
- rowsizer = new wxBoxSizer( wxHORIZONTAL );
-
- // list box
- m_lbStrings = new wxListBox(this, 24, wxDefaultPosition, wxDefaultSize);
- unsigned int i;
- for ( i=0; i<ArrayGetCount(); i++ )
- m_lbStrings->Append( ArrayGet(i) );
- rowsizer->Add( m_lbStrings, 1, wxEXPAND|wxRIGHT, spacing );
-
- // Manipulator buttons
- wxBoxSizer* colsizer = new wxBoxSizer( wxVERTICAL );
- m_butCustom = (wxButton*) NULL;
- if ( m_custBtText )
- {
- m_butCustom = new wxButton(this,28,::wxGetTranslation(m_custBtText));
- colsizer->Add( m_butCustom,
- 0, wxALIGN_CENTER|wxTOP/*wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT*/,
- spacing );
- }
- m_butUpdate = new wxButton(this,27,_("Update"));
- colsizer->Add( m_butUpdate,
- 0, wxALIGN_CENTER|wxTOP, spacing );
- m_butRemove = new wxButton(this,23,_("Remove"));
- colsizer->Add( m_butRemove,
- 0, wxALIGN_CENTER|wxTOP, spacing );
- m_butUp = new wxButton(this,25,_("Up"));
- colsizer->Add( m_butUp,
- 0, wxALIGN_CENTER|wxTOP, spacing );
- m_butDown = new wxButton(this,26,_("Down"));
- colsizer->Add( m_butDown,
- 0, wxALIGN_CENTER|wxTOP, spacing );
- rowsizer->Add( colsizer, 0, 0, spacing );
-
- topsizer->Add( rowsizer, 1, wxLEFT|wxRIGHT|wxEXPAND, spacing );
-
- // Separator line
- topsizer->Add( new wxStaticLine(this,-1),
- 0, wxEXPAND|wxTOP|wxLEFT|wxRIGHT, spacing );
-
- // buttons
- rowsizer = new wxBoxSizer( wxHORIZONTAL );
- /*
- const int but_sz_flags =
- wxALIGN_RIGHT|wxALIGN_CENTRE_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT;
- */
- rowsizer->Add( new wxButton(this,wxID_OK,_("Ok")),
- 0, but_sz_flags, spacing );
- rowsizer->Add( new wxButton(this,wxID_CANCEL,_("Cancel")),
- 0, but_sz_flags, spacing );
- topsizer->Add( rowsizer, 0, wxALIGN_RIGHT|wxALIGN_CENTRE_VERTICAL, 0 );
-
- m_edValue->SetFocus();
+ // Populate the list box
+ wxArrayString arr;
+ for ( unsigned int i=0; i<ArrayGetCount(); i++ )
+ arr.push_back(ArrayGet(i));
+ m_elb->SetStrings(arr);
+
+ // Connect event handlers
+ wxButton* but;
+ wxListCtrl* lc = m_elb->GetListCtrl();
+
+ but = m_elb->GetNewButton();
+ m_elbSubPanel = but->GetParent();
+ but->Connect(but->GetId(), wxEVT_COMMAND_BUTTON_CLICKED,
+ wxCommandEventHandler(wxPGArrayEditorDialog::OnAddClick),
+ NULL, this);
+
+ but = m_elb->GetDelButton();
+ but->Connect(but->GetId(), wxEVT_COMMAND_BUTTON_CLICKED,
+ wxCommandEventHandler(wxPGArrayEditorDialog::OnDeleteClick),
+ NULL, this);
+
+ but = m_elb->GetUpButton();
+ but->Connect(but->GetId(), wxEVT_COMMAND_BUTTON_CLICKED,
+ wxCommandEventHandler(wxPGArrayEditorDialog::OnUpClick),
+ NULL, this);
+
+ but = m_elb->GetDownButton();
+ but->Connect(but->GetId(), wxEVT_COMMAND_BUTTON_CLICKED,
+ wxCommandEventHandler(wxPGArrayEditorDialog::OnDownClick),
+ NULL, this);
+
+ lc->Connect(lc->GetId(), wxEVT_COMMAND_LIST_END_LABEL_EDIT,
+ wxListEventHandler(wxPGArrayEditorDialog::OnEndLabelEdit),
+ NULL, this);
+
+ topsizer->Add( m_elb, 1, wxEXPAND, spacing );
+
+ // Standard dialog buttons
+ wxStdDialogButtonSizer* buttonSizer = new wxStdDialogButtonSizer();
+ buttonSizer->AddButton(new wxButton(this, wxID_OK));
+ buttonSizer->AddButton(new wxButton(this, wxID_CANCEL));
+ buttonSizer->Realize();
+ topsizer->Add( buttonSizer, 0,
+ wxALIGN_RIGHT|wxALIGN_CENTRE_VERTICAL|wxALL,
+ spacing );
+
+ m_elb->SetFocus();