]>
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 | ||
77670008 | 15 | class WXDLLIMPEXP_CORE wxButton; |
39df3acd VZ |
16 | class WXDLLIMPEXP_ADV wxCalendarDateAttr; |
17 | class WXDLLIMPEXP_ADV wxCalendarCtrl; | |
18 | class WXDLLIMPEXP_ADV wxCalendarEvent; | |
77670008 VZ |
19 | class WXDLLIMPEXP_CORE wxPopupWindow; |
20 | class WXDLLIMPEXP_CORE wxTextCtrl; | |
d5ae99f5 | 21 | |
7ae712f5 | 22 | class WXDLLIMPEXP_ADV wxDatePickerCtrlGeneric : public wxDatePickerCtrlBase |
39df3acd VZ |
23 | { |
24 | public: | |
4b134bb2 | 25 | // creating the control |
7ae712f5 VZ |
26 | wxDatePickerCtrlGeneric() { Init(); } |
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, | |
807f5038 | 33 | const wxValidator& validator = wxDefaultValidator, |
7ae712f5 VZ |
34 | const wxString& name = wxDatePickerCtrlNameStr) |
35 | { | |
36 | Init(); | |
37 | ||
807f5038 | 38 | (void)Create(parent, id, date, pos, size, style, validator, name); |
7ae712f5 | 39 | } |
39df3acd VZ |
40 | |
41 | bool Create(wxWindow *parent, | |
2cfbeac8 VZ |
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, | |
807f5038 | 47 | const wxValidator& validator = wxDefaultValidator, |
2cfbeac8 | 48 | const wxString& name = wxDatePickerCtrlNameStr); |
39df3acd | 49 | |
4b134bb2 | 50 | // wxDatePickerCtrl methods |
39df3acd VZ |
51 | void SetValue(const wxDateTime& date); |
52 | wxDateTime GetValue() const; | |
4b134bb2 | 53 | |
39df3acd VZ |
54 | bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const; |
55 | void SetRange(const wxDateTime &dt1, const wxDateTime &dt2); | |
56 | ||
4b134bb2 VZ |
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 wxChar *fmt); | |
62 | wxCalendarCtrl *GetCalendar() const { return m_cal; } | |
39df3acd | 63 | |
39df3acd | 64 | |
4b134bb2 VZ |
65 | // implementation only from now on |
66 | // ------------------------------- | |
39df3acd | 67 | |
4b134bb2 VZ |
68 | // overridden base class methods |
69 | virtual bool Destroy(); | |
39df3acd VZ |
70 | |
71 | virtual bool Enable(bool enable = TRUE); | |
72 | virtual bool Show(bool show = TRUE); | |
73 | ||
4b134bb2 | 74 | protected: |
39df3acd VZ |
75 | virtual wxSize DoGetBestSize() const; |
76 | virtual void DoMoveWindow(int x, int y, int width, int height); | |
77 | ||
78 | private: | |
39df3acd | 79 | void Init(); |
77670008 | 80 | void DropDown(bool down = true); |
39df3acd VZ |
81 | |
82 | void OnText(wxCommandEvent &ev); | |
83 | void OnEditKey(wxKeyEvent & event); | |
84 | void OnCalKey(wxKeyEvent & event); | |
85 | void OnClick(wxCommandEvent &ev); | |
86 | void OnSelChange(wxCalendarEvent &ev); | |
87 | void OnSetFocus(wxFocusEvent &ev); | |
88 | void OnKillFocus(wxFocusEvent &ev); | |
89 | void OnChildSetFocus(wxChildFocusEvent &ev); | |
90 | ||
77670008 VZ |
91 | |
92 | wxPopupWindow *m_popup; | |
93 | wxTextCtrl *m_txt; | |
94 | wxCalendarCtrl *m_cal; | |
95 | wxButton *m_btn; | |
96 | wxString m_format; | |
97 | ||
98 | bool m_dropped, | |
99 | m_ignoreDrop; | |
100 | ||
101 | ||
39df3acd | 102 | DECLARE_EVENT_TABLE() |
7ae712f5 | 103 | DECLARE_NO_COPY_CLASS(wxDatePickerCtrlGeneric) |
39df3acd VZ |
104 | }; |
105 | ||
106 | #endif // _WX_GENERIC_DATECTRL_H_ | |
107 |