]>
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 | ||
feb72429 VZ |
19 | #include "wx/control.h" // the base class |
20 | #include "wx/datetime.h" | |
21 | ||
22 | #define wxDatePickerCtrlNameStr _T("datectrl") | |
23 | ||
29c86948 VZ |
24 | // wxDatePickerCtrl styles |
25 | enum | |
26 | { | |
27 | // default style on this platform, either wxDP_SPIN or wxDP_DROPDOWN | |
28 | wxDP_DEFAULT = 0, | |
29 | ||
30 | // a spin control-like date picker (not supported in generic version) | |
31 | wxDP_SPIN = 1, | |
32 | ||
33 | // a combobox-like date picker (not supported in mac version) | |
2cfbeac8 VZ |
34 | wxDP_DROPDOWN = 2, |
35 | ||
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) | |
38 | wxDP_SHOWCENTURY = 4 | |
29c86948 VZ |
39 | }; |
40 | ||
feb72429 VZ |
41 | // ---------------------------------------------------------------------------- |
42 | // wxDatePickerCtrl: allow the user to enter the date | |
43 | // ---------------------------------------------------------------------------- | |
44 | ||
45 | class WXDLLIMPEXP_ADV wxDatePickerCtrlBase : public wxControl | |
46 | { | |
47 | public: | |
48 | /* | |
49 | The derived classes should implement ctor and Create() method with the | |
50 | following signature: | |
51 | ||
52 | bool Create(wxWindow *parent, | |
53 | wxWindowID id, | |
54 | const wxDateTime& dt = wxDefaultDateTime, | |
55 | const wxPoint& pos = wxDefaultPosition, | |
56 | const wxSize& size = wxDefaultSize, | |
2cfbeac8 | 57 | long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, |
feb72429 VZ |
58 | const wxValidator& validator = wxDefaultValidator, |
59 | const wxString& name = wxDatePickerCtrlNameStr); | |
60 | */ | |
61 | ||
62 | // set/get the date | |
63 | virtual void SetValue(const wxDateTime& dt) = 0; | |
64 | virtual wxDateTime GetValue() const = 0; | |
65 | ||
66 | // set/get the allowed valid range for the dates, if either/both of them | |
67 | // are invalid, there is no corresponding limit and if neither is set | |
68 | // GetRange() returns false | |
69 | virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2) = 0; | |
70 | virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const = 0; | |
71 | }; | |
72 | ||
73 | #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) | |
74 | #include "wx/msw/datectrl.h" | |
15c86b39 VZ |
75 | |
76 | #define wxHAS_NATIVE_DATEPICKCTRL | |
feb72429 | 77 | #else |
39df3acd | 78 | #include "wx/generic/datectrl.h" |
7ae712f5 VZ |
79 | |
80 | class WXDLLIMPEXP_ADV wxDatePickerCtrl : public wxDatePickerCtrlGeneric | |
81 | { | |
82 | public: | |
83 | wxDatePickerCtrl() { } | |
84 | wxDatePickerCtrl(wxWindow *parent, | |
85 | wxWindowID id, | |
86 | const wxDateTime& date = wxDefaultDateTime, | |
87 | const wxPoint& pos = wxDefaultPosition, | |
88 | const wxSize& size = wxDefaultSize, | |
89 | long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, | |
90 | const wxString& name = wxDatePickerCtrlNameStr) | |
91 | : wxDatePickerCtrlGeneric(parent, id, date, pos, size, style, name) | |
92 | { | |
93 | } | |
94 | ||
95 | private: | |
96 | DECLARE_DYNAMIC_CLASS(wxDatePickerCtrl) | |
97 | DECLARE_NO_COPY_CLASS(wxDatePickerCtrl) | |
98 | }; | |
feb72429 VZ |
99 | #endif |
100 | ||
1ee3fb38 VS |
101 | #endif // wxUSE_DATEPICKCTRL |
102 | ||
feb72429 VZ |
103 | #endif // _WX_DATECTRL_H_ |
104 |