#include "icons/listbox.xpm"
// ----------------------------------------------------------------------------
#include "icons/listbox.xpm"
// ----------------------------------------------------------------------------
- ListboxWidgetsPage(wxNotebook *notebook, wxImageList *imaglist);
+ ListboxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
+
+ virtual wxControl *GetWidget() const { return m_lbox; }
+ virtual void RecreateWidget() { CreateLbox(); }
+
+ // lazy creation of the content
+ virtual void CreateContent();
EVT_LISTBOX_DCLICK(ListboxPage_Listbox, ListboxWidgetsPage::OnListboxDClick)
EVT_CHECKLISTBOX(ListboxPage_Listbox, ListboxWidgetsPage::OnCheckListbox)
EVT_LISTBOX_DCLICK(ListboxPage_Listbox, ListboxWidgetsPage::OnListboxDClick)
EVT_CHECKLISTBOX(ListboxPage_Listbox, ListboxWidgetsPage::OnCheckListbox)
- EVT_CHECKBOX(-1, ListboxWidgetsPage::OnCheckOrRadioBox)
- EVT_RADIOBOX(-1, ListboxWidgetsPage::OnCheckOrRadioBox)
+ EVT_CHECKBOX(wxID_ANY, ListboxWidgetsPage::OnCheckOrRadioBox)
+ EVT_RADIOBOX(wxID_ANY, ListboxWidgetsPage::OnCheckOrRadioBox)
END_EVENT_TABLE()
// ============================================================================
// implementation
// ============================================================================
END_EVENT_TABLE()
// ============================================================================
// implementation
// ============================================================================
-IMPLEMENT_WIDGETS_PAGE(ListboxWidgetsPage, _T("Listbox"));
+#if defined(__WXUNIVERSAL__)
+ #define FAMILY_CTRLS UNIVERSAL_CTRLS
+#else
+ #define FAMILY_CTRLS NATIVE_CTRLS
+#endif
+
+IMPLEMENT_WIDGETS_PAGE(ListboxWidgetsPage, _T("Listbox"),
+ FAMILY_CTRLS | WITH_ITEMS_CTRLS
+ );
/*
What we create here is a frame having 3 panes: style pane is the
leftmost one, in the middle the pane with buttons allowing to perform
/*
What we create here is a frame having 3 panes: style pane is the
leftmost one, in the middle the pane with buttons allowing to perform
- wxStaticBox *box = new wxStaticBox(this, -1, _T("&Set listbox parameters"));
+ wxStaticBox *box = new wxStaticBox(this, wxID_ANY,
+ _T("&Set listbox parameters"));
wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL);
static const wxString modes[] =
wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL);
static const wxString modes[] =
- m_radioSelMode = new wxRadioBox(this, -1, _T("Selection &mode:"),
+ m_radioSelMode = new wxRadioBox(this, wxID_ANY, _T("Selection &mode:"),
);
m_chkCheck = CreateCheckBoxAndAddToSizer(sizerLeft, _T("&Check list box"));
m_chkSort = CreateCheckBoxAndAddToSizer(sizerLeft, _T("&Sort items"));
);
m_chkCheck = CreateCheckBoxAndAddToSizer(sizerLeft, _T("&Check list box"));
m_chkSort = CreateCheckBoxAndAddToSizer(sizerLeft, _T("&Sort items"));
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
sizerLeft->Add(m_radioSelMode, 0, wxGROW | wxALL, 5);
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
sizerLeft->Add(m_radioSelMode, 0, wxGROW | wxALL, 5);
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
// middle pane
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
// middle pane
- wxStaticBox *box2 = new wxStaticBox(this, -1, _T("&Change listbox contents"));
+ wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY,
+ _T("&Change listbox contents"));
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(this, ListboxPage_Change, _T("C&hange current"));
sizerRow = new wxBoxSizer(wxHORIZONTAL);
btn = new wxButton(this, ListboxPage_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(this, ListboxPage_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(this, ListboxPage_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);
- m_chkSort->SetValue(FALSE);
- m_chkCheck->SetValue(FALSE);
- m_chkHScroll->SetValue(TRUE);
- m_chkVScroll->SetValue(FALSE);
+ m_chkVScroll->SetValue(false);
+ m_chkHScroll->SetValue(true);
+ m_chkCheck->SetValue(false);
+ m_chkSort->SetValue(false);
+ m_chkOwnerDraw->SetValue(false);
- wxLogMessage(_T("Listbox item %ld selected"), sel);
+ if (event.IsSelection())
+ wxLogMessage(_T("Listbox item %ld selected"), sel);
+ else
+ wxLogMessage(_T("Listbox item %ld deselected"), sel);