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