]>
git.saurik.com Git - wxWidgets.git/blob - src/palmos/datectrl.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/datectrl.cpp
3 // Purpose: wxDatePickerCtrl implementation
4 // Author: Wlodzimierz ABX Skiba
8 // Copyright: (c) Wlodzimierz Skiba
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 #include "wx/wxprec.h"
26 #if wxUSE_DATEPICKCTRL
28 #include "wx/datectrl.h"
35 #include "wx/dynlib.h"
37 #define _WX_DEFINE_DATE_EVENTS_
38 #include "wx/dateevt.h"
43 IMPLEMENT_DYNAMIC_CLASS(wxDatePickerCtrl
, wxControl
)
45 // ============================================================================
47 // ============================================================================
49 // ----------------------------------------------------------------------------
50 // wxDatePickerCtrl creation
51 // ----------------------------------------------------------------------------
53 bool wxDatePickerCtrl::Create(wxWindow
*parent
,
59 const wxValidator
& validator
,
62 if(!wxControl::Create(parent
, id
, pos
, size
, style
, validator
, name
))
69 label
= dt
.FormatDate();
73 if(!wxControl::PalmCreateControl(selectorTriggerCtl
, label
, pos
, size
))
79 // ----------------------------------------------------------------------------
80 // wxDatePickerCtrl geometry
81 // ----------------------------------------------------------------------------
83 wxSize
wxDatePickerCtrl::DoGetBestSize() const
88 // ----------------------------------------------------------------------------
89 // wxDatePickerCtrl operations
90 // ----------------------------------------------------------------------------
92 void wxDatePickerCtrl::SetValue(const wxDateTime
& dt
)
97 SetLabel(m_dt
.FormatDate());
100 wxDateTime
wxDatePickerCtrl::GetValue() const
105 void wxDatePickerCtrl::SetRange(const wxDateTime
& dt1
, const wxDateTime
& dt2
)
110 bool wxDatePickerCtrl::GetRange(wxDateTime
*dt1
, wxDateTime
*dt2
) const
116 // ----------------------------------------------------------------------------
118 // ----------------------------------------------------------------------------
120 bool wxDatePickerCtrl::SendClickEvent()
122 int16_t month
= (int16_t)m_dt
.GetMonth() + 1;
123 int16_t day
= m_dt
.GetDay();
124 int16_t year
= m_dt
.GetYear();
126 if(!SelectDay(selectDayByDay
,&month
,&day
,&year
,_T("Pick date")))
129 dt
.Set((wxDateTime::wxDateTime_t
)day
,
130 (wxDateTime::Month
)(month
-1),
136 #endif // wxUSE_DATEPICKCTRL