// for all others, include the necessary headers
#ifndef WX_PRECOMP
+ #include "wx/wx.h"
#include "wx/app.h"
#include "wx/frame.h"
#include "wx/dcclient.h"
// the log target we use to redirect messages to the listbox
wxLog *m_logTarget;
- // any class wishing to process wxWindows events must use this macro
+ // any class wishing to process wxWidgets events must use this macro
DECLARE_EVENT_TABLE()
};
}
}
- virtual void DoLogString(const wxChar *szString, time_t t)
+ virtual void DoLogString(const wxChar *szString, time_t WXUNUSED(t))
{
wxString msg;
TimeStamp(&msg);
IMPLEMENT_APP(LboxTestApp)
-#ifdef __WXUNIVERSAL__
- WX_USE_THEME(win32);
- WX_USE_THEME(gtk);
-#endif // __WXUNIVERSAL__
-
// ----------------------------------------------------------------------------
// event tables
// ----------------------------------------------------------------------------
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)
END_EVENT_TABLE()
// ============================================================================
//wxLog::AddTraceMask(_T("listbox"));
wxLog::AddTraceMask(_T("scrollbar"));
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
LboxTestFrame::LboxTestFrame(const wxString& title)
- : wxFrame(NULL, -1, title, wxPoint(100, 100))
+ : wxFrame(NULL, wxID_ANY, title, wxPoint(100, 100))
{
// init everything
- m_dirty = FALSE;
+ m_dirty = false;
m_radioSelMode = (wxRadioBox *)NULL;
m_chkVScroll =
m_logTarget = (wxLog *)NULL;
- wxPanel *panel = new wxPanel(this, -1);
+ wxPanel *panel = new wxPanel(this, wxID_ANY);
/*
What we create here is a frame having 3 panes: the explanatory pane to
_T("multiple"),
};
- 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:"),
wxDefaultPosition, wxDefaultSize,
WXSIZEOF(modes), modes,
1, wxRA_SPECIFY_COLS);
- 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 = new wxStaticBoxSizer(box, wxVERTICAL);
sizerLeft->Add(sizerBtn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
// middle pane
- wxStaticBox *box2 = new wxStaticBox(panel, -1, _T("&Change listbox contents"));
+ wxStaticBox *box2 = new wxStaticBox(panel, wxID_ANY, _T("&Change listbox contents"));
wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
wxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL);
// the lower one only has the log listbox and a button to clear it
wxSizer *sizerDown = new wxStaticBoxSizer
(
- new wxStaticBox(panel, -1, _T("&Log window")),
+ new wxStaticBox(panel, wxID_ANY, _T("&Log window")),
wxVERTICAL
);
- m_lboxLog = new wxListBox(panel, -1);
+ m_lboxLog = new wxListBox(panel, wxID_ANY);
sizerDown->Add(m_lboxLog, 1, wxGROW | wxALL, 5);
wxBoxSizer *sizerBtns = new wxBoxSizer(wxHORIZONTAL);
btn = new wxButton(panel, LboxTest_ClearLog, _T("Clear &log"));
// final initialization
Reset();
- m_dirty = FALSE;
+ m_dirty = false;
- panel->SetAutoLayout(TRUE);
+ panel->SetAutoLayout(true);
panel->SetSizer(sizerTop);
sizerTop->Fit(this);
}
m_radioSelMode->SetSelection(LboxSel_Single);
- m_chkSort->SetValue(FALSE);
- m_chkHScroll->SetValue(TRUE);
- m_chkVScroll->SetValue(FALSE);
+ m_chkSort->SetValue(false);
+ m_chkHScroll->SetValue(true);
+ m_chkVScroll->SetValue(false);
- m_dirty = TRUE;
+ m_dirty = true;
}
void LboxTestFrame::CreateLbox()
items.Add(m_lbox->GetString(n));
}
- m_sizerLbox->Remove(m_lbox);
+ m_sizerLbox->Detach(m_lbox);
delete m_lbox;
}
- m_lbox = new wxListBox(this, -1,
+ m_lbox = new wxListBox(this, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
0, NULL,
flags);
m_sizerLbox->Add(m_lbox, 1, wxGROW | wxALL, 5);
m_sizerLbox->Layout();
- m_dirty = FALSE;
+ m_dirty = false;
}
// ----------------------------------------------------------------------------
}
}
-void LboxTestFrame::OnButtonClear(wxCommandEvent& event)
+void LboxTestFrame::OnButtonClear(wxCommandEvent& WXUNUSED(event))
{
m_lbox->Clear();
}
-void LboxTestFrame::OnButtonClearLog(wxCommandEvent& event)
+void LboxTestFrame::OnButtonClearLog(wxCommandEvent& WXUNUSED(event))
{
m_lboxLog->Clear();
}
-void LboxTestFrame::OnButtonAdd(wxCommandEvent& event)
+void LboxTestFrame::OnButtonAdd(wxCommandEvent& WXUNUSED(event))
{
static size_t s_item = 0;
}
}
-void LboxTestFrame::OnButtonAddSeveral(wxCommandEvent& event)
+void LboxTestFrame::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event))
{
wxArrayString items;
items.Add(_T("First"));
void LboxTestFrame::OnListbox(wxCommandEvent& event)
{
int sel = event.GetInt();
- m_textDelete->SetValue(wxString::Format(_T("%ld"), sel));
+ m_textDelete->SetValue(wxString::Format(_T("%d"), sel));
wxLogMessage(_T("Listbox item %d selected"), sel);
}
void LboxTestFrame::OnListboxDClick(wxCommandEvent& event)
{
- wxLogMessage(_T("Listbox item %d double clicked"), event.GetInt());
+ int sel = event.GetInt();
+ wxLogMessage(_T("Listbox item %d double clicked"), sel);
}
-void LboxTestFrame::OnCheckOrRadioBox(wxCommandEvent& event)
+void LboxTestFrame::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
{
- m_dirty = TRUE;
+ m_dirty = true;
}