]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/generic/datectrl.h | |
3 | // Purpose: generic wxDatePickerCtrl implementation | |
4 | // Author: Andreas Pflug | |
5 | // Modified by: | |
6 | // Created: 2005-01-19 | |
7 | // Copyright: (c) 2005 Andreas Pflug <pgadmin@pse-consulting.de> | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_GENERIC_DATECTRL_H_ | |
12 | #define _WX_GENERIC_DATECTRL_H_ | |
13 | ||
14 | #include "wx/compositewin.h" | |
15 | ||
16 | class WXDLLIMPEXP_FWD_CORE wxComboCtrl; | |
17 | ||
18 | class WXDLLIMPEXP_FWD_ADV wxCalendarCtrl; | |
19 | class WXDLLIMPEXP_FWD_ADV wxCalendarComboPopup; | |
20 | ||
21 | class WXDLLIMPEXP_ADV wxDatePickerCtrlGeneric | |
22 | : public wxCompositeWindow<wxDatePickerCtrlBase> | |
23 | { | |
24 | public: | |
25 | // creating the control | |
26 | wxDatePickerCtrlGeneric() { Init(); } | |
27 | virtual ~wxDatePickerCtrlGeneric(); | |
28 | wxDatePickerCtrlGeneric(wxWindow *parent, | |
29 | wxWindowID id, | |
30 | const wxDateTime& date = wxDefaultDateTime, | |
31 | const wxPoint& pos = wxDefaultPosition, | |
32 | const wxSize& size = wxDefaultSize, | |
33 | long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, | |
34 | const wxValidator& validator = wxDefaultValidator, | |
35 | const wxString& name = wxDatePickerCtrlNameStr) | |
36 | { | |
37 | Init(); | |
38 | ||
39 | (void)Create(parent, id, date, pos, size, style, validator, name); | |
40 | } | |
41 | ||
42 | bool Create(wxWindow *parent, | |
43 | wxWindowID id, | |
44 | const wxDateTime& date = wxDefaultDateTime, | |
45 | const wxPoint& pos = wxDefaultPosition, | |
46 | const wxSize& size = wxDefaultSize, | |
47 | long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, | |
48 | const wxValidator& validator = wxDefaultValidator, | |
49 | const wxString& name = wxDatePickerCtrlNameStr); | |
50 | ||
51 | // wxDatePickerCtrl methods | |
52 | void SetValue(const wxDateTime& date); | |
53 | wxDateTime GetValue() const; | |
54 | ||
55 | bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const; | |
56 | void SetRange(const wxDateTime &dt1, const wxDateTime &dt2); | |
57 | ||
58 | bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime, | |
59 | const wxDateTime& upperdate = wxDefaultDateTime); | |
60 | ||
61 | // extra methods available only in this (generic) implementation | |
62 | wxCalendarCtrl *GetCalendar() const; | |
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 | // return the list of the windows composing this one | |
78 | virtual wxWindowList GetCompositeWindowParts() const; | |
79 | ||
80 | void OnText(wxCommandEvent &event); | |
81 | void OnSize(wxSizeEvent& event); | |
82 | void OnFocus(wxFocusEvent& event); | |
83 | ||
84 | #ifdef __WXOSX_COCOA__ | |
85 | virtual void OSXGenerateEvent(const wxDateTime& WXUNUSED(dt)) { } | |
86 | #endif | |
87 | ||
88 | wxComboCtrl* m_combo; | |
89 | wxCalendarComboPopup* m_popup; | |
90 | ||
91 | DECLARE_EVENT_TABLE() | |
92 | wxDECLARE_NO_COPY_CLASS(wxDatePickerCtrlGeneric); | |
93 | }; | |
94 | ||
95 | #endif // _WX_GENERIC_DATECTRL_H_ | |
96 |