// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
void OnButtonDelete(wxCommandEvent& event);
void OnButtonDeleteSel(wxCommandEvent& event);
void OnButtonClear(wxCommandEvent& event);
void OnButtonDelete(wxCommandEvent& event);
void OnButtonDeleteSel(wxCommandEvent& event);
void OnButtonClear(wxCommandEvent& event);
void OnButtonAdd(wxCommandEvent& event);
void OnButtonAddSeveral(wxCommandEvent& event);
void OnButtonAddMany(wxCommandEvent& event);
void OnButtonAdd(wxCommandEvent& event);
void OnButtonAddSeveral(wxCommandEvent& event);
void OnButtonAddMany(wxCommandEvent& event);
EVT_BUTTON(LboxTest_Delete, LboxTestFrame::OnButtonDelete)
EVT_BUTTON(LboxTest_DeleteSel, LboxTestFrame::OnButtonDeleteSel)
EVT_BUTTON(LboxTest_Clear, LboxTestFrame::OnButtonClear)
EVT_BUTTON(LboxTest_Delete, LboxTestFrame::OnButtonDelete)
EVT_BUTTON(LboxTest_DeleteSel, LboxTestFrame::OnButtonDeleteSel)
EVT_BUTTON(LboxTest_Clear, LboxTestFrame::OnButtonClear)
EVT_BUTTON(LboxTest_Add, LboxTestFrame::OnButtonAdd)
EVT_BUTTON(LboxTest_AddSeveral, LboxTestFrame::OnButtonAddSeveral)
EVT_BUTTON(LboxTest_AddMany, LboxTestFrame::OnButtonAddMany)
EVT_BUTTON(LboxTest_Add, LboxTestFrame::OnButtonAdd)
EVT_BUTTON(LboxTest_AddSeveral, LboxTestFrame::OnButtonAddSeveral)
EVT_BUTTON(LboxTest_AddMany, LboxTestFrame::OnButtonAddMany)
EVT_UPDATE_UI(LboxTest_DeleteSel, LboxTestFrame::OnUpdateUIDeleteSelButton)
EVT_LISTBOX(LboxTest_Listbox, LboxTestFrame::OnListbox)
EVT_UPDATE_UI(LboxTest_DeleteSel, LboxTestFrame::OnUpdateUIDeleteSelButton)
EVT_LISTBOX(LboxTest_Listbox, LboxTestFrame::OnListbox)
- EVT_LISTBOX_DCLICK(-1, LboxTestFrame::OnListboxDClick)
- EVT_CHECKBOX(-1, LboxTestFrame::OnCheckOrRadioBox)
- EVT_RADIOBOX(-1, LboxTestFrame::OnCheckOrRadioBox)
+ EVT_LISTBOX_DCLICK(wxID_ANY, LboxTestFrame::OnListboxDClick)
+ EVT_CHECKBOX(wxID_ANY, LboxTestFrame::OnCheckOrRadioBox)
+ EVT_RADIOBOX(wxID_ANY, LboxTestFrame::OnCheckOrRadioBox)
// ----------------------------------------------------------------------------
LboxTestFrame::LboxTestFrame(const wxString& title)
// ----------------------------------------------------------------------------
LboxTestFrame::LboxTestFrame(const wxString& title)
- : wxFrame(NULL, -1, title, wxPoint(100, 100))
+ : wxFrame(NULL, wxID_ANY, title, wxPoint(100, 100))
- wxStaticBox *box = new wxStaticBox(panel, -1, _T("&Set listbox parameters"));
- m_radioSelMode = new wxRadioBox(panel, -1, _T("Selection &mode:"),
+ wxStaticBox *box = new wxStaticBox(panel, wxID_ANY, _T("&Set listbox parameters"));
+ m_radioSelMode = new wxRadioBox(panel, wxID_ANY, _T("Selection &mode:"),
- m_chkVScroll = new wxCheckBox(panel, -1, _T("Always show &vertical scrollbar"));
- m_chkHScroll = new wxCheckBox(panel, -1, _T("Show &horizontal scrollbar"));
- m_chkSort = new wxCheckBox(panel, -1, _T("&Sort items"));
+ m_chkVScroll = new wxCheckBox(panel, wxID_ANY, _T("Always show &vertical scrollbar"));
+ m_chkHScroll = new wxCheckBox(panel, wxID_ANY, _T("Show &horizontal scrollbar"));
+ m_chkSort = new wxCheckBox(panel, wxID_ANY, _T("&Sort items"));
sizerLeft->Add(sizerBtn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
// middle pane
sizerLeft->Add(sizerBtn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
// middle pane
wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
wxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL);
wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
wxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL);
sizerRow = new wxBoxSizer(wxHORIZONTAL);
btn = new wxButton(panel, LboxTest_Change, _T("C&hange current"));
sizerRow = new wxBoxSizer(wxHORIZONTAL);
btn = new wxButton(panel, LboxTest_Change, _T("C&hange current"));
sizerRow->Add(btn, 0, wxRIGHT, 5);
sizerRow->Add(m_textChange, 1, wxLEFT, 5);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = new wxBoxSizer(wxHORIZONTAL);
btn = new wxButton(panel, LboxTest_Delete, _T("&Delete this item"));
sizerRow->Add(btn, 0, wxRIGHT, 5);
sizerRow->Add(m_textChange, 1, wxLEFT, 5);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = new wxBoxSizer(wxHORIZONTAL);
btn = new wxButton(panel, LboxTest_Delete, _T("&Delete this item"));
sizerRow->Add(btn, 0, wxRIGHT, 5);
sizerRow->Add(m_textDelete, 1, wxLEFT, 5);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow->Add(btn, 0, wxRIGHT, 5);
sizerRow->Add(m_textDelete, 1, wxLEFT, 5);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerUp->Add(sizerRight, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
// the lower one only has the log listbox and a button to clear it
sizerUp->Add(sizerRight, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
// the lower one only has the log listbox and a button to clear it
- new wxStaticBox(panel, -1, _T("&Log window")),
+ new wxStaticBox(panel, wxID_ANY, _T("&Log window")),
sizerDown->Add(m_lboxLog, 1, wxGROW | wxALL, 5);
sizerDown->Add(m_lboxLog, 1, wxGROW | wxALL, 5);
btn = new wxButton(panel, LboxTest_ClearLog, _T("Clear &log"));
sizerBtns->Add(btn);
sizerBtns->Add(10, 0); // spacer
btn = new wxButton(panel, LboxTest_ClearLog, _T("Clear &log"));
sizerBtns->Add(btn);
sizerBtns->Add(10, 0); // spacer
btn = new wxButton(panel, LboxTest_Quit, _T("E&xit"));
sizerBtns->Add(btn);
sizerDown->Add(sizerBtns, 0, wxALL | wxALIGN_RIGHT, 5);
btn = new wxButton(panel, LboxTest_Quit, _T("E&xit"));
sizerBtns->Add(btn);
sizerDown->Add(sizerBtns, 0, wxALL | wxALIGN_RIGHT, 5);
// now that everything is created we can redirect the log messages to the
// listbox
m_logTarget = new LboxLogger(m_lboxLog, wxLog::GetActiveTarget());
wxLog::SetActiveTarget(m_logTarget);
// now that everything is created we can redirect the log messages to the
// listbox
m_logTarget = new LboxLogger(m_lboxLog, wxLog::GetActiveTarget());
wxLog::SetActiveTarget(m_logTarget);
- m_chkSort->SetValue(FALSE);
- m_chkHScroll->SetValue(TRUE);
- m_chkVScroll->SetValue(FALSE);
+ m_chkSort->SetValue(false);
+ m_chkHScroll->SetValue(true);
+ m_chkVScroll->SetValue(false);
- int count = m_lbox->GetCount();
- for ( int n = 0; n < count; n++ )
- {
- items.Add(m_lbox->GetString(n));
- }
-
- m_sizerLbox->Remove(m_lbox);
- delete m_lbox;
+ items.Add(m_lbox->GetString(n));
- m_lbox = new wxListBox(this, -1,
+ m_sizerLbox->Detach(m_lbox);
+ delete m_lbox;
+
+ m_lbox = new wxListBox(parent, LboxTest_Listbox,
m_sizerLbox->Add(m_lbox, 1, wxGROW | wxALL, 5);
m_sizerLbox->Layout();
m_sizerLbox->Add(m_lbox, 1, wxGROW | wxALL, 5);
m_sizerLbox->Layout();