]> git.saurik.com Git - wxWidgets.git/blame - include/wx/dateevt.h
Don't define __STRICT_ANSI__, we should build both with and without it.
[wxWidgets.git] / include / wx / dateevt.h
CommitLineData
feb72429
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/dateevt.h
3// Purpose: declares wxDateEvent class
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 2005-01-10
feb72429
VZ
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"
f1781e98 16#include "wx/window.h"
feb72429
VZ
17
18// ----------------------------------------------------------------------------
569c7d8c 19// wxDateEvent: used by wxCalendarCtrl, wxDatePickerCtrl and wxTimePickerCtrl.
feb72429
VZ
20// ----------------------------------------------------------------------------
21
22class WXDLLIMPEXP_ADV wxDateEvent : public wxCommandEvent
23{
24public:
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
258b2ca6
RD
36 // default copy ctor, assignment operator and dtor are ok
37 virtual wxEvent *Clone() const { return new wxDateEvent(*this); }
38
feb72429
VZ
39private:
40 wxDateTime m_date;
41
258b2ca6 42 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDateEvent)
feb72429
VZ
43};
44
45// ----------------------------------------------------------------------------
46// event types and macros for handling them
47// ----------------------------------------------------------------------------
48
9b11752c 49wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_ADV, wxEVT_DATE_CHANGED, wxDateEvent);
569c7d8c 50wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_ADV, wxEVT_TIME_CHANGED, wxDateEvent);
feb72429
VZ
51
52typedef void (wxEvtHandler::*wxDateEventFunction)(wxDateEvent&);
53
7fa03f04 54#define wxDateEventHandler(func) \
3c778901 55 wxEVENT_HANDLER_CAST(wxDateEventFunction, func)
7fa03f04
VZ
56
57#define EVT_DATE_CHANGED(id, fn) \
58 wx__DECLARE_EVT1(wxEVT_DATE_CHANGED, id, wxDateEventHandler(fn))
feb72429 59
569c7d8c
VZ
60#define EVT_TIME_CHANGED(id, fn) \
61 wx__DECLARE_EVT1(wxEVT_TIME_CHANGED, id, wxDateEventHandler(fn))
62
feb72429
VZ
63#endif // _WX_DATEEVT_H_
64