]>
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 | #include "wx/calctrl.h" | |
16 | #include "wx/combo.h" | |
17 | ||
18 | class WXDLLIMPEXP_FWD_ADV wxCalendarComboPopup; | |
19 | ||
20 | class WXDLLIMPEXP_ADV wxDatePickerCtrlGeneric : public wxDatePickerCtrlBase | |
21 | { | |
22 | public: | |
23 | // creating the control | |
24 | wxDatePickerCtrlGeneric() { Init(); } | |
25 | virtual ~wxDatePickerCtrlGeneric(); | |
26 | wxDatePickerCtrlGeneric(wxWindow *parent, | |
27 | wxWindowID id, | |
28 | const wxDateTime& date = wxDefaultDateTime, | |
29 | const wxPoint& pos = wxDefaultPosition, | |
30 | const wxSize& size = wxDefaultSize, | |
31 | long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, | |
32 | const wxValidator& validator = wxDefaultValidator, | |
33 | const wxString& name = wxDatePickerCtrlNameStr) | |
34 | { | |
35 | Init(); | |
36 | ||
37 | (void)Create(parent, id, date, pos, size, style, validator, name); | |
38 | } | |
39 | ||
40 | bool Create(wxWindow *parent, | |
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 wxValidator& validator = wxDefaultValidator, | |
47 | const wxString& name = wxDatePickerCtrlNameStr); | |
48 | ||
49 | // wxDatePickerCtrl methods | |
50 | void SetValue(const wxDateTime& date); | |
51 | wxDateTime GetValue() const; | |
52 | ||
53 | bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const; | |
54 | void SetRange(const wxDateTime &dt1, const wxDateTime &dt2); | |
55 | ||
56 | bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime, | |
57 | const wxDateTime& upperdate = wxDefaultDateTime); | |
58 | ||
59 | // extra methods available only in this (generic) implementation | |
60 | bool SetFormat(const wxString& fmt); | |
61 | wxCalendarCtrl *GetCalendar() const; | |
62 | ||
63 | ||
64 | // implementation only from now on | |
65 | // ------------------------------- | |
66 | ||
67 | // overridden base class methods | |
68 | virtual bool Destroy(); | |
69 | ||
70 | protected: | |
71 | virtual wxSize DoGetBestSize() const; | |
72 | ||
73 | private: | |
74 | void Init(); | |
75 | ||
76 | void OnText(wxCommandEvent &event); | |
77 | void OnSize(wxSizeEvent& event); | |
78 | void OnFocus(wxFocusEvent& event); | |
79 | ||
80 | wxComboCtrl* m_combo; | |
81 | wxCalendarComboPopup* m_popup; | |
82 | ||
83 | DECLARE_EVENT_TABLE() | |
84 | DECLARE_NO_COPY_CLASS(wxDatePickerCtrlGeneric) | |
85 | }; | |
86 | ||
87 | #endif // _WX_GENERIC_DATECTRL_H_ | |
88 |