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