]>
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, | |
33 | const wxString& name = wxDatePickerCtrlNameStr) | |
34 | { | |
35 | Init(); | |
36 | ||
37 | (void)Create(parent, id, date, pos, size, style, name); | |
38 | } | |
39df3acd VZ |
39 | |
40 | bool Create(wxWindow *parent, | |
2cfbeac8 VZ |
41 | wxWindowID id, |
42 | const wxDateTime& date = wxDefaultDateTime, | |
43 | const wxPoint& pos = wxDefaultPosition, | |
44 | const wxSize& size = wxDefaultSize, | |
45 | long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, | |
46 | const wxString& name = wxDatePickerCtrlNameStr); | |
39df3acd | 47 | |
4b134bb2 | 48 | // wxDatePickerCtrl methods |
39df3acd VZ |
49 | void SetValue(const wxDateTime& date); |
50 | wxDateTime GetValue() const; | |
4b134bb2 | 51 | |
39df3acd VZ |
52 | bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const; |
53 | void SetRange(const wxDateTime &dt1, const wxDateTime &dt2); | |
54 | ||
4b134bb2 VZ |
55 | bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime, |
56 | const wxDateTime& upperdate = wxDefaultDateTime); | |
57 | ||
58 | // extra methods available only in this (generic) implementation | |
59 | bool SetFormat(const wxChar *fmt); | |
60 | wxCalendarCtrl *GetCalendar() const { return m_cal; } | |
39df3acd | 61 | |
39df3acd | 62 | |
4b134bb2 VZ |
63 | // implementation only from now on |
64 | // ------------------------------- | |
39df3acd | 65 | |
4b134bb2 VZ |
66 | // overridden base class methods |
67 | virtual bool Destroy(); | |
39df3acd VZ |
68 | |
69 | virtual bool Enable(bool enable = TRUE); | |
70 | virtual bool Show(bool show = TRUE); | |
71 | ||
4b134bb2 | 72 | protected: |
39df3acd VZ |
73 | virtual wxSize DoGetBestSize() const; |
74 | virtual void DoMoveWindow(int x, int y, int width, int height); | |
75 | ||
76 | private: | |
39df3acd | 77 | void Init(); |
77670008 | 78 | void DropDown(bool down = true); |
39df3acd VZ |
79 | |
80 | void OnText(wxCommandEvent &ev); | |
81 | void OnEditKey(wxKeyEvent & event); | |
82 | void OnCalKey(wxKeyEvent & event); | |
83 | void OnClick(wxCommandEvent &ev); | |
84 | void OnSelChange(wxCalendarEvent &ev); | |
85 | void OnSetFocus(wxFocusEvent &ev); | |
86 | void OnKillFocus(wxFocusEvent &ev); | |
87 | void OnChildSetFocus(wxChildFocusEvent &ev); | |
88 | ||
77670008 VZ |
89 | |
90 | wxPopupWindow *m_popup; | |
91 | wxTextCtrl *m_txt; | |
92 | wxCalendarCtrl *m_cal; | |
93 | wxButton *m_btn; | |
94 | wxString m_format; | |
95 | ||
96 | bool m_dropped, | |
97 | m_ignoreDrop; | |
98 | ||
99 | ||
39df3acd | 100 | DECLARE_EVENT_TABLE() |
7ae712f5 | 101 | DECLARE_NO_COPY_CLASS(wxDatePickerCtrlGeneric) |
39df3acd VZ |
102 | }; |
103 | ||
104 | #endif // _WX_GENERIC_DATECTRL_H_ | |
105 |