added support for several new events in wxCalendarCtrl: clicking on week
[wxWidgets.git] / include / wx / calctrl.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/calctrl.h
3 // Purpose: date-picker control
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 29.12.99
7 // RCS-ID: $Id$
8 // Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows license
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_CALCTRL_H
13 #define _WX_CALCTRL_H
14
15 // ----------------------------------------------------------------------------
16 // constants
17 // ----------------------------------------------------------------------------
18
19 // return values for the HitTest() method
20 enum wxCalendarHitTestResult
21 {
22 wxCAL_HITTEST_NOWHERE, // outside of anything
23 wxCAL_HITTEST_HEADER, // on the header (weekdays)
24 wxCAL_HITTEST_DAY // on a day in the calendar
25 };
26
27 // ----------------------------------------------------------------------------
28 // wxCalendarCtrl
29 // ----------------------------------------------------------------------------
30
31 // so far we only have a generic version, so keep it simple
32 #include "wx/generic/calctrl.h"
33
34 // ----------------------------------------------------------------------------
35 // wxCalendarCtrl events
36 // ----------------------------------------------------------------------------
37
38 class WXDLLEXPORT wxCalendarEvent : public wxCommandEvent
39 {
40 friend class wxCalendarCtrl;
41 public:
42 wxCalendarEvent() { Init(); }
43 wxCalendarEvent(wxCalendarCtrl *cal, wxEventType type);
44
45 const wxDateTime& GetDate() const { return m_date; }
46 wxDateTime::WeekDay GetWeekDay() const { return m_wday; }
47
48 protected:
49 void Init();
50
51 private:
52 wxDateTime m_date;
53 wxDateTime::WeekDay m_wday;
54 };
55
56 #define EVT_CALENDAR(id, fn) { wxEVT_CALENDAR_DOUBLECLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL },
57 #define EVT_CALENDAR_SEL_CHANGED(id, fn) { wxEVT_CALENDAR_SEL_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL },
58 #define EVT_CALENDAR_DAY(id, fn) { wxEVT_CALENDAR_DAY_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL },
59 #define EVT_CALENDAR_MONTH(id, fn) { wxEVT_CALENDAR_MONTH_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL },
60 #define EVT_CALENDAR_YEAR(id, fn) { wxEVT_CALENDAR_YEAR_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL },
61 #define EVT_CALENDAR_WEEKDAY_CLICKED(id, fn) { wxEVT_CALENDAR_WEEKDAY_CLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL },
62
63 #endif // _WX_CALCTRL_H