]> git.saurik.com Git - wxWidgets.git/blame - include/wx/dateevt.h
Allow associating a validator with wxGridCellTextEditor.
[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
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"
f1781e98 17#include "wx/window.h"
feb72429
VZ
18
19// ----------------------------------------------------------------------------
569c7d8c 20// wxDateEvent: used by wxCalendarCtrl, wxDatePickerCtrl and wxTimePickerCtrl.
feb72429
VZ
21// ----------------------------------------------------------------------------
22
23class WXDLLIMPEXP_ADV wxDateEvent : public wxCommandEvent
24{
25public:
26 wxDateEvent() { }
27 wxDateEvent(wxWindow *win, const wxDateTime& dt, wxEventType type)
28 : wxCommandEvent(type, win->GetId()),
29 m_date(dt)
30 {
31 SetEventObject(win);
32 }
33
34 const wxDateTime& GetDate() const { return m_date; }
35 void SetDate(const wxDateTime &date) { m_date = date; }
36
258b2ca6
RD
37 // default copy ctor, assignment operator and dtor are ok
38 virtual wxEvent *Clone() const { return new wxDateEvent(*this); }
39
feb72429
VZ
40private:
41 wxDateTime m_date;
42
258b2ca6 43 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDateEvent)
feb72429
VZ
44};
45
46// ----------------------------------------------------------------------------
47// event types and macros for handling them
48// ----------------------------------------------------------------------------
49
9b11752c 50wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_ADV, wxEVT_DATE_CHANGED, wxDateEvent);
569c7d8c 51wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_ADV, wxEVT_TIME_CHANGED, wxDateEvent);
feb72429
VZ
52
53typedef void (wxEvtHandler::*wxDateEventFunction)(wxDateEvent&);
54
7fa03f04 55#define wxDateEventHandler(func) \
3c778901 56 wxEVENT_HANDLER_CAST(wxDateEventFunction, func)
7fa03f04
VZ
57
58#define EVT_DATE_CHANGED(id, fn) \
59 wx__DECLARE_EVT1(wxEVT_DATE_CHANGED, id, wxDateEventHandler(fn))
feb72429 60
569c7d8c
VZ
61#define EVT_TIME_CHANGED(id, fn) \
62 wx__DECLARE_EVT1(wxEVT_TIME_CHANGED, id, wxDateEventHandler(fn))
63
feb72429
VZ
64#endif // _WX_DATEEVT_H_
65