// control ids
enum
{
- ComboPage_Reset = 100,
+ ComboPage_Reset = wxID_HIGHEST,
ComboPage_CurText,
ComboPage_InsertionPointText,
ComboPage_Insert,
virtual wxControl *GetWidget() const { return m_combobox; }
virtual void RecreateWidget() { CreateCombo(); }
+ // lazy creation of the content
+ virtual void CreateContent();
+
protected:
// event handlers
void OnButtonReset(wxCommandEvent& event);
// the checkboxes for styles
wxCheckBox *m_chkSort,
- *m_chkReadonly;
+ *m_chkReadonly,
+ *m_chkFilename;
// the combobox itself and the sizer it is in
wxComboBox *m_combobox;
// implementation
// ============================================================================
+#if defined(__WXUNIVERSAL__)
+ #define FAMILY_CTRLS UNIVERSAL_CTRLS
+#else
+ #define FAMILY_CTRLS NATIVE_CTRLS
+#endif
+
IMPLEMENT_WIDGETS_PAGE(ComboboxWidgetsPage, _T("Combobox"),
- (int)wxPlatform(GENERIC_CTRLS).If(wxMSW,NATIVE_CTRLS)
- | WITH_ITEMS_CTRLS | COMBO_CTRLS
+ FAMILY_CTRLS | WITH_ITEMS_CTRLS | COMBO_CTRLS
);
ComboboxWidgetsPage::ComboboxWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist)
- : WidgetsPage(book)
+ : WidgetsPage(book, imaglist, combobox_xpm)
{
// init everything
m_chkSort =
- m_chkReadonly = (wxCheckBox *)NULL;
+ m_chkReadonly =
+ m_chkFilename = (wxCheckBox *)NULL;
m_combobox = (wxComboBox *)NULL;
m_sizerCombo = (wxSizer *)NULL;
+}
- imaglist->Add(wxBitmap(combobox_xpm));
-
+void ComboboxWidgetsPage::CreateContent()
+{
/*
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
m_chkSort = CreateCheckBoxAndAddToSizer(sizerLeft, _T("&Sort items"));
m_chkReadonly = CreateCheckBoxAndAddToSizer(sizerLeft, _T("&Read only"));
+ m_chkFilename = CreateCheckBoxAndAddToSizer(sizerLeft, _T("&File name"));
+ m_chkFilename->Disable(); // not implemented yet
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
sizerLeft->Add(m_radioKind, 0, wxGROW | wxALL, 5);
wxDefaultPosition, wxDefaultSize,
0, NULL,
0);
- sizerRight->Add(m_combobox, 1, wxGROW | wxALL, 5);
+ sizerRight->Add(m_combobox, 0, wxGROW | wxALL, 5);
sizerRight->SetMinSize(150, 0);
m_sizerCombo = sizerRight; // save it to modify it later
{
m_chkSort->SetValue(false);
m_chkReadonly->SetValue(false);
+ m_chkFilename->SetValue(false);
}
void ComboboxWidgetsPage::CreateCombo()
0, NULL,
flags);
+#if 0
+ if ( m_chkFilename->GetValue() )
+ ;
+#endif // TODO
+
unsigned int count = items.GetCount();
for ( unsigned int n = 0; n < count; n++ )
{
void ComboboxWidgetsPage::OnButtonChange(wxCommandEvent& WXUNUSED(event))
{
int sel = m_combobox->GetSelection();
- if ( sel != -1 )
+ if ( sel != wxNOT_FOUND )
{
#ifndef __WXGTK__
m_combobox->SetString(sel, m_textChange->GetValue());
void ComboboxWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
{
- if (m_combobox)
- event.Enable( m_chkSort->GetValue() || m_chkReadonly->GetValue() );
+ event.Enable( m_chkSort->GetValue() ||
+ m_chkReadonly->GetValue() ||
+ m_chkFilename->GetValue() );
}
void ComboboxWidgetsPage::OnUpdateUIInsert(wxUpdateUIEvent& event)
void ComboboxWidgetsPage::OnUpdateUIDeleteSelButton(wxUpdateUIEvent& event)
{
if (m_combobox)
- event.Enable(m_combobox->GetSelection() != -1);
+ event.Enable(m_combobox->GetSelection() != wxNOT_FOUND);
}
void ComboboxWidgetsPage::OnUpdateUIClearButton(wxUpdateUIEvent& event)