]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/src/_datectrl.i
fixed deadlock when calling wxPostEvent() from worker thread
[wxWidgets.git] / wxPython / src / _datectrl.i
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: _datectrl.i
3// Purpose: SWIG interface defs for wxwxDatePickerCtrl
4//
5// Author: Robin Dunn
6//
7// Created: 15-Feb-2005
8// RCS-ID: $Id$
9// Copyright: (c) 2005 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13// Not a %module
14
15
16//---------------------------------------------------------------------------
17
18MAKE_CONST_WXSTRING(DatePickerCtrlNameStr);
19
20//---------------------------------------------------------------------------
21%newgroup
22
23DocStr(wxDatePickerCtrl,
24"This control allows the user to select a date. Unlike
25`wx.calendar.CalendarCtrl`, which is a relatively big control,
26`wx.DatePickerCtrl` is implemented as a small window showing the
27currently selected date. The control can be edited using the keyboard,
28and can also display a popup window for more user-friendly date
29selection, depending on the styles used and the platform.", "
30
31Styles
32------
33 ================= ======================================================
34 wx.DP_SPIN Creates a control without month calendar drop down but
35 with spin control-like arrows to change individual
36 date components. This style is not supported by the
37 generic version.
38
39 wx.DP_DROPDOWN Creates a control with a month calendar drop down
40 part from which the user can select a date.
41
42 wx.DP_DEFAULT Creates a control with default style which is the
43 best supported for the current platform
44 (currently wx.DP_SPIN under Windows and
45 wx.DP_DROPDOWN elsewhere).
46
47 wx.DP_ALLOWNONE With this style, the control allows the user to not
48 enter any valid date at all. Without it -- which
49 is by default -- the control always has some
50 valid date.
51
52 wx.DP_SHOWCENTURY Forces display of the century in the default
53 date format. Without this flas the century
54 could be displayed or not depending on the
55 default date representation in the system.
56 ================= ======================================================
57
58Events
59------
60
61 ================= ======================================================
62 EVT_DATE_CHANGED This event fires when the user changes the current
63 selection in the control.
64 ================= ======================================================
65
66:see: `wx.calendar.CalendarCtrl`, `wx.DateEvent`
67");
68
69
70
71
72enum
73{
74 wxDP_DEFAULT = 0,
75 wxDP_SPIN = 1,
76 wxDP_DROPDOWN = 2,
77 wxDP_SHOWCENTURY = 4,
78 wxDP_ALLOWNONE = 8
79};
80
81
82MustHaveApp(wxDatePickerCtrl);
83
84class wxDatePickerCtrl : public wxControl
85{
86public:
87 %pythonAppend wxDatePickerCtrl "self._setOORInfo(self)";
88 %pythonAppend wxDatePickerCtrl() "";
89
90 DocCtorStr(
91 wxDatePickerCtrl(wxWindow *parent,
92 wxWindowID id=-1,
93 const wxDateTime& dt = wxDefaultDateTime,
94 const wxPoint& pos = wxDefaultPosition,
95 const wxSize& size = wxDefaultSize,
96 long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
97 const wxValidator& validator = wxDefaultValidator,
98 const wxString& name = wxPyDatePickerCtrlNameStr),
99 "Create a new DatePickerCtrl.", "");
100
101
102 DocCtorStrName(
103 wxDatePickerCtrl(),
104 "Precreate a DatePickerCtrl for use in 2-phase creation.", "",
105 PreDatePickerCtrl);
106
107
108 DocDeclStr(
109 bool , Create(wxWindow *parent,
110 wxWindowID id=-1,
111 const wxDateTime& dt = wxDefaultDateTime,
112 const wxPoint& pos = wxDefaultPosition,
113 const wxSize& size = wxDefaultSize,
114 long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
115 const wxValidator& validator = wxDefaultValidator,
116 const wxString& name = wxPyDatePickerCtrlNameStr),
117 "Create the GUI parts of the DatePickerCtrl, for use in 2-phase
118creation.", "");
119
120
121
122 DocDeclStr(
123 virtual void , SetValue(const wxDateTime& dt),
124 "Changes the current value of the control. The date should be valid and
125included in the currently selected range, if any.
126
127Calling this method does not result in a date change event.", "");
128
129 DocDeclStr(
130 virtual wxDateTime , GetValue() const,
131 "Returns the currently selected date. If there is no selection or the
132selection is outside of the current range, an invalid `wx.DateTime`
133object is returned.", "");
134
135
136 DocDeclStr(
137 virtual void , SetRange(const wxDateTime& dt1, const wxDateTime& dt2),
138 "Sets the valid range for the date selection. If dt1 is valid, it
139becomes the earliest date (inclusive) accepted by the control. If dt2
140is valid, it becomes the latest possible date.
141
142If the current value of the control is outside of the newly set range
143bounds, the behaviour is undefined.", "");
144
145 // virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const;
146
147 %extend {
148 DocStr(
149 GetLowerLimit,
150 "Get the lower limit of the valid range for the date selection, if any.
151If there is no range or there is no lower limit, then the
152`wx.DateTime` value returned will be invalid.", "");
153 wxDateTime GetLowerLimit() {
154 wxDateTime rv;
155 self->GetRange(&rv, NULL);
156 return rv;
157 }
158
159
160 DocStr(
161 GetUpperLimit,
162 "Get the upper limit of the valid range for the date selection, if any.
163If there is no range or there is no upper limit, then the
164`wx.DateTime` value returned will be invalid.", "");
165 wxDateTime GetUpperLimit() {
166 wxDateTime rv;
167 self->GetRange(NULL, &rv);
168 return rv;
169 }
170 }
171
172 %property(LowerLimit, GetLowerLimit, doc="See `GetLowerLimit`");
173 %property(UpperLimit, GetUpperLimit, doc="See `GetUpperLimit`");
174 %property(Value, GetValue, SetValue, doc="See `GetValue` and `SetValue`");
175};
176
177
178
179
180//---------------------------------------------------------------------------
181
182