]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dateevt.h
Don't define __STRICT_ANSI__, we should build both with and without it.
[wxWidgets.git] / include / wx / dateevt.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/dateevt.h
3 // Purpose: declares wxDateEvent class
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 2005-01-10
7 // Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_DATEEVT_H_
12 #define _WX_DATEEVT_H_
13
14 #include "wx/event.h"
15 #include "wx/datetime.h"
16 #include "wx/window.h"
17
18 // ----------------------------------------------------------------------------
19 // wxDateEvent: used by wxCalendarCtrl, wxDatePickerCtrl and wxTimePickerCtrl.
20 // ----------------------------------------------------------------------------
21
22 class WXDLLIMPEXP_ADV wxDateEvent : public wxCommandEvent
23 {
24 public:
25 wxDateEvent() { }
26 wxDateEvent(wxWindow *win, const wxDateTime& dt, wxEventType type)
27 : wxCommandEvent(type, win->GetId()),
28 m_date(dt)
29 {
30 SetEventObject(win);
31 }
32
33 const wxDateTime& GetDate() const { return m_date; }
34 void SetDate(const wxDateTime &date) { m_date = date; }
35
36 // default copy ctor, assignment operator and dtor are ok
37 virtual wxEvent *Clone() const { return new wxDateEvent(*this); }
38
39 private:
40 wxDateTime m_date;
41
42 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDateEvent)
43 };
44
45 // ----------------------------------------------------------------------------
46 // event types and macros for handling them
47 // ----------------------------------------------------------------------------
48
49 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_ADV, wxEVT_DATE_CHANGED, wxDateEvent);
50 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_ADV, wxEVT_TIME_CHANGED, wxDateEvent);
51
52 typedef void (wxEvtHandler::*wxDateEventFunction)(wxDateEvent&);
53
54 #define wxDateEventHandler(func) \
55 wxEVENT_HANDLER_CAST(wxDateEventFunction, func)
56
57 #define EVT_DATE_CHANGED(id, fn) \
58 wx__DECLARE_EVT1(wxEVT_DATE_CHANGED, id, wxDateEventHandler(fn))
59
60 #define EVT_TIME_CHANGED(id, fn) \
61 wx__DECLARE_EVT1(wxEVT_TIME_CHANGED, id, wxDateEventHandler(fn))
62
63 #endif // _WX_DATEEVT_H_
64