Use wxWindow instead of wxControl in the widgets sample.

Not all widgets are controls and we don't use any of wxControl-specific
methods in the sample, so don't require RecreateWidget() to return a wxControl
when a simple wxWindow suffices.

No real changes.
This commit is contained in:
Vadim Zeitlin
2015-07-31 17:53:55 +02:00
parent 2509e7927a
commit ce95913319
29 changed files with 30 additions and 30 deletions

View File

@@ -64,7 +64,7 @@ public:
m_sizerIndicator = NULL; m_sizerIndicator = NULL;
} }
virtual wxControl *GetWidget() const wxOVERRIDE { return m_indicator; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_indicator; }
virtual void RecreateWidget() wxOVERRIDE; virtual void RecreateWidget() wxOVERRIDE;
// lazy creation of the content // lazy creation of the content

View File

@@ -103,7 +103,7 @@ class BitmapComboBoxWidgetsPage : public ItemContainerWidgetsPage
public: public:
BitmapComboBoxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); BitmapComboBoxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual wxControl *GetWidget() const wxOVERRIDE { return m_combobox; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_combobox; }
virtual wxItemContainer* GetContainer() const wxOVERRIDE { return m_combobox; } virtual wxItemContainer* GetContainer() const wxOVERRIDE { return m_combobox; }
virtual void RecreateWidget() wxOVERRIDE { CreateCombo(); } virtual void RecreateWidget() wxOVERRIDE { CreateCombo(); }

View File

@@ -91,7 +91,7 @@ public:
ButtonWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); ButtonWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual ~ButtonWidgetsPage(){}; virtual ~ButtonWidgetsPage(){};
virtual wxControl *GetWidget() const wxOVERRIDE { return m_button; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_button; }
virtual void RecreateWidget() wxOVERRIDE { CreateButton(); } virtual void RecreateWidget() wxOVERRIDE { CreateButton(); }
// lazy creation of the content // lazy creation of the content

View File

@@ -75,7 +75,7 @@ public:
CheckBoxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); CheckBoxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual ~CheckBoxWidgetsPage(){}; virtual ~CheckBoxWidgetsPage(){};
virtual wxControl *GetWidget() const wxOVERRIDE { return m_checkbox; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_checkbox; }
virtual void RecreateWidget() wxOVERRIDE { CreateCheckbox(); } virtual void RecreateWidget() wxOVERRIDE { CreateCheckbox(); }
// lazy creation of the content // lazy creation of the content

View File

@@ -77,7 +77,7 @@ class ChoiceWidgetsPage : public ItemContainerWidgetsPage
public: public:
ChoiceWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); ChoiceWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual wxControl *GetWidget() const wxOVERRIDE { return m_choice; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_choice; }
virtual wxItemContainer* GetContainer() const wxOVERRIDE { return m_choice; } virtual wxItemContainer* GetContainer() const wxOVERRIDE { return m_choice; }
virtual void RecreateWidget() wxOVERRIDE { CreateChoice(); } virtual void RecreateWidget() wxOVERRIDE { CreateChoice(); }

View File

@@ -65,7 +65,7 @@ public:
ColourPickerWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); ColourPickerWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual ~ColourPickerWidgetsPage(){}; virtual ~ColourPickerWidgetsPage(){};
virtual wxControl *GetWidget() const wxOVERRIDE { return m_clrPicker; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_clrPicker; }
virtual void RecreateWidget() wxOVERRIDE { RecreatePicker(); } virtual void RecreateWidget() wxOVERRIDE { RecreatePicker(); }
// lazy creation of the content // lazy creation of the content

View File

@@ -94,7 +94,7 @@ class ComboboxWidgetsPage : public ItemContainerWidgetsPage
public: public:
ComboboxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); ComboboxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual wxControl *GetWidget() const wxOVERRIDE { return m_combobox; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_combobox; }
virtual wxTextEntryBase *GetTextEntry() const wxOVERRIDE { return m_combobox; } virtual wxTextEntryBase *GetTextEntry() const wxOVERRIDE { return m_combobox; }
virtual wxItemContainer* GetContainer() const wxOVERRIDE { return m_combobox; } virtual wxItemContainer* GetContainer() const wxOVERRIDE { return m_combobox; }
virtual void RecreateWidget() wxOVERRIDE { CreateCombo(); } virtual void RecreateWidget() wxOVERRIDE { CreateCombo(); }

View File

@@ -70,7 +70,7 @@ public:
DatePickerWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); DatePickerWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual ~DatePickerWidgetsPage(){}; virtual ~DatePickerWidgetsPage(){};
virtual wxControl *GetWidget() const wxOVERRIDE { return m_datePicker; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_datePicker; }
virtual void RecreateWidget() wxOVERRIDE { CreateDatePicker(); } virtual void RecreateWidget() wxOVERRIDE { CreateDatePicker(); }
// lazy creation of the content // lazy creation of the content

View File

@@ -98,7 +98,7 @@ public:
DirCtrlWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); DirCtrlWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual ~DirCtrlWidgetsPage() {} virtual ~DirCtrlWidgetsPage() {}
virtual wxControl *GetWidget() const wxOVERRIDE { return m_dirCtrl; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_dirCtrl; }
virtual void RecreateWidget() wxOVERRIDE { CreateDirCtrl(); } virtual void RecreateWidget() wxOVERRIDE { CreateDirCtrl(); }
// lazy creation of the content // lazy creation of the content

View File

@@ -67,7 +67,7 @@ public:
DirPickerWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); DirPickerWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual ~DirPickerWidgetsPage(){}; virtual ~DirPickerWidgetsPage(){};
virtual wxControl *GetWidget() const wxOVERRIDE { return m_dirPicker; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_dirPicker; }
virtual void RecreateWidget() wxOVERRIDE { RecreatePicker(); } virtual void RecreateWidget() wxOVERRIDE { RecreatePicker(); }
// lazy creation of the content // lazy creation of the content

View File

@@ -69,7 +69,7 @@ class EditableListboxWidgetsPage : public WidgetsPage
public: public:
EditableListboxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); EditableListboxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual wxControl *GetWidget() const wxOVERRIDE { return m_lbox->GetListCtrl(); } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_lbox->GetListCtrl(); }
virtual void RecreateWidget() wxOVERRIDE { CreateLbox(); } virtual void RecreateWidget() wxOVERRIDE { CreateLbox(); }
// lazy creation of the content // lazy creation of the content

View File

@@ -70,7 +70,7 @@ public:
FileCtrlWidgetsPage( WidgetsBookCtrl *book, wxImageList *imaglist ); FileCtrlWidgetsPage( WidgetsBookCtrl *book, wxImageList *imaglist );
virtual ~FileCtrlWidgetsPage() {} virtual ~FileCtrlWidgetsPage() {}
virtual wxControl *GetWidget() const wxOVERRIDE { return m_fileCtrl; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_fileCtrl; }
virtual void RecreateWidget() wxOVERRIDE { CreateFileCtrl(); } virtual void RecreateWidget() wxOVERRIDE { CreateFileCtrl(); }
// lazy creation of the content // lazy creation of the content

View File

@@ -74,7 +74,7 @@ public:
FilePickerWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); FilePickerWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual ~FilePickerWidgetsPage(){}; virtual ~FilePickerWidgetsPage(){};
virtual wxControl *GetWidget() const wxOVERRIDE { return m_filePicker; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_filePicker; }
virtual void RecreateWidget() wxOVERRIDE { RecreatePicker(); } virtual void RecreateWidget() wxOVERRIDE { RecreatePicker(); }
// lazy creation of the content // lazy creation of the content

View File

@@ -65,7 +65,7 @@ public:
FontPickerWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); FontPickerWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual ~FontPickerWidgetsPage(){}; virtual ~FontPickerWidgetsPage(){};
virtual wxControl *GetWidget() const wxOVERRIDE { return m_fontPicker; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_fontPicker; }
virtual void RecreateWidget() wxOVERRIDE { RecreatePicker(); } virtual void RecreateWidget() wxOVERRIDE { RecreatePicker(); }
// lazy creation of the content // lazy creation of the content

View File

@@ -75,7 +75,7 @@ public:
GaugeWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); GaugeWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual ~GaugeWidgetsPage(); virtual ~GaugeWidgetsPage();
virtual wxControl *GetWidget() const wxOVERRIDE { return m_gauge; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_gauge; }
virtual void RecreateWidget() wxOVERRIDE { CreateGauge(); } virtual void RecreateWidget() wxOVERRIDE { CreateGauge(); }
// lazy creation of the content // lazy creation of the content

View File

@@ -79,7 +79,7 @@ public:
HyperlinkWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); HyperlinkWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual ~HyperlinkWidgetsPage() {} virtual ~HyperlinkWidgetsPage() {}
virtual wxControl *GetWidget() const wxOVERRIDE { return m_hyperlink; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_hyperlink; }
virtual void RecreateWidget() wxOVERRIDE { CreateHyperlink(); } virtual void RecreateWidget() wxOVERRIDE { CreateHyperlink(); }
// lazy creation of the content // lazy creation of the content

View File

@@ -81,7 +81,7 @@ class ListboxWidgetsPage : public ItemContainerWidgetsPage
public: public:
ListboxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); ListboxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual wxControl *GetWidget() const wxOVERRIDE { return m_lbox; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_lbox; }
virtual wxItemContainer* GetContainer() const wxOVERRIDE { return m_lbox; } virtual wxItemContainer* GetContainer() const wxOVERRIDE { return m_lbox; }
virtual void RecreateWidget() wxOVERRIDE { CreateLbox(); } virtual void RecreateWidget() wxOVERRIDE { CreateLbox(); }

View File

@@ -88,7 +88,7 @@ public:
BookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist, const char *const icon[]); BookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist, const char *const icon[]);
virtual ~BookWidgetsPage(); virtual ~BookWidgetsPage();
virtual wxControl *GetWidget() const wxOVERRIDE { return m_book; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_book; }
virtual void RecreateWidget() wxOVERRIDE { RecreateBook(); } virtual void RecreateWidget() wxOVERRIDE { RecreateBook(); }
// lazy creation of the content // lazy creation of the content

View File

@@ -90,7 +90,7 @@ class ODComboboxWidgetsPage : public ItemContainerWidgetsPage
public: public:
ODComboboxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); ODComboboxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual wxControl *GetWidget() const wxOVERRIDE { return m_combobox; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_combobox; }
virtual wxTextEntryBase *GetTextEntry() const wxOVERRIDE virtual wxTextEntryBase *GetTextEntry() const wxOVERRIDE
{ return m_combobox ? m_combobox->GetTextCtrl() : NULL; } { return m_combobox ? m_combobox->GetTextCtrl() : NULL; }
virtual wxItemContainer* GetContainer() const wxOVERRIDE { return m_combobox; } virtual wxItemContainer* GetContainer() const wxOVERRIDE { return m_combobox; }

View File

@@ -85,7 +85,7 @@ public:
RadioWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); RadioWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual ~RadioWidgetsPage(){}; virtual ~RadioWidgetsPage(){};
virtual wxControl *GetWidget() const wxOVERRIDE { return m_radio; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_radio; }
virtual void RecreateWidget() wxOVERRIDE { CreateRadio(); } virtual void RecreateWidget() wxOVERRIDE { CreateRadio(); }
// lazy creation of the content // lazy creation of the content

View File

@@ -70,7 +70,7 @@ public:
SearchCtrlWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); SearchCtrlWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual ~SearchCtrlWidgetsPage(){}; virtual ~SearchCtrlWidgetsPage(){};
virtual wxControl *GetWidget() const wxOVERRIDE { return m_srchCtrl; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_srchCtrl; }
virtual wxTextEntryBase *GetTextEntry() const wxOVERRIDE { return m_srchCtrl; } virtual wxTextEntryBase *GetTextEntry() const wxOVERRIDE { return m_srchCtrl; }
virtual void RecreateWidget() wxOVERRIDE; virtual void RecreateWidget() wxOVERRIDE;

View File

@@ -96,7 +96,7 @@ public:
SliderWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); SliderWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual ~SliderWidgetsPage(){}; virtual ~SliderWidgetsPage(){};
virtual wxControl *GetWidget() const wxOVERRIDE { return m_slider; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_slider; }
virtual void RecreateWidget() wxOVERRIDE { CreateSlider(); } virtual void RecreateWidget() wxOVERRIDE { CreateSlider(); }
// lazy creation of the content // lazy creation of the content

View File

@@ -86,7 +86,7 @@ public:
SpinBtnWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); SpinBtnWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual ~SpinBtnWidgetsPage(){}; virtual ~SpinBtnWidgetsPage(){};
virtual wxControl *GetWidget() const wxOVERRIDE { return m_spinbtn; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_spinbtn; }
virtual Widgets GetWidgets() const wxOVERRIDE virtual Widgets GetWidgets() const wxOVERRIDE
{ {
Widgets widgets(WidgetsPage::GetWidgets()); Widgets widgets(WidgetsPage::GetWidgets());

View File

@@ -52,7 +52,7 @@ public:
: WidgetsPage(book, imaglist, statbmp_xpm) {} : WidgetsPage(book, imaglist, statbmp_xpm) {}
virtual void CreateContent() wxOVERRIDE; virtual void CreateContent() wxOVERRIDE;
virtual wxControl *GetWidget() const wxOVERRIDE { return m_statbmp; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_statbmp; }
virtual void RecreateWidget() wxOVERRIDE; virtual void RecreateWidget() wxOVERRIDE;
private: private:

View File

@@ -93,7 +93,7 @@ public:
StaticWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); StaticWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual ~StaticWidgetsPage(){}; virtual ~StaticWidgetsPage(){};
virtual wxControl *GetWidget() const wxOVERRIDE { return m_statText; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_statText; }
virtual Widgets GetWidgets() const wxOVERRIDE virtual Widgets GetWidgets() const wxOVERRIDE
{ {
Widgets widgets; Widgets widgets;

View File

@@ -138,7 +138,7 @@ public:
TextWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); TextWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual ~TextWidgetsPage(){}; virtual ~TextWidgetsPage(){};
virtual wxControl *GetWidget() const wxOVERRIDE { return m_text; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_text; }
virtual wxTextEntryBase *GetTextEntry() const wxOVERRIDE { return m_text; } virtual wxTextEntryBase *GetTextEntry() const wxOVERRIDE { return m_text; }
virtual void RecreateWidget() wxOVERRIDE { CreateText(); } virtual void RecreateWidget() wxOVERRIDE { CreateText(); }

View File

@@ -66,7 +66,7 @@ public:
TimePickerWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); TimePickerWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual ~TimePickerWidgetsPage(){}; virtual ~TimePickerWidgetsPage(){};
virtual wxControl *GetWidget() const wxOVERRIDE { return m_timePicker; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_timePicker; }
virtual void RecreateWidget() wxOVERRIDE { CreateTimePicker(); } virtual void RecreateWidget() wxOVERRIDE { CreateTimePicker(); }
// lazy creation of the content // lazy creation of the content

View File

@@ -89,7 +89,7 @@ public:
ToggleWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); ToggleWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual ~ToggleWidgetsPage(){}; virtual ~ToggleWidgetsPage(){};
virtual wxControl *GetWidget() const wxOVERRIDE { return m_toggle; } virtual wxWindow *GetWidget() const wxOVERRIDE { return m_toggle; }
virtual void RecreateWidget() wxOVERRIDE { CreateToggle(); } virtual void RecreateWidget() wxOVERRIDE { CreateToggle(); }
// lazy creation of the content // lazy creation of the content

View File

@@ -83,7 +83,7 @@ enum
ALL_CTRLS = 1 << ALL_PAGE ALL_CTRLS = 1 << ALL_PAGE
}; };
typedef wxVector<wxControl *> Widgets; typedef wxVector<wxWindow *> Widgets;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// WidgetsPage: a book page demonstrating some widget // WidgetsPage: a book page demonstrating some widget
@@ -131,7 +131,7 @@ public:
const char *const icon[]); const char *const icon[]);
// return the control shown by this page // return the control shown by this page
virtual wxControl *GetWidget() const = 0; virtual wxWindow *GetWidget() const = 0;
// return the control shown by this page, if it supports text entry interface // return the control shown by this page, if it supports text entry interface
virtual wxTextEntryBase *GetTextEntry() const { return NULL; } virtual wxTextEntryBase *GetTextEntry() const { return NULL; }