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
This commit is contained in:
Vadim Zeitlin
2005-01-21 15:05:32 +00:00
parent 08c8690cf0
commit 7ff2dfbac2

View File

@@ -45,7 +45,13 @@
#include "wx/textctrl.h" #include "wx/textctrl.h"
#include "wx/calctrl.h" #include "wx/calctrl.h"
#if wxUSE_DATEPICKCTRL
#include "wx/datectrl.h" #include "wx/datectrl.h"
#if wxUSE_DATEPICKCTRL_GENERIC
#include "wx/generic/datectrl.h"
#endif // wxUSE_DATEPICKCTRL_GENERIC
#endif // wxUSE_DATEPICKCTRL
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// private classes // private classes
@@ -143,7 +149,7 @@ private:
void OnDateChange(wxDateEvent& event); void OnDateChange(wxDateEvent& event);
wxDatePickerCtrl *m_datePicker; wxDatePickerCtrlBase *m_datePicker;
wxTextCtrl *m_text; wxTextCtrl *m_text;
@@ -175,6 +181,9 @@ enum
Calendar_DatePicker_AskDate = 300, Calendar_DatePicker_AskDate = 300,
Calendar_DatePicker_ShowCentury, Calendar_DatePicker_ShowCentury,
Calendar_DatePicker_DropDown, Calendar_DatePicker_DropDown,
#if wxUSE_DATEPICKCTRL_GENERIC
Calendar_DatePicker_Generic,
#endif // wxUSE_DATEPICKCTRL_GENERIC
#endif // wxUSE_DATEPICKCTRL #endif // wxUSE_DATEPICKCTRL
Calendar_CalCtrl = 1000 Calendar_CalCtrl = 1000
}; };
@@ -307,6 +316,10 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
_T("Al&ways show century")); _T("Al&ways show century"));
menuDate->AppendCheckItem(Calendar_DatePicker_DropDown, menuDate->AppendCheckItem(Calendar_DatePicker_DropDown,
_T("Use &drop down control")); _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->AppendSeparator();
menuDate->Append(Calendar_DatePicker_AskDate, _T("&Choose date...\tCtrl-D"), _T("Show dialog with wxDatePickerCtrl")); menuDate->Append(Calendar_DatePicker_AskDate, _T("&Choose date...\tCtrl-D"), _T("Show dialog with wxDatePickerCtrl"));
#endif // wxUSE_DATEPICKCTRL #endif // wxUSE_DATEPICKCTRL
@@ -577,6 +590,15 @@ MyDialog::MyDialog(wxWindow *parent, const wxDateTime& dt, int dtpStyle)
), ),
wxSizerFlags().Border()); 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, m_datePicker = new wxDatePickerCtrl(this, -1, dt,
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
dtpStyle); dtpStyle);