]> git.saurik.com Git - wxWidgets.git/blame - src/osx/timectrl_osx.cpp
Fix for #15520: wxRichTextCtrl: Drawing the selection doesn't respect its container...
[wxWidgets.git] / src / osx / timectrl_osx.cpp
CommitLineData
fceac6bb
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: src/osx/timectrl_osx.cpp
3// Purpose: Implementation of wxTimePickerCtrl 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_TIMEPICKCTRL && wxOSX_USE_COCOA
26
27#include "wx/timectrl.h"
28#include "wx/dateevt.h"
29
30#include "wx/osx/core/private/datetimectrl.h"
31
32// ============================================================================
33// wxTimePickerCtrl implementation
34// ============================================================================
35
36wxIMPLEMENT_DYNAMIC_CLASS(wxTimePickerCtrl, wxControl);
37
38bool
39wxTimePickerCtrl::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 ( !wxTimePickerCtrlBase::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_HourMinuteSecond
62 );
63 if ( !peer )
64 return false;
65
66 SetPeer(peer);
67
68 MacPostControlCreate(pos, size);
69
70 return true;
71}
72
73void wxTimePickerCtrl::OSXGenerateEvent(const wxDateTime& dt)
74{
75 wxDateEvent event(this, dt, wxEVT_TIME_CHANGED);
76 HandleWindowEvent(event);
77}
78
79#endif // wxUSE_TIMEPICKCTRL && wxOSX_USE_COCOA