added support for several new events in wxCalendarCtrl: clicking on week

days in the header, double clicking


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5153 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-12-30 18:21:42 +00:00
parent 13111b2ac8
commit 0185cd0978
5 changed files with 148 additions and 38 deletions

View File

@@ -12,6 +12,22 @@
#ifndef _WX_CALCTRL_H
#define _WX_CALCTRL_H
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// return values for the HitTest() method
enum wxCalendarHitTestResult
{
wxCAL_HITTEST_NOWHERE, // outside of anything
wxCAL_HITTEST_HEADER, // on the header (weekdays)
wxCAL_HITTEST_DAY // on a day in the calendar
};
// ----------------------------------------------------------------------------
// wxCalendarCtrl
// ----------------------------------------------------------------------------
// so far we only have a generic version, so keep it simple
#include "wx/generic/calctrl.h"
@@ -21,19 +37,27 @@
class WXDLLEXPORT wxCalendarEvent : public wxCommandEvent
{
friend class wxCalendarCtrl;
public:
wxCalendarEvent() { }
wxCalendarEvent() { Init(); }
wxCalendarEvent(wxCalendarCtrl *cal, wxEventType type);
const wxDateTime& GetDate() const { return m_date; }
wxDateTime::WeekDay GetWeekDay() const { return m_wday; }
protected:
void Init();
private:
wxDateTime m_date;
wxDateTime::WeekDay m_wday;
};
#define EVT_CALENDAR(id, fn) { wxEVT_CALENDAR_SEL_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL },
#define EVT_CALENDAR(id, fn) { wxEVT_CALENDAR_DOUBLECLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL },
#define EVT_CALENDAR_SEL_CHANGED(id, fn) { wxEVT_CALENDAR_SEL_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL },
#define EVT_CALENDAR_DAY(id, fn) { wxEVT_CALENDAR_DAY_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL },
#define EVT_CALENDAR_MONTH(id, fn) { wxEVT_CALENDAR_MONTH_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL },
#define EVT_CALENDAR_YEAR(id, fn) { wxEVT_CALENDAR_YEAR_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL },
#define EVT_CALENDAR_WEEKDAY_CLICKED(id, fn) { wxEVT_CALENDAR_WEEKDAY_CLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL },
#endif // _WX_CALCTRL_H