]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dateevt.h
added API, docs and Win32 implementation of wxDatePickerCtrl
[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 // RCS-ID: $Id$
8 // Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_DATEEVT_H_
13 #define _WX_DATEEVT_H_
14
15 #include "wx/event.h"
16 #include "wx/datetime.h"
17
18 // ----------------------------------------------------------------------------
19 // wxDateEvent: used by wxCalendarCtrl and wxDatePickerCtrl
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 private:
37 wxDateTime m_date;
38
39 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDateEvent)
40 };
41
42 // ----------------------------------------------------------------------------
43 // event types and macros for handling them
44 // ----------------------------------------------------------------------------
45
46 BEGIN_DECLARE_EVENT_TYPES()
47 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_DATE_CHANGED, 1101)
48 END_DECLARE_EVENT_TYPES()
49
50 typedef void (wxEvtHandler::*wxDateEventFunction)(wxDateEvent&);
51
52 #define EVT_DATE_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_DATE_CHANGED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) wxStaticCastEvent( wxDateEventFunction, & fn ), (wxObject *) NULL),
53
54 #ifdef _WX_DEFINE_DATE_EVENTS_
55 DEFINE_EVENT_TYPE(wxEVT_DATE_CHANGED)
56
57 IMPLEMENT_DYNAMIC_CLASS(wxDateEvent, wxCommandEvent)
58 #endif
59
60 #endif // _WX_DATEEVT_H_
61