]> git.saurik.com Git - wxWidgets.git/blob - include/wx/datectrl.h
Compilation fixes.
[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/control.h" // the base class
20 #include "wx/datetime.h"
21 #include "wx/dateevt.h"
22
23 #define wxDatePickerCtrlNameStr _T("datectrl")
24
25 // wxDatePickerCtrl styles
26 enum
27 {
28 // default style on this platform, either wxDP_SPIN or wxDP_DROPDOWN
29 wxDP_DEFAULT = 0,
30
31 // a spin control-like date picker (not supported in generic version)
32 wxDP_SPIN = 1,
33
34 // a combobox-like date picker (not supported in mac version)
35 wxDP_DROPDOWN = 2,
36
37 // always show century in the default date display (otherwise it depends on
38 // the system date format which may include the century or not)
39 wxDP_SHOWCENTURY = 4,
40
41 // allow not having any valid date in the control (by default it always has
42 // some date, today initially if no valid date specified in ctor)
43 wxDP_ALLOWNONE = 8
44 };
45
46 // ----------------------------------------------------------------------------
47 // wxDatePickerCtrl: allow the user to enter the date
48 // ----------------------------------------------------------------------------
49
50 class WXDLLIMPEXP_ADV wxDatePickerCtrlBase : public wxControl
51 {
52 public:
53 /*
54 The derived classes should implement ctor and Create() method with the
55 following signature:
56
57 bool Create(wxWindow *parent,
58 wxWindowID id,
59 const wxDateTime& dt = wxDefaultDateTime,
60 const wxPoint& pos = wxDefaultPosition,
61 const wxSize& size = wxDefaultSize,
62 long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
63 const wxValidator& validator = wxDefaultValidator,
64 const wxString& name = wxDatePickerCtrlNameStr);
65 */
66
67 // set/get the date
68 virtual void SetValue(const wxDateTime& dt) = 0;
69 virtual wxDateTime GetValue() const = 0;
70
71 // set/get the allowed valid range for the dates, if either/both of them
72 // are invalid, there is no corresponding limit and if neither is set
73 // GetRange() returns false
74 virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2) = 0;
75 virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const = 0;
76 };
77
78 #if defined(__WXPALMOS__)
79 #include "wx/palmos/datectrl.h"
80
81 #define wxHAS_NATIVE_DATEPICKCTRL
82 #elif defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
83 #include "wx/msw/datectrl.h"
84
85 #define wxHAS_NATIVE_DATEPICKCTRL
86 #else
87 #include "wx/generic/datectrl.h"
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,
99 const wxValidator& validator = wxDefaultValidator,
100 const wxString& name = wxDatePickerCtrlNameStr)
101 : wxDatePickerCtrlGeneric(parent, id, date, pos, size, style, validator, name)
102 {
103 }
104
105 private:
106 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl)
107 };
108 #endif
109
110 #endif // wxUSE_DATEPICKCTRL
111
112 #endif // _WX_DATECTRL_H_
113