1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/datectrl_osx.cpp
3 // Purpose: Implementation of wxDatePickerCtrl for OS X.
4 // Author: Vadim Zeitlin
6 // Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
10 // ============================================================================
12 // ============================================================================
14 // ----------------------------------------------------------------------------
16 // ----------------------------------------------------------------------------
18 // for compilers that support precompilation, includes "wx.h".
19 #include "wx/wxprec.h"
25 #if wxUSE_DATEPICKCTRL && wxOSX_USE_COCOA
27 #include "wx/datectrl.h"
28 #include "wx/dateevt.h"
30 #include "wx/osx/core/private/datetimectrl.h"
32 // ============================================================================
33 // wxDatePickerCtrl implementation
34 // ============================================================================
36 wxIMPLEMENT_DYNAMIC_CLASS(wxDatePickerCtrl
, wxControl
);
39 wxDatePickerCtrl::Create(wxWindow
*parent
,
45 const wxValidator
& validator
,
50 if ( !wxDatePickerCtrlBase::Create(parent
, id
, pos
, size
,
51 style
, validator
, name
) )
54 wxOSXWidgetImpl
* const peer
= wxDateTimeWidgetImpl::CreateDateTimePicker
61 wxDateTimeWidget_YearMonthDay
68 MacPostControlCreate(pos
, size
);
73 void wxDatePickerCtrl::SetRange(const wxDateTime
& dt1
, const wxDateTime
& dt2
)
75 GetDateTimePeer()->SetDateRange(dt1
, dt2
);
78 bool wxDatePickerCtrl::GetRange(wxDateTime
*dt1
, wxDateTime
*dt2
) const
80 return GetDateTimePeer()->GetDateRange(dt1
, dt2
);
83 void wxDatePickerCtrl::OSXGenerateEvent(const wxDateTime
& dt
)
85 wxDateEvent
event(this, dt
, wxEVT_DATE_CHANGED
);
86 HandleWindowEvent(event
);
89 #endif // wxUSE_DATEPICKCTRL && wxOSX_USE_COCOA