]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/datectrl.h
Applied patch [ 1178610 ] datectlg.cpp: wxDropdownButton + bug fixes
[wxWidgets.git] / include / wx / generic / datectrl.h
CommitLineData
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
1721a8c0 15class WXDLLIMPEXP_ADV wxButton;
39df3acd
VZ
16class WXDLLIMPEXP_ADV wxCalendarDateAttr;
17class WXDLLIMPEXP_ADV wxCalendarCtrl;
18class WXDLLIMPEXP_ADV wxCalendarEvent;
1721a8c0
VZ
19class WXDLLIMPEXP_ADV wxDatePopup;
20class WXDLLIMPEXP_ADV wxTextCtrl;
21
22class WXDLLIMPEXP_ADV wxDatePopupInternal;
d5ae99f5 23
7ae712f5 24class WXDLLIMPEXP_ADV wxDatePickerCtrlGeneric : public wxDatePickerCtrlBase
39df3acd
VZ
25{
26public:
4b134bb2 27 // creating the control
7ae712f5
VZ
28 wxDatePickerCtrlGeneric() { Init(); }
29 wxDatePickerCtrlGeneric(wxWindow *parent,
30 wxWindowID id,
31 const wxDateTime& date = wxDefaultDateTime,
32 const wxPoint& pos = wxDefaultPosition,
33 const wxSize& size = wxDefaultSize,
34 long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
807f5038 35 const wxValidator& validator = wxDefaultValidator,
7ae712f5
VZ
36 const wxString& name = wxDatePickerCtrlNameStr)
37 {
38 Init();
39
807f5038 40 (void)Create(parent, id, date, pos, size, style, validator, name);
7ae712f5 41 }
39df3acd
VZ
42
43 bool Create(wxWindow *parent,
2cfbeac8
VZ
44 wxWindowID id,
45 const wxDateTime& date = wxDefaultDateTime,
46 const wxPoint& pos = wxDefaultPosition,
47 const wxSize& size = wxDefaultSize,
48 long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
807f5038 49 const wxValidator& validator = wxDefaultValidator,
2cfbeac8 50 const wxString& name = wxDatePickerCtrlNameStr);
39df3acd 51
4b134bb2 52 // wxDatePickerCtrl methods
39df3acd
VZ
53 void SetValue(const wxDateTime& date);
54 wxDateTime GetValue() const;
4b134bb2 55
39df3acd
VZ
56 bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const;
57 void SetRange(const wxDateTime &dt1, const wxDateTime &dt2);
58
4b134bb2
VZ
59 bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime,
60 const wxDateTime& upperdate = wxDefaultDateTime);
61
62 // extra methods available only in this (generic) implementation
63 bool SetFormat(const wxChar *fmt);
64 wxCalendarCtrl *GetCalendar() const { return m_cal; }
39df3acd 65
39df3acd 66
4b134bb2
VZ
67 // implementation only from now on
68 // -------------------------------
39df3acd 69
4b134bb2
VZ
70 // overridden base class methods
71 virtual bool Destroy();
39df3acd 72
1721a8c0
VZ
73 virtual bool Enable(bool enable = true);
74 virtual bool Show(bool show = true);
39df3acd 75
4b134bb2 76protected:
39df3acd
VZ
77 virtual wxSize DoGetBestSize() const;
78 virtual void DoMoveWindow(int x, int y, int width, int height);
79
80private:
39df3acd 81 void Init();
77670008 82 void DropDown(bool down = true);
39df3acd 83
1721a8c0 84 void OnText(wxCommandEvent &event);
39df3acd
VZ
85 void OnEditKey(wxKeyEvent & event);
86 void OnCalKey(wxKeyEvent & event);
1721a8c0
VZ
87 void OnClick(wxCommandEvent &event);
88 void OnSelChange(wxCalendarEvent &event);
89 void OnSetFocus(wxFocusEvent &event);
90 void OnKillFocus(wxFocusEvent &event);
91 void OnChildSetFocus(wxChildFocusEvent &event);
18fefee7 92 void OnSize(wxSizeEvent& event);
39df3acd 93
77670008 94
1721a8c0 95 wxDatePopupInternal *m_popup;
77670008
VZ
96 wxTextCtrl *m_txt;
97 wxCalendarCtrl *m_cal;
98 wxButton *m_btn;
99 wxString m_format;
1721a8c0 100 wxDateTime m_currentDate;
77670008
VZ
101
102 bool m_dropped,
103 m_ignoreDrop;
104
105
39df3acd 106 DECLARE_EVENT_TABLE()
7ae712f5 107 DECLARE_NO_COPY_CLASS(wxDatePickerCtrlGeneric)
39df3acd
VZ
108};
109
110#endif // _WX_GENERIC_DATECTRL_H_
111