]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: generic/datectrl.h | |
3 | // Purpose: generic wxDatePickerCtrl implementation | |
4 | // Author: Andreas Pflug | |
5 | // Modified by: | |
6 | // Created: 2005-01-19 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 2005 Andreas Pflug <pgadmin@pse-consulting.de> | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_GENERIC_DATECTRL_H_ | |
13 | #define _WX_GENERIC_DATECTRL_H_ | |
14 | ||
15 | class WXDLLIMPEXP_FWD_ADV wxCalendarDateAttr; | |
16 | class WXDLLIMPEXP_FWD_ADV wxCalendarCtrl; | |
17 | class WXDLLIMPEXP_FWD_ADV wxCalendarEvent; | |
18 | class WXDLLIMPEXP_FWD_ADV wxComboCtrl; | |
19 | class WXDLLIMPEXP_FWD_ADV wxCalendarComboPopup; | |
20 | ||
21 | class WXDLLIMPEXP_ADV wxDatePickerCtrlGeneric : public wxDatePickerCtrlBase | |
22 | { | |
23 | public: | |
24 | // creating the control | |
25 | wxDatePickerCtrlGeneric() { Init(); } | |
26 | virtual ~wxDatePickerCtrlGeneric(); | |
27 | wxDatePickerCtrlGeneric(wxWindow *parent, | |
28 | wxWindowID id, | |
29 | const wxDateTime& date = wxDefaultDateTime, | |
30 | const wxPoint& pos = wxDefaultPosition, | |
31 | const wxSize& size = wxDefaultSize, | |
32 | long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, | |
33 | const wxValidator& validator = wxDefaultValidator, | |
34 | const wxString& name = wxDatePickerCtrlNameStr) | |
35 | { | |
36 | Init(); | |
37 | ||
38 | (void)Create(parent, id, date, pos, size, style, validator, name); | |
39 | } | |
40 | ||
41 | bool Create(wxWindow *parent, | |
42 | wxWindowID id, | |
43 | const wxDateTime& date = wxDefaultDateTime, | |
44 | const wxPoint& pos = wxDefaultPosition, | |
45 | const wxSize& size = wxDefaultSize, | |
46 | long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, | |
47 | const wxValidator& validator = wxDefaultValidator, | |
48 | const wxString& name = wxDatePickerCtrlNameStr); | |
49 | ||
50 | // wxDatePickerCtrl methods | |
51 | void SetValue(const wxDateTime& date); | |
52 | wxDateTime GetValue() const; | |
53 | ||
54 | bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const; | |
55 | void SetRange(const wxDateTime &dt1, const wxDateTime &dt2); | |
56 | ||
57 | bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime, | |
58 | const wxDateTime& upperdate = wxDefaultDateTime); | |
59 | ||
60 | // extra methods available only in this (generic) implementation | |
61 | bool SetFormat(const wxString& fmt); | |
62 | wxCalendarCtrl *GetCalendar() const { return m_cal; } | |
63 | ||
64 | ||
65 | // implementation only from now on | |
66 | // ------------------------------- | |
67 | ||
68 | // overridden base class methods | |
69 | virtual bool Destroy(); | |
70 | ||
71 | protected: | |
72 | virtual wxSize DoGetBestSize() const; | |
73 | ||
74 | private: | |
75 | void Init(); | |
76 | ||
77 | void OnText(wxCommandEvent &event); | |
78 | void OnSize(wxSizeEvent& event); | |
79 | void OnFocus(wxFocusEvent& event); | |
80 | ||
81 | wxCalendarCtrl *m_cal; | |
82 | wxComboCtrl* m_combo; | |
83 | wxCalendarComboPopup* m_popup; | |
84 | ||
85 | ||
86 | DECLARE_EVENT_TABLE() | |
87 | DECLARE_NO_COPY_CLASS(wxDatePickerCtrlGeneric) | |
88 | }; | |
89 | ||
90 | #endif // _WX_GENERIC_DATECTRL_H_ | |
91 |