Continuation of 'widgets' sample improvements.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39265 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2006-05-22 10:39:40 +00:00
parent c8326d649c
commit f0fa4312b1
12 changed files with 162 additions and 74 deletions

View File

@@ -52,7 +52,7 @@
// control ids
enum
{
ButtonPage_Reset = 100,
ButtonPage_Reset = wxID_HIGHEST,
ButtonPage_ChangeLabel,
ButtonPage_Button
};
@@ -156,15 +156,8 @@ END_EVENT_TABLE()
#if defined(__WXUNIVERSAL__)
#define FAMILY_CTRLS UNIVERSAL_CTRLS
#elif defined(__WXMSW__) || \
defined(__WXMOTIF__) || \
defined(__WXGTK__) || \
defined(__WXMAC__) || \
defined(__WXPM__) || \
defined(__WXPALMOS__)
#define FAMILY_CTRLS NATIVE_CTRLS
#else
#define FAMILY_CTRLS GENERIC_CTRLS
#define FAMILY_CTRLS NATIVE_CTRLS
#endif
IMPLEMENT_WIDGETS_PAGE(ButtonWidgetsPage, _T("Button"), FAMILY_CTRLS );

View File

@@ -50,7 +50,7 @@
// control ids
enum
{
CheckboxPage_Reset = 100,
CheckboxPage_Reset = wxID_HIGHEST,
CheckboxPage_ChangeLabel,
CheckboxPage_Check,
CheckboxPage_Uncheck,
@@ -148,9 +148,13 @@ END_EVENT_TABLE()
// implementation
// ============================================================================
IMPLEMENT_WIDGETS_PAGE(CheckBoxWidgetsPage, wxT("CheckBox"),
(int)wxPlatform(GENERIC_CTRLS).If(wxMSW,NATIVE_CTRLS)
);
#if defined(__WXUNIVERSAL__)
#define FAMILY_CTRLS UNIVERSAL_CTRLS
#else
#define FAMILY_CTRLS NATIVE_CTRLS
#endif
IMPLEMENT_WIDGETS_PAGE(CheckBoxWidgetsPage, wxT("CheckBox"), FAMILY_CTRLS );
CheckBoxWidgetsPage::CheckBoxWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist)

View File

@@ -52,7 +52,7 @@
// control ids
enum
{
ComboPage_Reset = 100,
ComboPage_Reset = wxID_HIGHEST,
ComboPage_CurText,
ComboPage_InsertionPointText,
ComboPage_Insert,
@@ -192,9 +192,14 @@ END_EVENT_TABLE()
// 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,

View File

@@ -119,9 +119,14 @@ END_EVENT_TABLE()
// implementation
// ============================================================================
#if defined(__WXMSW__)
#define FAMILY_CTRLS NATIVE_CTRLS
#else
#define FAMILY_CTRLS GENERIC_CTRLS
#endif
IMPLEMENT_WIDGETS_PAGE(DatePickerWidgetsPage, wxT("DatePicker"),
(int)wxPlatform(GENERIC_CTRLS).If(wxMSW,NATIVE_CTRLS)
| PICKER_CTRLS
FAMILY_CTRLS | PICKER_CTRLS
);
DatePickerWidgetsPage::DatePickerWidgetsPage(WidgetsBookCtrl *book,

View File

@@ -52,7 +52,7 @@
// control ids
enum
{
GaugePage_Reset = 100,
GaugePage_Reset = wxID_HIGHEST,
GaugePage_Progress,
GaugePage_Clear,
GaugePage_SetValue,
@@ -157,9 +157,13 @@ END_EVENT_TABLE()
// implementation
// ============================================================================
IMPLEMENT_WIDGETS_PAGE(GaugeWidgetsPage, _T("Gauge"),
(int)wxPlatform(GENERIC_CTRLS).If(wxMSW,NATIVE_CTRLS)
);
#if defined(__WXUNIVERSAL__)
#define FAMILY_CTRLS UNIVERSAL_CTRLS
#else
#define FAMILY_CTRLS NATIVE_CTRLS
#endif
IMPLEMENT_WIDGETS_PAGE(GaugeWidgetsPage, _T("Gauge"), FAMILY_CTRLS );
GaugeWidgetsPage::GaugeWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist)

View File

@@ -55,7 +55,7 @@
// control ids
enum
{
ListboxPage_Reset = 100,
ListboxPage_Reset = wxID_HIGHEST,
ListboxPage_Add,
ListboxPage_AddText,
ListboxPage_AddSeveral,
@@ -193,9 +193,14 @@ END_EVENT_TABLE()
// implementation
// ============================================================================
#if defined(__WXUNIVERSAL__)
#define FAMILY_CTRLS UNIVERSAL_CTRLS
#else
#define FAMILY_CTRLS NATIVE_CTRLS
#endif
IMPLEMENT_WIDGETS_PAGE(ListboxWidgetsPage, _T("Listbox"),
(int)wxPlatform(GENERIC_CTRLS).If(wxMSW,NATIVE_CTRLS)
| WITH_ITEMS_CTRLS
FAMILY_CTRLS | WITH_ITEMS_CTRLS
);
ListboxWidgetsPage::ListboxWidgetsPage(WidgetsBookCtrl *book,

View File

@@ -93,11 +93,6 @@ public:
protected:
// event handlers
#ifdef ABX
void OnPageChanging(wxNotebookEvent& event);
void OnPageChanged(wxNotebookEvent& event);
#endif
void OnButtonReset(wxCommandEvent& event);
void OnButtonDeleteAll(wxCommandEvent& event);
void OnButtonSelectPage(wxCommandEvent& event);
@@ -181,11 +176,6 @@ BEGIN_EVENT_TABLE(BookWidgetsPage, WidgetsPage)
EVT_UPDATE_UI(BookPage_InsertPage, BookWidgetsPage::OnUpdateUIInsertButton)
EVT_UPDATE_UI(BookPage_RemovePage, BookWidgetsPage::OnUpdateUIRemoveButton)
#ifdef ABX
EVT_NOTEBOOK_PAGE_CHANGING(wxID_ANY, BookWidgetsPage::OnPageChanging)
EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, NotebookWidgetsPage::OnPageChanged)
#endif
EVT_CHECKBOX(wxID_ANY, BookWidgetsPage::OnCheckOrRadioBox)
EVT_RADIOBOX(wxID_ANY, BookWidgetsPage::OnCheckOrRadioBox)
END_EVENT_TABLE()
@@ -516,29 +506,6 @@ void BookWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
RecreateBook();
}
#ifdef ABX
void BookWidgetsPage::OnPageChanging(wxBookEvent& event)
{
wxLogMessage(_T("Notebook page changing from %d to %d (currently %d)."),
event.GetOldSelection(),
event.GetSelection(),
m_notebook->GetSelection());
event.Skip();
}
void NotebookWidgetsPage::OnPageChanged(wxNotebookEvent& event)
{
wxLogMessage(_T("Notebook page changed from %d to %d (currently %d)."),
event.GetOldSelection(),
event.GetSelection(),
m_notebook->GetSelection());
event.Skip();
}
#endif
#if wxUSE_NOTEBOOK
#include "icons/notebook.xpm"
@@ -561,6 +528,10 @@ public:
protected:
// event handlers
void OnPageChanging(wxNotebookEvent& event);
void OnPageChanged(wxNotebookEvent& event);
// (re)create book
virtual wxBookCtrlBase *CreateBook(long flags)
{
@@ -580,14 +551,42 @@ private:
// ----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(NotebookWidgetsPage, BookWidgetsPage)
EVT_NOTEBOOK_PAGE_CHANGING(wxID_ANY, NotebookWidgetsPage::OnPageChanging)
EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, NotebookWidgetsPage::OnPageChanged)
END_EVENT_TABLE()
#if defined(__WXUNIVERSAL__)
#define FAMILY_CTRLS UNIVERSAL_CTRLS
#elif defined(__WXMOTIF__)
#define FAMILY_CTRLS GENERIC_CTRLS
#else
#define FAMILY_CTRLS NATIVE_CTRLS
#endif
IMPLEMENT_WIDGETS_PAGE(NotebookWidgetsPage, _T("Notebook"),
(int)wxPlatform(GENERIC_CTRLS).If(wxMSW,NATIVE_CTRLS)
.ElseIf(wxGTK,NATIVE_CTRLS)
| BOOK_CTRLS
FAMILY_CTRLS | BOOK_CTRLS
);
void NotebookWidgetsPage::OnPageChanging(wxNotebookEvent& event)
{
wxLogMessage(_T("Notebook page changing from %d to %d (currently %d)."),
event.GetOldSelection(),
event.GetSelection(),
m_book->GetSelection());
event.Skip();
}
void NotebookWidgetsPage::OnPageChanged(wxNotebookEvent& event)
{
wxLogMessage(_T("Notebook page changed from %d to %d (currently %d)."),
event.GetOldSelection(),
event.GetSelection(),
m_book->GetSelection());
event.Skip();
}
#endif // wxUSE_NOTEBOOK
#if wxUSE_LISTBOOK
@@ -612,6 +611,10 @@ public:
protected:
// event handlers
void OnPageChanging(wxListbookEvent& event);
void OnPageChanged(wxListbookEvent& event);
// (re)create book
virtual wxBookCtrlBase *CreateBook(long flags)
{
@@ -631,12 +634,34 @@ private:
// ----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(ListbookWidgetsPage, BookWidgetsPage)
EVT_LISTBOOK_PAGE_CHANGING(wxID_ANY, ListbookWidgetsPage::OnPageChanging)
EVT_LISTBOOK_PAGE_CHANGED(wxID_ANY, ListbookWidgetsPage::OnPageChanged)
END_EVENT_TABLE()
IMPLEMENT_WIDGETS_PAGE(ListbookWidgetsPage, _T("Listbook"),
GENERIC_CTRLS | BOOK_CTRLS
);
void ListbookWidgetsPage::OnPageChanging(wxListbookEvent& event)
{
wxLogMessage(_T("Listbook page changing from %d to %d (currently %d)."),
event.GetOldSelection(),
event.GetSelection(),
m_book->GetSelection());
event.Skip();
}
void ListbookWidgetsPage::OnPageChanged(wxListbookEvent& event)
{
wxLogMessage(_T("Listbook page changed from %d to %d (currently %d)."),
event.GetOldSelection(),
event.GetSelection(),
m_book->GetSelection());
event.Skip();
}
#endif // wxUSE_LISTBOOK
#if wxUSE_CHOICEBOOK
@@ -661,6 +686,10 @@ public:
protected:
// event handlers
void OnPageChanging(wxChoicebookEvent& event);
void OnPageChanged(wxChoicebookEvent& event);
// (re)create book
virtual wxBookCtrlBase *CreateBook(long flags)
{
@@ -680,12 +709,34 @@ private:
// ----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(ChoicebookWidgetsPage, BookWidgetsPage)
EVT_CHOICEBOOK_PAGE_CHANGING(wxID_ANY, ChoicebookWidgetsPage::OnPageChanging)
EVT_CHOICEBOOK_PAGE_CHANGED(wxID_ANY, ChoicebookWidgetsPage::OnPageChanged)
END_EVENT_TABLE()
IMPLEMENT_WIDGETS_PAGE(ChoicebookWidgetsPage, _T("Choicebook"),
GENERIC_CTRLS | BOOK_CTRLS
);
void ChoicebookWidgetsPage::OnPageChanging(wxChoicebookEvent& event)
{
wxLogMessage(_T("Choicebook page changing from %d to %d (currently %d)."),
event.GetOldSelection(),
event.GetSelection(),
m_book->GetSelection());
event.Skip();
}
void ChoicebookWidgetsPage::OnPageChanged(wxChoicebookEvent& event)
{
wxLogMessage(_T("Choicebook page changed from %d to %d (currently %d)."),
event.GetOldSelection(),
event.GetSelection(),
m_book->GetSelection());
event.Skip();
}
#endif // wxUSE_CHOICEBOOK
#endif // wxUSE_BOOKCTRL

View File

@@ -51,7 +51,7 @@
// control ids
enum
{
RadioPage_Reset = 100,
RadioPage_Reset = wxID_HIGHEST,
RadioPage_Update,
RadioPage_Selection,
RadioPage_Label,
@@ -173,9 +173,14 @@ END_EVENT_TABLE()
// implementation
// ============================================================================
#if defined(__WXUNIVERSAL__)
#define FAMILY_CTRLS UNIVERSAL_CTRLS
#else
#define FAMILY_CTRLS NATIVE_CTRLS
#endif
IMPLEMENT_WIDGETS_PAGE(RadioWidgetsPage, _T("Radio"),
(int)wxPlatform(GENERIC_CTRLS).If(wxMSW,NATIVE_CTRLS)
| WITH_ITEMS_CTRLS
FAMILY_CTRLS | WITH_ITEMS_CTRLS
);
RadioWidgetsPage::RadioWidgetsPage(WidgetsBookCtrl *book,

View File

@@ -198,9 +198,13 @@ END_EVENT_TABLE()
// implementation
// ============================================================================
IMPLEMENT_WIDGETS_PAGE(SliderWidgetsPage, _T("Slider"),
(int)wxPlatform(GENERIC_CTRLS).If(wxMSW,NATIVE_CTRLS)
);
#if defined(__WXUNIVERSAL__)
#define FAMILY_CTRLS UNIVERSAL_CTRLS
#else
#define FAMILY_CTRLS NATIVE_CTRLS
#endif
IMPLEMENT_WIDGETS_PAGE(SliderWidgetsPage, _T("Slider"), FAMILY_CTRLS );
SliderWidgetsPage::SliderWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist)

View File

@@ -54,7 +54,7 @@
// control ids
enum
{
SpinBtnPage_Reset = 100,
SpinBtnPage_Reset = wxID_HIGHEST,
SpinBtnPage_Clear,
SpinBtnPage_SetValue,
SpinBtnPage_SetMinAndMax,
@@ -166,9 +166,14 @@ END_EVENT_TABLE()
// implementation
// ============================================================================
#if defined(__WXUNIVERSAL__)
#define FAMILY_CTRLS UNIVERSAL_CTRLS
#else
#define FAMILY_CTRLS NATIVE_CTRLS
#endif
IMPLEMENT_WIDGETS_PAGE(SpinBtnWidgetsPage, _T("Spin"),
(int)wxPlatform(GENERIC_CTRLS).If(wxMSW,NATIVE_CTRLS)
| EDITABLE_CTRLS
FAMILY_CTRLS | EDITABLE_CTRLS
);
SpinBtnWidgetsPage::SpinBtnWidgetsPage(WidgetsBookCtrl *book,

View File

@@ -51,7 +51,7 @@
// control ids
enum
{
StaticPage_Reset = 100,
StaticPage_Reset = wxID_HIGHEST,
StaticPage_BoxText,
StaticPage_LabelText
};

View File

@@ -53,7 +53,7 @@
// control ids
enum
{
TextPage_Reset = 100,
TextPage_Reset = wxID_HIGHEST,
TextPage_Set,
TextPage_Add,
@@ -329,9 +329,16 @@ END_EVENT_TABLE()
// implementation
// ============================================================================
#if defined(__WXX11__)
#define FAMILY_CTRLS NATIVE_CTRLS
#elif defined(__WXUNIVERSAL__)
#define FAMILY_CTRLS UNIVERSAL_CTRLS
#else
#define FAMILY_CTRLS NATIVE_CTRLS
#endif
IMPLEMENT_WIDGETS_PAGE(TextWidgetsPage, _T("Text"),
(int)wxPlatform(GENERIC_CTRLS).If(wxMSW,NATIVE_CTRLS)
| EDITABLE_CTRLS
FAMILY_CTRLS | EDITABLE_CTRLS
);
// ----------------------------------------------------------------------------