]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/datectrl.h
b0d27c63deae93028acdfd454a202d24c1d18313
[wxWidgets.git] / include / wx / generic / datectrl.h
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 class WXDLLIMPEXP_ADV wxCalendarDateAttr;
16 class WXDLLIMPEXP_ADV wxCalendarCtrl;
17 class WXDLLIMPEXP_ADV wxCalendarEvent;
18
19 class WXDLLIMPEXP_ADV wxDatePickerCtrl : public wxDatePickerCtrlBase
20 {
21 public:
22 // creating the control
23 wxDatePickerCtrl() { Init(); }
24 wxDatePickerCtrl(wxWindow *parent,
25 wxWindowID id,
26 const wxDateTime& date = wxDefaultDateTime,
27 const wxPoint& pos = wxDefaultPosition,
28 const wxSize& size = wxDefaultSize,
29 long style = 0,
30 const wxString& name = wxDatePickerCtrlNameStr);
31
32 bool Create(wxWindow *parent,
33 wxWindowID id,
34 const wxDateTime& date,
35 const wxPoint& pos,
36 const wxSize& size,
37 long style,
38 const wxString& name=wxDatePickerCtrlNameStr);
39
40 // wxDatePickerCtrl methods
41 void SetValue(const wxDateTime& date);
42 wxDateTime GetValue() const;
43
44 bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const;
45 void SetRange(const wxDateTime &dt1, const wxDateTime &dt2);
46
47 bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime,
48 const wxDateTime& upperdate = wxDefaultDateTime);
49
50 // extra methods available only in this (generic) implementation
51 bool SetFormat(const wxChar *fmt);
52 wxCalendarCtrl *GetCalendar() const { return m_cal; }
53
54
55 // implementation only from now on
56 // -------------------------------
57
58 // overridden base class methods
59 virtual bool Destroy();
60
61 virtual bool Enable(bool enable = TRUE);
62 virtual bool Show(bool show = TRUE);
63
64 protected:
65 virtual wxSize DoGetBestSize() const;
66 virtual void DoMoveWindow(int x, int y, int width, int height);
67
68 private:
69 wxDialog *m_dlg;
70 wxTextCtrl *m_txt;
71 wxCalendarCtrl *m_cal;
72 wxButton *m_btn;
73 wxString m_format;
74
75 bool m_dropped, m_ignoreDrop;
76
77 void Init();
78 void DropDown(bool down=true);
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
89 DECLARE_DYNAMIC_CLASS(wxDatePickerCtrl)
90 DECLARE_EVENT_TABLE()
91 DECLARE_NO_COPY_CLASS(wxDatePickerCtrl)
92 };
93
94 #endif // _WX_GENERIC_DATECTRL_H_
95