]> git.saurik.com Git - wxWidgets.git/blame - src/osx/datectrl_osx.cpp
Add missing WXK constants for the control keys
[wxWidgets.git] / src / osx / datectrl_osx.cpp
CommitLineData
fceac6bb
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: src/osx/datectrl_osx.cpp
3// Purpose: Implementation of wxDatePickerCtrl for OS X.
4// Author: Vadim Zeitlin
5// Created: 2011-12-18
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///////////////////////////////////////////////////////////////////////////////
10
11// ============================================================================
12// declarations
13// ============================================================================
14
15// ----------------------------------------------------------------------------
16// headers
17// ----------------------------------------------------------------------------
18
19// for compilers that support precompilation, includes "wx.h".
20#include "wx/wxprec.h"
21
22#ifdef __BORLANDC__
23 #pragma hdrstop
24#endif
25
26#if wxUSE_DATEPICKCTRL && wxOSX_USE_COCOA
27
28#include "wx/datectrl.h"
29#include "wx/dateevt.h"
30
31#include "wx/osx/core/private/datetimectrl.h"
32
33// ============================================================================
34// wxDatePickerCtrl implementation
35// ============================================================================
36
37wxIMPLEMENT_DYNAMIC_CLASS(wxDatePickerCtrl, wxControl);
38
39bool
40wxDatePickerCtrl::Create(wxWindow *parent,
41 wxWindowID id,
42 const wxDateTime& dt,
43 const wxPoint& pos,
44 const wxSize& size,
45 long style,
46 const wxValidator& validator,
47 const wxString& name)
48{
49 DontCreatePeer();
50
51 if ( !wxDatePickerCtrlBase::Create(parent, id, pos, size,
52 style, validator, name) )
53 return false;
54
55 wxOSXWidgetImpl* const peer = wxDateTimeWidgetImpl::CreateDateTimePicker
56 (
57 this,
58 dt,
59 pos,
60 size,
61 style,
62 wxDateTimeWidget_YearMonthDay
63 );
64 if ( !peer )
65 return false;
66
67 SetPeer(peer);
68
69 MacPostControlCreate(pos, size);
70
71 return true;
72}
73
74void wxDatePickerCtrl::SetRange(const wxDateTime& dt1, const wxDateTime& dt2)
75{
76 GetDateTimePeer()->SetDateRange(dt1, dt2);
77}
78
79bool wxDatePickerCtrl::GetRange(wxDateTime *dt1, wxDateTime *dt2) const
80{
81 return GetDateTimePeer()->GetDateRange(dt1, dt2);
82}
83
84void wxDatePickerCtrl::OSXGenerateEvent(const wxDateTime& dt)
85{
86 wxDateEvent event(this, dt, wxEVT_DATE_CHANGED);
87 HandleWindowEvent(event);
88}
89
90#endif // wxUSE_DATEPICKCTRL && wxOSX_USE_COCOA