]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/datectrl.cpp
Italian translation corrections from Roberto Boriotti.
[wxWidgets.git] / src / palmos / datectrl.cpp
CommitLineData
324eeecb
WS
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/palmos/datectrl.cpp
3// Purpose: wxDatePickerCtrl implementation
4// Author: Wlodzimierz ABX Skiba
5// Modified by:
6// Created: 02/14/05
7// RCS-ID: $Id$
8// Copyright: (c) Wlodzimierz Skiba
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
20#include "wx/wxprec.h"
21
22#ifdef __BORLANDC__
23 #pragma hdrstop
24#endif
25
324eeecb
WS
26#if wxUSE_DATEPICKCTRL
27
28#include "wx/datectrl.h"
88a7a4e1
WS
29
30#ifndef WX_PRECOMP
31 #include "wx/intl.h"
670f9935 32 #include "wx/app.h"
88a7a4e1
WS
33#endif
34
324eeecb
WS
35#include "wx/dynlib.h"
36
324eeecb
WS
37#include "wx/dateevt.h"
38
20bc5ad8
WS
39#include <Control.h>
40#include <SelDay.h>
41
a69e2a0a
VZ
42IMPLEMENT_DYNAMIC_CLASS(wxDatePickerCtrl, wxControl)
43
324eeecb
WS
44// ============================================================================
45// implementation
46// ============================================================================
47
48// ----------------------------------------------------------------------------
49// wxDatePickerCtrl creation
50// ----------------------------------------------------------------------------
51
52bool wxDatePickerCtrl::Create(wxWindow *parent,
53 wxWindowID id,
54 const wxDateTime& dt,
55 const wxPoint& pos,
56 const wxSize& size,
57 long style,
58 const wxValidator& validator,
59 const wxString& name)
60{
61 if(!wxControl::Create(parent, id, pos, size, style, validator, name))
62 return false;
63
64 wxString label;
65
66 if ( dt.IsValid() )
60582201 67 {
6a27c749 68 label = dt.FormatDate();
60582201
WS
69 m_dt = dt;
70 }
324eeecb 71
6a27c749 72 if(!wxControl::PalmCreateControl(selectorTriggerCtl, label, pos, size))
324eeecb
WS
73 return false;
74
75 return true;
76}
77
78// ----------------------------------------------------------------------------
79// wxDatePickerCtrl geometry
80// ----------------------------------------------------------------------------
81
82wxSize wxDatePickerCtrl::DoGetBestSize() const
83{
6a27c749 84 return wxSize(16,16);
324eeecb
WS
85}
86
87// ----------------------------------------------------------------------------
88// wxDatePickerCtrl operations
89// ----------------------------------------------------------------------------
90
91void wxDatePickerCtrl::SetValue(const wxDateTime& dt)
92{
6a27c749 93 if ( dt.IsValid() )
60582201
WS
94 m_dt = dt;
95
96 SetLabel(m_dt.FormatDate());
324eeecb
WS
97}
98
99wxDateTime wxDatePickerCtrl::GetValue() const
100{
60582201 101 return m_dt;
324eeecb
WS
102}
103
104void wxDatePickerCtrl::SetRange(const wxDateTime& dt1, const wxDateTime& dt2)
105{
106 // TODO
107}
108
109bool wxDatePickerCtrl::GetRange(wxDateTime *dt1, wxDateTime *dt2) const
110{
111 // TODO
112 return false;
113}
114
6a27c749
WS
115// ----------------------------------------------------------------------------
116// helpers
117// ----------------------------------------------------------------------------
118
119bool wxDatePickerCtrl::SendClickEvent()
120{
df57c15c 121 int16_t month = (int16_t)m_dt.GetMonth() + 1;
60582201
WS
122 int16_t day = m_dt.GetDay();
123 int16_t year = m_dt.GetYear();
6a27c749 124
9a83f860 125 //if(!SelectDay(selectDayByDay,&month,&day,&year,wxT("Pick date")))
e2fc40b4 126 if(!SelectDay(selectDayByDay,&month,&day,&year, "Pick date"))
60582201
WS
127 return false;
128 wxDateTime dt(m_dt);
df57c15c
WS
129 dt.Set((wxDateTime::wxDateTime_t)day,
130 (wxDateTime::Month)(month-1),
131 (int)year);
60582201
WS
132 SetValue(dt);
133 return true;
6a27c749
WS
134}
135
324eeecb 136#endif // wxUSE_DATEPICKCTRL