]>
Commit | Line | Data |
---|---|---|
39df3acd VZ |
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 | ||
1721a8c0 | 15 | class WXDLLIMPEXP_ADV wxButton; |
39df3acd VZ |
16 | class WXDLLIMPEXP_ADV wxCalendarDateAttr; |
17 | class WXDLLIMPEXP_ADV wxCalendarCtrl; | |
18 | class WXDLLIMPEXP_ADV wxCalendarEvent; | |
1721a8c0 VZ |
19 | class WXDLLIMPEXP_ADV wxDatePopup; |
20 | class WXDLLIMPEXP_ADV wxTextCtrl; | |
21 | ||
22 | class WXDLLIMPEXP_ADV wxDatePopupInternal; | |
d5ae99f5 | 23 | |
7ae712f5 | 24 | class WXDLLIMPEXP_ADV wxDatePickerCtrlGeneric : public wxDatePickerCtrlBase |
39df3acd VZ |
25 | { |
26 | public: | |
4b134bb2 | 27 | // creating the control |
7ae712f5 | 28 | wxDatePickerCtrlGeneric() { Init(); } |
d3c7fc99 | 29 | virtual ~wxDatePickerCtrlGeneric() ; |
7ae712f5 VZ |
30 | wxDatePickerCtrlGeneric(wxWindow *parent, |
31 | wxWindowID id, | |
32 | const wxDateTime& date = wxDefaultDateTime, | |
33 | const wxPoint& pos = wxDefaultPosition, | |
34 | const wxSize& size = wxDefaultSize, | |
35 | long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, | |
807f5038 | 36 | const wxValidator& validator = wxDefaultValidator, |
7ae712f5 VZ |
37 | const wxString& name = wxDatePickerCtrlNameStr) |
38 | { | |
39 | Init(); | |
40 | ||
807f5038 | 41 | (void)Create(parent, id, date, pos, size, style, validator, name); |
7ae712f5 | 42 | } |
39df3acd VZ |
43 | |
44 | bool Create(wxWindow *parent, | |
2cfbeac8 VZ |
45 | wxWindowID id, |
46 | const wxDateTime& date = wxDefaultDateTime, | |
47 | const wxPoint& pos = wxDefaultPosition, | |
48 | const wxSize& size = wxDefaultSize, | |
49 | long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, | |
807f5038 | 50 | const wxValidator& validator = wxDefaultValidator, |
2cfbeac8 | 51 | const wxString& name = wxDatePickerCtrlNameStr); |
39df3acd | 52 | |
4b134bb2 | 53 | // wxDatePickerCtrl methods |
39df3acd VZ |
54 | void SetValue(const wxDateTime& date); |
55 | wxDateTime GetValue() const; | |
4b134bb2 | 56 | |
39df3acd VZ |
57 | bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const; |
58 | void SetRange(const wxDateTime &dt1, const wxDateTime &dt2); | |
59 | ||
4b134bb2 VZ |
60 | bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime, |
61 | const wxDateTime& upperdate = wxDefaultDateTime); | |
62 | ||
63 | // extra methods available only in this (generic) implementation | |
64 | bool SetFormat(const wxChar *fmt); | |
65 | wxCalendarCtrl *GetCalendar() const { return m_cal; } | |
39df3acd | 66 | |
39df3acd | 67 | |
4b134bb2 VZ |
68 | // implementation only from now on |
69 | // ------------------------------- | |
39df3acd | 70 | |
4b134bb2 VZ |
71 | // overridden base class methods |
72 | virtual bool Destroy(); | |
39df3acd | 73 | |
1721a8c0 VZ |
74 | virtual bool Enable(bool enable = true); |
75 | virtual bool Show(bool show = true); | |
39df3acd | 76 | |
4b134bb2 | 77 | protected: |
39df3acd VZ |
78 | virtual wxSize DoGetBestSize() const; |
79 | virtual void DoMoveWindow(int x, int y, int width, int height); | |
80 | ||
81 | private: | |
39df3acd | 82 | void Init(); |
77670008 | 83 | void DropDown(bool down = true); |
39df3acd | 84 | |
1721a8c0 | 85 | void OnText(wxCommandEvent &event); |
39df3acd VZ |
86 | void OnEditKey(wxKeyEvent & event); |
87 | void OnCalKey(wxKeyEvent & event); | |
1721a8c0 VZ |
88 | void OnClick(wxCommandEvent &event); |
89 | void OnSelChange(wxCalendarEvent &event); | |
90 | void OnSetFocus(wxFocusEvent &event); | |
91 | void OnKillFocus(wxFocusEvent &event); | |
92 | void OnChildSetFocus(wxChildFocusEvent &event); | |
18fefee7 | 93 | void OnSize(wxSizeEvent& event); |
39df3acd | 94 | |
77670008 | 95 | |
1721a8c0 | 96 | wxDatePopupInternal *m_popup; |
77670008 VZ |
97 | wxTextCtrl *m_txt; |
98 | wxCalendarCtrl *m_cal; | |
99 | wxButton *m_btn; | |
100 | wxString m_format; | |
1721a8c0 | 101 | wxDateTime m_currentDate; |
77670008 VZ |
102 | |
103 | bool m_dropped, | |
104 | m_ignoreDrop; | |
105 | ||
106 | ||
39df3acd | 107 | DECLARE_EVENT_TABLE() |
7ae712f5 | 108 | DECLARE_NO_COPY_CLASS(wxDatePickerCtrlGeneric) |
39df3acd VZ |
109 | }; |
110 | ||
111 | #endif // _WX_GENERIC_DATECTRL_H_ | |
112 |