1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: implements wxDatePickerCtrl
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_DATECTRL_H_
13 #define _WX_DATECTRL_H_
17 #if wxUSE_DATEPICKCTRL
19 #include "wx/control.h" // the base class
20 #include "wx/datetime.h"
22 #define wxDatePickerCtrlNameStr _T("datectrl")
24 // wxDatePickerCtrl styles
27 // default style on this platform, either wxDP_SPIN or wxDP_DROPDOWN
30 // a spin control-like date picker (not supported in generic version)
33 // a combobox-like date picker (not supported in mac version)
36 // always show century in the default date display (otherwise it depends on
37 // the system date format which may include the century or not)
40 // allow not having any valid date in the control (by default it always has
41 // some date, today initially if no valid date specified in ctor)
45 // ----------------------------------------------------------------------------
46 // wxDatePickerCtrl: allow the user to enter the date
47 // ----------------------------------------------------------------------------
49 class WXDLLIMPEXP_ADV wxDatePickerCtrlBase
: public wxControl
53 The derived classes should implement ctor and Create() method with the
56 bool Create(wxWindow *parent,
58 const wxDateTime& dt = wxDefaultDateTime,
59 const wxPoint& pos = wxDefaultPosition,
60 const wxSize& size = wxDefaultSize,
61 long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
62 const wxValidator& validator = wxDefaultValidator,
63 const wxString& name = wxDatePickerCtrlNameStr);
67 virtual void SetValue(const wxDateTime
& dt
) = 0;
68 virtual wxDateTime
GetValue() const = 0;
70 // set/get the allowed valid range for the dates, if either/both of them
71 // are invalid, there is no corresponding limit and if neither is set
72 // GetRange() returns false
73 virtual void SetRange(const wxDateTime
& dt1
, const wxDateTime
& dt2
) = 0;
74 virtual bool GetRange(wxDateTime
*dt1
, wxDateTime
*dt2
) const = 0;
77 #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
78 #include "wx/msw/datectrl.h"
80 #define wxHAS_NATIVE_DATEPICKCTRL
82 #include "wx/generic/datectrl.h"
84 class WXDLLIMPEXP_ADV wxDatePickerCtrl
: public wxDatePickerCtrlGeneric
87 wxDatePickerCtrl() { }
88 wxDatePickerCtrl(wxWindow
*parent
,
90 const wxDateTime
& date
= wxDefaultDateTime
,
91 const wxPoint
& pos
= wxDefaultPosition
,
92 const wxSize
& size
= wxDefaultSize
,
93 long style
= wxDP_DEFAULT
| wxDP_SHOWCENTURY
,
94 const wxValidator
& validator
= wxDefaultValidator
,
95 const wxString
& name
= wxDatePickerCtrlNameStr
)
96 : wxDatePickerCtrlGeneric(parent
, id
, date
, pos
, size
, style
, validator
, name
)
101 DECLARE_DYNAMIC_CLASS(wxDatePickerCtrl
)
102 DECLARE_NO_COPY_CLASS(wxDatePickerCtrl
)
106 #endif // wxUSE_DATEPICKCTRL
108 #endif // _WX_DATECTRL_H_