1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: declares wxDateEvent class
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_DATEEVT_H_
13 #define _WX_DATEEVT_H_
16 #include "wx/datetime.h"
17 #include "wx/window.h"
19 // ----------------------------------------------------------------------------
20 // wxDateEvent: used by wxCalendarCtrl, wxDatePickerCtrl and wxTimePickerCtrl.
21 // ----------------------------------------------------------------------------
23 class WXDLLIMPEXP_ADV wxDateEvent
: public wxCommandEvent
27 wxDateEvent(wxWindow
*win
, const wxDateTime
& dt
, wxEventType type
)
28 : wxCommandEvent(type
, win
->GetId()),
34 const wxDateTime
& GetDate() const { return m_date
; }
35 void SetDate(const wxDateTime
&date
) { m_date
= date
; }
37 // default copy ctor, assignment operator and dtor are ok
38 virtual wxEvent
*Clone() const { return new wxDateEvent(*this); }
43 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDateEvent
)
46 // ----------------------------------------------------------------------------
47 // event types and macros for handling them
48 // ----------------------------------------------------------------------------
50 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_ADV
, wxEVT_DATE_CHANGED
, wxDateEvent
);
51 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_ADV
, wxEVT_TIME_CHANGED
, wxDateEvent
);
53 typedef void (wxEvtHandler::*wxDateEventFunction
)(wxDateEvent
&);
55 #define wxDateEventHandler(func) \
56 wxEVENT_HANDLER_CAST(wxDateEventFunction, func)
58 #define EVT_DATE_CHANGED(id, fn) \
59 wx__DECLARE_EVT1(wxEVT_DATE_CHANGED, id, wxDateEventHandler(fn))
61 #define EVT_TIME_CHANGED(id, fn) \
62 wx__DECLARE_EVT1(wxEVT_TIME_CHANGED, id, wxDateEventHandler(fn))
64 #endif // _WX_DATEEVT_H_