LboxTest_Delete,
LboxTest_DeleteText,
LboxTest_DeleteSel,
+ LboxTest_DeselectAll,
LboxTest_Listbox,
LboxTest_Quit
};
void OnButtonChange(wxCommandEvent& event);
void OnButtonDelete(wxCommandEvent& event);
void OnButtonDeleteSel(wxCommandEvent& event);
+ void OnButtonDeselectAll(wxCommandEvent& event);
void OnButtonClear(wxCommandEvent& event);
+
#if wxUSE_LOG
void OnButtonClearLog(wxCommandEvent& event);
#endif // wxUSE_LOG
void OnUpdateUIClearButton(wxUpdateUIEvent& event);
void OnUpdateUIDeleteButton(wxUpdateUIEvent& event);
void OnUpdateUIDeleteSelButton(wxUpdateUIEvent& event);
+ void OnUpdateUIDeselectAllButton(wxUpdateUIEvent& event);
// reset the listbox parameters
void Reset();
EVT_BUTTON(LboxTest_Change, LboxTestFrame::OnButtonChange)
EVT_BUTTON(LboxTest_Delete, LboxTestFrame::OnButtonDelete)
EVT_BUTTON(LboxTest_DeleteSel, LboxTestFrame::OnButtonDeleteSel)
+ EVT_BUTTON(LboxTest_DeselectAll, LboxTestFrame::OnButtonDeselectAll)
EVT_BUTTON(LboxTest_Clear, LboxTestFrame::OnButtonClear)
#if wxUSE_LOG
EVT_BUTTON(LboxTest_ClearLog, LboxTestFrame::OnButtonClearLog)
EVT_UPDATE_UI(LboxTest_Change, LboxTestFrame::OnUpdateUIDeleteSelButton)
EVT_UPDATE_UI(LboxTest_ChangeText, LboxTestFrame::OnUpdateUIDeleteSelButton)
EVT_UPDATE_UI(LboxTest_DeleteSel, LboxTestFrame::OnUpdateUIDeleteSelButton)
+ EVT_UPDATE_UI(LboxTest_DeselectAll, LboxTestFrame::OnUpdateUIDeselectAllButton)
EVT_LISTBOX(LboxTest_Listbox, LboxTestFrame::OnListbox)
EVT_LISTBOX_DCLICK(wxID_ANY, LboxTestFrame::OnListboxDClick)
btn = new wxButton(m_panel, LboxTest_DeleteSel, _T("Delete &selection"));
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
+ btn = new wxButton(m_panel, LboxTest_DeselectAll, _T("Deselect All"));
+ sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
+
btn = new wxButton(m_panel, LboxTest_Clear, _T("&Clear"));
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
m_logTarget = new LboxLogger(m_lboxLog, wxLog::GetActiveTarget());
wxLog::SetActiveTarget(m_logTarget);
#endif // wxUSE_LOG
-
- m_lbox->Connect(wxEVT_RIGHT_DOWN,
- wxMouseEventHandler(LboxTestFrame::OnListboxRDown), NULL, this);
}
LboxTestFrame::~LboxTestFrame()
}
}
+void LboxTestFrame::OnButtonDeselectAll(wxCommandEvent& WXUNUSED(event))
+{
+ m_lbox->SetSelection(-1);
+}
+
void LboxTestFrame::OnButtonClear(wxCommandEvent& WXUNUSED(event))
{
m_lbox->Clear();
void LboxTestFrame::OnButtonAdd(wxCommandEvent& WXUNUSED(event))
{
- static size_t s_item = 0;
+ static unsigned s_item = 0;
wxString s = m_textAdd->GetValue();
if ( !m_textAdd->IsModified() )
void LboxTestFrame::OnButtonAddMany(wxCommandEvent& WXUNUSED(event))
{
// "many" means 1000 here
- for ( size_t n = 0; n < 1000; n++ )
+ for ( unsigned n = 0; n < 1000; n++ )
{
m_lbox->Append(wxString::Format(_T("item #%u"), n));
}
event.Enable(m_lbox->GetSelections(selections) != 0);
}
+void LboxTestFrame::OnUpdateUIDeselectAllButton(wxUpdateUIEvent& event)
+{
+ wxArrayInt selections;
+ event.Enable(m_lbox->GetSelections(selections) != 0);
+}
+
void LboxTestFrame::OnUpdateUIClearButton(wxUpdateUIEvent& event)
{
event.Enable(m_lbox->GetCount() != 0);