1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/datectrl_osx.cpp
3 // Purpose: Implementation of wxDatePickerCtrl for OS X.
4 // Author: Vadim Zeitlin
6 // RCS-ID: $Id: wxhead.cpp,v 1.11 2010-04-22 12:44:51 zeitlin Exp $
7 // Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 // ============================================================================
13 // ============================================================================
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 // for compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
26 #if wxUSE_DATEPICKCTRL && wxOSX_USE_COCOA
28 #include "wx/datectrl.h"
29 #include "wx/dateevt.h"
31 #include "wx/osx/core/private/datetimectrl.h"
33 // ============================================================================
34 // wxDatePickerCtrl implementation
35 // ============================================================================
37 wxIMPLEMENT_DYNAMIC_CLASS(wxDatePickerCtrl
, wxControl
);
40 wxDatePickerCtrl::Create(wxWindow
*parent
,
46 const wxValidator
& validator
,
51 if ( !wxDatePickerCtrlBase::Create(parent
, id
, pos
, size
,
52 style
, validator
, name
) )
55 wxOSXWidgetImpl
* const peer
= wxDateTimeWidgetImpl::CreateDateTimePicker
62 wxDateTimeWidget_YearMonthDay
69 MacPostControlCreate(pos
, size
);
74 void wxDatePickerCtrl::SetRange(const wxDateTime
& dt1
, const wxDateTime
& dt2
)
76 GetDateTimePeer()->SetDateRange(dt1
, dt2
);
79 bool wxDatePickerCtrl::GetRange(wxDateTime
*dt1
, wxDateTime
*dt2
) const
81 return GetDateTimePeer()->GetDateRange(dt1
, dt2
);
84 void wxDatePickerCtrl::OSXGenerateEvent(const wxDateTime
& dt
)
86 wxDateEvent
event(this, dt
, wxEVT_DATE_CHANGED
);
87 HandleWindowEvent(event
);
90 #endif // wxUSE_DATEPICKCTRL && wxOSX_USE_COCOA