]> git.saurik.com Git - wxWidgets.git/blob - include/wx/datectrl.h
Dramatically optimise inserting many items in wxGenericListCtrl.
[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(__WXPALMOS__)
80 #include "wx/palmos/datectrl.h"
81
82 #define wxHAS_NATIVE_DATEPICKCTRL
83 #elif defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
84 #include "wx/msw/datectrl.h"
85
86 #define wxHAS_NATIVE_DATEPICKCTRL
87 #elif defined(__WXOSX_COCOA__) && !defined(__WXUNIVERSAL__)
88 #include "wx/osx/datectrl.h"
89
90 #define wxHAS_NATIVE_DATEPICKCTRL
91 #else
92 #include "wx/generic/datectrl.h"
93
94 class WXDLLIMPEXP_ADV wxDatePickerCtrl : public wxDatePickerCtrlGeneric
95 {
96 public:
97 wxDatePickerCtrl() { }
98 wxDatePickerCtrl(wxWindow *parent,
99 wxWindowID id,
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)
107 {
108 }
109
110 private:
111 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl)
112 };
113 #endif
114
115 #endif // wxUSE_DATEPICKCTRL
116
117 #endif // _WX_DATECTRL_H_
118