1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: declares wxDateEvent class
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_DATEEVT_H_
12 #define _WX_DATEEVT_H_
15 #include "wx/datetime.h"
16 #include "wx/window.h"
18 // ----------------------------------------------------------------------------
19 // wxDateEvent: used by wxCalendarCtrl, wxDatePickerCtrl and wxTimePickerCtrl.
20 // ----------------------------------------------------------------------------
22 class WXDLLIMPEXP_ADV wxDateEvent
: public wxCommandEvent
26 wxDateEvent(wxWindow
*win
, const wxDateTime
& dt
, wxEventType type
)
27 : wxCommandEvent(type
, win
->GetId()),
33 const wxDateTime
& GetDate() const { return m_date
; }
34 void SetDate(const wxDateTime
&date
) { m_date
= date
; }
36 // default copy ctor, assignment operator and dtor are ok
37 virtual wxEvent
*Clone() const { return new wxDateEvent(*this); }
42 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDateEvent
)
45 // ----------------------------------------------------------------------------
46 // event types and macros for handling them
47 // ----------------------------------------------------------------------------
49 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_ADV
, wxEVT_DATE_CHANGED
, wxDateEvent
);
50 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_ADV
, wxEVT_TIME_CHANGED
, wxDateEvent
);
52 typedef void (wxEvtHandler::*wxDateEventFunction
)(wxDateEvent
&);
54 #define wxDateEventHandler(func) \
55 wxEVENT_HANDLER_CAST(wxDateEventFunction, func)
57 #define EVT_DATE_CHANGED(id, fn) \
58 wx__DECLARE_EVT1(wxEVT_DATE_CHANGED, id, wxDateEventHandler(fn))
60 #define EVT_TIME_CHANGED(id, fn) \
61 wx__DECLARE_EVT1(wxEVT_TIME_CHANGED, id, wxDateEventHandler(fn))
63 #endif // _WX_DATEEVT_H_