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/datetimectrl.h" // the base class
21 #define wxDatePickerCtrlNameStr wxT("datectrl")
23 // wxDatePickerCtrl styles
26 // default style on this platform, either wxDP_SPIN or wxDP_DROPDOWN
29 // a spin control-like date picker (not supported in generic version)
32 // a combobox-like date picker (not supported in mac version)
35 // always show century in the default date display (otherwise it depends on
36 // the system date format which may include the century or not)
39 // allow not having any valid date in the control (by default it always has
40 // some date, today initially if no valid date specified in ctor)
44 // ----------------------------------------------------------------------------
45 // wxDatePickerCtrl: allow the user to enter the date
46 // ----------------------------------------------------------------------------
48 class WXDLLIMPEXP_ADV wxDatePickerCtrlBase
: public wxDateTimePickerCtrl
52 The derived classes should implement ctor and Create() method with the
55 bool Create(wxWindow *parent,
57 const wxDateTime& dt = wxDefaultDateTime,
58 const wxPoint& pos = wxDefaultPosition,
59 const wxSize& size = wxDefaultSize,
60 long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
61 const wxValidator& validator = wxDefaultValidator,
62 const wxString& name = wxDatePickerCtrlNameStr);
66 We inherit the methods to set/get the date from the base class.
68 virtual void SetValue(const wxDateTime& dt) = 0;
69 virtual wxDateTime GetValue() const = 0;
72 // And add methods to set/get the allowed valid range for the dates. If
73 // either/both of them are invalid, there is no corresponding limit and if
74 // neither is set, GetRange() returns false.
75 virtual void SetRange(const wxDateTime
& dt1
, const wxDateTime
& dt2
) = 0;
76 virtual bool GetRange(wxDateTime
*dt1
, wxDateTime
*dt2
) const = 0;
79 #if defined(__WXPALMOS__)
80 #include "wx/palmos/datectrl.h"
82 #define wxHAS_NATIVE_DATEPICKCTRL
83 #elif defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
84 #include "wx/msw/datectrl.h"
86 #define wxHAS_NATIVE_DATEPICKCTRL
87 #elif defined(__WXOSX_COCOA__) && !defined(__WXUNIVERSAL__)
88 #include "wx/osx/datectrl.h"
90 #define wxHAS_NATIVE_DATEPICKCTRL
92 #include "wx/generic/datectrl.h"
94 class WXDLLIMPEXP_ADV wxDatePickerCtrl
: public wxDatePickerCtrlGeneric
97 wxDatePickerCtrl() { }
98 wxDatePickerCtrl(wxWindow
*parent
,
100 const wxDateTime
& date
= wxDefaultDateTime
,
101 const wxPoint
& pos
= wxDefaultPosition
,
102 const wxSize
& size
= wxDefaultSize
,
103 long style
= wxDP_DEFAULT
| wxDP_SHOWCENTURY
,
104 const wxValidator
& validator
= wxDefaultValidator
,
105 const wxString
& name
= wxDatePickerCtrlNameStr
)
106 : wxDatePickerCtrlGeneric(parent
, id
, date
, pos
, size
, style
, validator
, name
)
111 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl
)
115 #endif // wxUSE_DATEPICKCTRL
117 #endif // _WX_DATECTRL_H_