From 7ff2dfbac2efa5ed3ac4bcc6ebc722edbb5c6813 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 21 Jan 2005 15:05:32 +0000 Subject: [PATCH] added possibility to use generic date control if configured git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31543 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/calendar/calendar.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/samples/calendar/calendar.cpp b/samples/calendar/calendar.cpp index 43056de2e3..737db45395 100644 --- a/samples/calendar/calendar.cpp +++ b/samples/calendar/calendar.cpp @@ -45,7 +45,13 @@ #include "wx/textctrl.h" #include "wx/calctrl.h" -#include "wx/datectrl.h" + +#if wxUSE_DATEPICKCTRL + #include "wx/datectrl.h" + #if wxUSE_DATEPICKCTRL_GENERIC + #include "wx/generic/datectrl.h" + #endif // wxUSE_DATEPICKCTRL_GENERIC +#endif // wxUSE_DATEPICKCTRL // ---------------------------------------------------------------------------- // private classes @@ -143,7 +149,7 @@ private: void OnDateChange(wxDateEvent& event); - wxDatePickerCtrl *m_datePicker; + wxDatePickerCtrlBase *m_datePicker; wxTextCtrl *m_text; @@ -175,6 +181,9 @@ enum Calendar_DatePicker_AskDate = 300, Calendar_DatePicker_ShowCentury, Calendar_DatePicker_DropDown, +#if wxUSE_DATEPICKCTRL_GENERIC + Calendar_DatePicker_Generic, +#endif // wxUSE_DATEPICKCTRL_GENERIC #endif // wxUSE_DATEPICKCTRL Calendar_CalCtrl = 1000 }; @@ -307,6 +316,10 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) _T("Al&ways show century")); menuDate->AppendCheckItem(Calendar_DatePicker_DropDown, _T("Use &drop down control")); +#if wxUSE_DATEPICKCTRL_GENERIC + menuDate->AppendCheckItem(Calendar_DatePicker_Generic, + _T("Use &generic version of the control")); +#endif // wxUSE_DATEPICKCTRL_GENERIC menuDate->AppendSeparator(); menuDate->Append(Calendar_DatePicker_AskDate, _T("&Choose date...\tCtrl-D"), _T("Show dialog with wxDatePickerCtrl")); #endif // wxUSE_DATEPICKCTRL @@ -577,6 +590,15 @@ MyDialog::MyDialog(wxWindow *parent, const wxDateTime& dt, int dtpStyle) ), wxSizerFlags().Border()); +#if wxUSE_DATEPICKCTRL_GENERIC + wxFrame *frame = (wxFrame *)wxGetTopLevelParent(parent); + if ( frame && frame->GetMenuBar()->IsChecked(Calendar_DatePicker_Generic) ) + m_datePicker = new wxDatePickerCtrlGeneric(this, -1, dt, + wxDefaultPosition, + wxDefaultSize, + dtpStyle); + else +#endif // wxUSE_DATEPICKCTRL_GENERIC m_datePicker = new wxDatePickerCtrl(this, -1, dt, wxDefaultPosition, wxDefaultSize, dtpStyle); -- 2.47.2