]>
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 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org> | |
9 | // Licence: wxWindows licence | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_DATECTRL_H_ | |
13 | #define _WX_DATECTRL_H_ | |
14 | ||
1ee3fb38 VS |
15 | #include "wx/defs.h" |
16 | ||
17 | #if wxUSE_DATEPICKCTRL | |
18 | ||
8957e55e | 19 | #include "wx/datetimectrl.h" // the base class |
feb72429 | 20 | |
9a83f860 | 21 | #define wxDatePickerCtrlNameStr wxT("datectrl") |
feb72429 | 22 | |
29c86948 VZ |
23 | // wxDatePickerCtrl styles |
24 | enum | |
25 | { | |
26 | // default style on this platform, either wxDP_SPIN or wxDP_DROPDOWN | |
27 | wxDP_DEFAULT = 0, | |
28 | ||
29 | // a spin control-like date picker (not supported in generic version) | |
30 | wxDP_SPIN = 1, | |
31 | ||
32 | // a combobox-like date picker (not supported in mac version) | |
2cfbeac8 VZ |
33 | wxDP_DROPDOWN = 2, |
34 | ||
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) | |
1721a8c0 VZ |
37 | wxDP_SHOWCENTURY = 4, |
38 | ||
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) | |
41 | wxDP_ALLOWNONE = 8 | |
29c86948 VZ |
42 | }; |
43 | ||
feb72429 VZ |
44 | // ---------------------------------------------------------------------------- |
45 | // wxDatePickerCtrl: allow the user to enter the date | |
46 | // ---------------------------------------------------------------------------- | |
47 | ||
8957e55e | 48 | class WXDLLIMPEXP_ADV wxDatePickerCtrlBase : public wxDateTimePickerCtrl |
feb72429 VZ |
49 | { |
50 | public: | |
51 | /* | |
52 | The derived classes should implement ctor and Create() method with the | |
53 | following signature: | |
54 | ||
55 | bool Create(wxWindow *parent, | |
56 | wxWindowID id, | |
57 | const wxDateTime& dt = wxDefaultDateTime, | |
58 | const wxPoint& pos = wxDefaultPosition, | |
59 | const wxSize& size = wxDefaultSize, | |
2cfbeac8 | 60 | long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, |
feb72429 VZ |
61 | const wxValidator& validator = wxDefaultValidator, |
62 | const wxString& name = wxDatePickerCtrlNameStr); | |
63 | */ | |
64 | ||
8957e55e VZ |
65 | /* |
66 | We inherit the methods to set/get the date from the base class. | |
67 | ||
68 | virtual void SetValue(const wxDateTime& dt) = 0; | |
69 | virtual wxDateTime GetValue() const = 0; | |
70 | */ | |
feb72429 | 71 | |
8957e55e VZ |
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. | |
feb72429 VZ |
75 | virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2) = 0; |
76 | virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const = 0; | |
77 | }; | |
78 | ||
bd362275 | 79 | #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) |
feb72429 | 80 | #include "wx/msw/datectrl.h" |
15c86b39 | 81 | |
fceac6bb VZ |
82 | #define wxHAS_NATIVE_DATEPICKCTRL |
83 | #elif defined(__WXOSX_COCOA__) && !defined(__WXUNIVERSAL__) | |
84 | #include "wx/osx/datectrl.h" | |
85 | ||
15c86b39 | 86 | #define wxHAS_NATIVE_DATEPICKCTRL |
feb72429 | 87 | #else |
39df3acd | 88 | #include "wx/generic/datectrl.h" |
7ae712f5 VZ |
89 | |
90 | class WXDLLIMPEXP_ADV wxDatePickerCtrl : public wxDatePickerCtrlGeneric | |
91 | { | |
92 | public: | |
93 | wxDatePickerCtrl() { } | |
94 | wxDatePickerCtrl(wxWindow *parent, | |
95 | wxWindowID id, | |
96 | const wxDateTime& date = wxDefaultDateTime, | |
97 | const wxPoint& pos = wxDefaultPosition, | |
98 | const wxSize& size = wxDefaultSize, | |
99 | long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, | |
807f5038 | 100 | const wxValidator& validator = wxDefaultValidator, |
7ae712f5 | 101 | const wxString& name = wxDatePickerCtrlNameStr) |
807f5038 | 102 | : wxDatePickerCtrlGeneric(parent, id, date, pos, size, style, validator, name) |
7ae712f5 VZ |
103 | { |
104 | } | |
105 | ||
106 | private: | |
a69e2a0a | 107 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl) |
7ae712f5 | 108 | }; |
feb72429 VZ |
109 | #endif |
110 | ||
1ee3fb38 VS |
111 | #endif // wxUSE_DATEPICKCTRL |
112 | ||
feb72429 VZ |
113 | #endif // _WX_DATECTRL_H_ |
114 |