]>
Commit | Line | Data |
---|---|---|
feb72429 VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/datectrl.h | |
3 | // Purpose: implements wxDatePickerCtrl | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 2005-01-09 | |
feb72429 VZ |
7 | // Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org> |
8 | // Licence: wxWindows licence | |
9 | /////////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_DATECTRL_H_ | |
12 | #define _WX_DATECTRL_H_ | |
13 | ||
1ee3fb38 VS |
14 | #include "wx/defs.h" |
15 | ||
16 | #if wxUSE_DATEPICKCTRL | |
17 | ||
8957e55e | 18 | #include "wx/datetimectrl.h" // the base class |
feb72429 | 19 | |
9a83f860 | 20 | #define wxDatePickerCtrlNameStr wxT("datectrl") |
feb72429 | 21 | |
29c86948 VZ |
22 | // wxDatePickerCtrl styles |
23 | enum | |
24 | { | |
25 | // default style on this platform, either wxDP_SPIN or wxDP_DROPDOWN | |
26 | wxDP_DEFAULT = 0, | |
27 | ||
28 | // a spin control-like date picker (not supported in generic version) | |
29 | wxDP_SPIN = 1, | |
30 | ||
31 | // a combobox-like date picker (not supported in mac version) | |
2cfbeac8 VZ |
32 | wxDP_DROPDOWN = 2, |
33 | ||
34 | // always show century in the default date display (otherwise it depends on | |
35 | // the system date format which may include the century or not) | |
1721a8c0 VZ |
36 | wxDP_SHOWCENTURY = 4, |
37 | ||
38 | // allow not having any valid date in the control (by default it always has | |
39 | // some date, today initially if no valid date specified in ctor) | |
40 | wxDP_ALLOWNONE = 8 | |
29c86948 VZ |
41 | }; |
42 | ||
feb72429 VZ |
43 | // ---------------------------------------------------------------------------- |
44 | // wxDatePickerCtrl: allow the user to enter the date | |
45 | // ---------------------------------------------------------------------------- | |
46 | ||
8957e55e | 47 | class WXDLLIMPEXP_ADV wxDatePickerCtrlBase : public wxDateTimePickerCtrl |
feb72429 VZ |
48 | { |
49 | public: | |
50 | /* | |
51 | The derived classes should implement ctor and Create() method with the | |
52 | following signature: | |
53 | ||
54 | bool Create(wxWindow *parent, | |
55 | wxWindowID id, | |
56 | const wxDateTime& dt = wxDefaultDateTime, | |
57 | const wxPoint& pos = wxDefaultPosition, | |
58 | const wxSize& size = wxDefaultSize, | |
2cfbeac8 | 59 | long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, |
feb72429 VZ |
60 | const wxValidator& validator = wxDefaultValidator, |
61 | const wxString& name = wxDatePickerCtrlNameStr); | |
62 | */ | |
63 | ||
8957e55e VZ |
64 | /* |
65 | We inherit the methods to set/get the date from the base class. | |
66 | ||
67 | virtual void SetValue(const wxDateTime& dt) = 0; | |
68 | virtual wxDateTime GetValue() const = 0; | |
69 | */ | |
feb72429 | 70 | |
8957e55e VZ |
71 | // And add methods to set/get the allowed valid range for the dates. If |
72 | // either/both of them are invalid, there is no corresponding limit and if | |
73 | // neither is set, GetRange() returns false. | |
feb72429 VZ |
74 | virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2) = 0; |
75 | virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const = 0; | |
76 | }; | |
77 | ||
bd362275 | 78 | #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) |
feb72429 | 79 | #include "wx/msw/datectrl.h" |
15c86b39 | 80 | |
fceac6bb VZ |
81 | #define wxHAS_NATIVE_DATEPICKCTRL |
82 | #elif defined(__WXOSX_COCOA__) && !defined(__WXUNIVERSAL__) | |
83 | #include "wx/osx/datectrl.h" | |
84 | ||
15c86b39 | 85 | #define wxHAS_NATIVE_DATEPICKCTRL |
feb72429 | 86 | #else |
39df3acd | 87 | #include "wx/generic/datectrl.h" |
7ae712f5 VZ |
88 | |
89 | class WXDLLIMPEXP_ADV wxDatePickerCtrl : public wxDatePickerCtrlGeneric | |
90 | { | |
91 | public: | |
92 | wxDatePickerCtrl() { } | |
93 | wxDatePickerCtrl(wxWindow *parent, | |
94 | wxWindowID id, | |
95 | const wxDateTime& date = wxDefaultDateTime, | |
96 | const wxPoint& pos = wxDefaultPosition, | |
97 | const wxSize& size = wxDefaultSize, | |
98 | long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, | |
807f5038 | 99 | const wxValidator& validator = wxDefaultValidator, |
7ae712f5 | 100 | const wxString& name = wxDatePickerCtrlNameStr) |
807f5038 | 101 | : wxDatePickerCtrlGeneric(parent, id, date, pos, size, style, validator, name) |
7ae712f5 VZ |
102 | { |
103 | } | |
104 | ||
105 | private: | |
a69e2a0a | 106 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl) |
7ae712f5 | 107 | }; |
feb72429 VZ |
108 | #endif |
109 | ||
1ee3fb38 VS |
110 | #endif // wxUSE_DATEPICKCTRL |
111 | ||
feb72429 VZ |
112 | #endif // _WX_DATECTRL_H_ |
113 |