]> git.saurik.com Git - wxWidgets.git/blob - include/wx/datectrl.h
Add functor-taking overload of CallAfter().
[wxWidgets.git] / include / wx / datectrl.h
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
15 #include "wx/defs.h"
16
17 #if wxUSE_DATEPICKCTRL
18
19 #include "wx/datetimectrl.h" // the base class
20
21 #define wxDatePickerCtrlNameStr wxT("datectrl")
22
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)
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)
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
42 };
43
44 // ----------------------------------------------------------------------------
45 // wxDatePickerCtrl: allow the user to enter the date
46 // ----------------------------------------------------------------------------
47
48 class WXDLLIMPEXP_ADV wxDatePickerCtrlBase : public wxDateTimePickerCtrl
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,
60 long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
61 const wxValidator& validator = wxDefaultValidator,
62 const wxString& name = wxDatePickerCtrlNameStr);
63 */
64
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 */
71
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;
77 };
78
79 #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
80 #include "wx/msw/datectrl.h"
81
82 #define wxHAS_NATIVE_DATEPICKCTRL
83 #elif defined(__WXOSX_COCOA__) && !defined(__WXUNIVERSAL__)
84 #include "wx/osx/datectrl.h"
85
86 #define wxHAS_NATIVE_DATEPICKCTRL
87 #else
88 #include "wx/generic/datectrl.h"
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,
100 const wxValidator& validator = wxDefaultValidator,
101 const wxString& name = wxDatePickerCtrlNameStr)
102 : wxDatePickerCtrlGeneric(parent, id, date, pos, size, style, validator, name)
103 {
104 }
105
106 private:
107 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl)
108 };
109 #endif
110
111 #endif // wxUSE_DATEPICKCTRL
112
113 #endif // _WX_DATECTRL_H_
114