~brian-sidebotham/wxwidgets-cmake/wxpython-2.9.4

« back to all changes in this revision

Viewing changes to wxPython/src/_datectrl.i

  • Committer: Brian Sidebotham
  • Date: 2013-08-03 14:30:08 UTC
  • Revision ID: brian.sidebotham@gmail.com-20130803143008-c7806tkych1tp6fc
Initial import into Bazaar

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/////////////////////////////////////////////////////////////////////////////
 
2
// Name:        _datectrl.i
 
3
// Purpose:     SWIG interface defs for wxDatePickerCtrl
 
4
//
 
5
// Author:      Robin Dunn
 
6
//
 
7
// Created:     15-Feb-2005
 
8
// RCS-ID:      $Id: _datectrl.i 70172 2011-12-29 21:07:42Z RD $
 
9
// Copyright:   (c) 2005 by Total Control Software
 
10
// Licence:     wxWindows license
 
11
/////////////////////////////////////////////////////////////////////////////
 
12
 
 
13
// Not a %module
 
14
 
 
15
 
 
16
//---------------------------------------------------------------------------
 
17
 
 
18
MAKE_CONST_WXSTRING(DatePickerCtrlNameStr);
 
19
 
 
20
//---------------------------------------------------------------------------
 
21
%newgroup
 
22
 
 
23
DocStr(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
 
27
currently selected date. The control can be edited using the keyboard,
 
28
and can also display a popup window for more user-friendly date
 
29
selection, depending on the styles used and the platform.", "
 
30
 
 
31
Styles
 
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 flag the century
 
54
                       could be displayed or not depending on the
 
55
                       default date representation in the system.
 
56
    =================  ======================================================
 
57
 
 
58
Events
 
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
 
 
72
enum
 
73
{
 
74
    wxDP_DEFAULT = 0,
 
75
    wxDP_SPIN = 1,
 
76
    wxDP_DROPDOWN = 2,
 
77
    wxDP_SHOWCENTURY = 4,
 
78
    wxDP_ALLOWNONE = 8
 
79
};
 
80
 
 
81
 
 
82
MustHaveApp(wxDatePickerCtrl);
 
83
 
 
84
class wxDatePickerCtrlBase : public wxControl
 
85
{
 
86
public:
 
87
    // ****  ABC
 
88
 
 
89
    DocDeclStr(
 
90
        virtual void , SetValue(const wxDateTime& dt),
 
91
        "Changes the current value of the control. The date should be valid and
 
92
included in the currently selected range, if any.
 
93
 
 
94
Calling this method does not result in a date change event.", "");
 
95
    
 
96
    DocDeclStr(
 
97
        virtual wxDateTime , GetValue() const,
 
98
        "Returns the currently selected date. If there is no selection or the
 
99
selection is outside of the current range, an invalid `wx.DateTime`
 
100
object is returned.", "");
 
101
    
 
102
 
 
103
    DocDeclStr(
 
104
        virtual void , SetRange(const wxDateTime& dt1, const wxDateTime& dt2),
 
105
        "Sets the valid range for the date selection. If dt1 is valid, it
 
106
becomes the earliest date (inclusive) accepted by the control. If dt2
 
107
is valid, it becomes the latest possible date.
 
108
 
 
109
If the current value of the control is outside of the newly set range
 
110
bounds, the behaviour is undefined.", "");
 
111
    
 
112
    // virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const;
 
113
 
 
114
    %extend {
 
115
        DocStr(
 
116
            GetLowerLimit,
 
117
            "Get the lower limit of the valid range for the date selection, if any.
 
118
If there is no range or there is no lower limit, then the
 
119
`wx.DateTime` value returned will be invalid.", "");
 
120
        wxDateTime GetLowerLimit() {
 
121
            wxDateTime rv;
 
122
            self->GetRange(&rv, NULL);
 
123
            return rv;
 
124
        }
 
125
 
 
126
        
 
127
        DocStr(
 
128
            GetUpperLimit,
 
129
            "Get the upper limit of the valid range for the date selection, if any.
 
130
If there is no range or there is no upper limit, then the
 
131
`wx.DateTime` value returned will be invalid.", "");
 
132
        wxDateTime GetUpperLimit() {
 
133
            wxDateTime rv;
 
134
            self->GetRange(NULL, &rv);
 
135
            return rv;
 
136
        }
 
137
    }
 
138
    
 
139
    %property(LowerLimit, GetLowerLimit, doc="See `GetLowerLimit`");
 
140
    %property(UpperLimit, GetUpperLimit, doc="See `GetUpperLimit`");
 
141
    %property(Value, GetValue, SetValue, doc="See `GetValue` and `SetValue`");
 
142
};
 
143
 
 
144
 
 
145
class wxDatePickerCtrl : public wxDatePickerCtrlBase
 
146
{
 
147
public:
 
148
    %pythonAppend wxDatePickerCtrl         "self._setOORInfo(self)";
 
149
    %pythonAppend wxDatePickerCtrl()       "";
 
150
 
 
151
    DocCtorStr(
 
152
        wxDatePickerCtrl(wxWindow *parent,
 
153
                         wxWindowID id=-1,
 
154
                         const wxDateTime& dt = wxDefaultDateTime,
 
155
                         const wxPoint& pos = wxDefaultPosition,
 
156
                         const wxSize& size = wxDefaultSize,
 
157
                         long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
 
158
                         const wxValidator& validator = wxDefaultValidator,
 
159
                         const wxString& name = wxPyDatePickerCtrlNameStr),
 
160
        "Create a new DatePickerCtrl.", "");
 
161
 
 
162
    
 
163
    DocCtorStrName(
 
164
        wxDatePickerCtrl(),
 
165
        "Precreate a DatePickerCtrl for use in 2-phase creation.", "",
 
166
        PreDatePickerCtrl);
 
167
    
 
168
 
 
169
    DocDeclStr(
 
170
        bool , Create(wxWindow *parent,
 
171
                      wxWindowID id=-1,
 
172
                      const wxDateTime& dt = wxDefaultDateTime,
 
173
                      const wxPoint& pos = wxDefaultPosition,
 
174
                      const wxSize& size = wxDefaultSize,
 
175
                      long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
 
176
                      const wxValidator& validator = wxDefaultValidator,
 
177
                      const wxString& name = wxPyDatePickerCtrlNameStr),
 
178
        "Create the GUI parts of the DatePickerCtrl, for use in 2-phase
 
179
creation.", "");
 
180
    
 
181
};
 
182
 
 
183
 
 
184
 
 
185
MustHaveApp(wxDatePickerCtrlGeneric);
 
186
 
 
187
%rename(GenericDatePickerCtrl) wxDatePickerCtrlGeneric;
 
188
 
 
189
class wxDatePickerCtrlGeneric : public wxDatePickerCtrlBase
 
190
{
 
191
public:
 
192
    %pythonAppend wxDatePickerCtrlGeneric         "self._setOORInfo(self)";
 
193
    %pythonAppend wxDatePickerCtrlGeneric()       "";
 
194
 
 
195
    DocCtorStr(
 
196
        wxDatePickerCtrlGeneric(wxWindow *parent,
 
197
                         wxWindowID id=-1,
 
198
                         const wxDateTime& dt = wxDefaultDateTime,
 
199
                         const wxPoint& pos = wxDefaultPosition,
 
200
                         const wxSize& size = wxDefaultSize,
 
201
                         long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
 
202
                         const wxValidator& validator = wxDefaultValidator,
 
203
                         const wxString& name = wxPyDatePickerCtrlNameStr),
 
204
        "Create a new GenericDatePickerCtrl.", "");
 
205
 
 
206
    
 
207
    DocCtorStrName(
 
208
        wxDatePickerCtrlGeneric(),
 
209
        "Precreate a GenericDatePickerCtrl for use in 2-phase creation.", "",
 
210
        PreGenericDatePickerCtrl);
 
211
    
 
212
 
 
213
    DocDeclStr(
 
214
        bool , Create(wxWindow *parent,
 
215
                      wxWindowID id=-1,
 
216
                      const wxDateTime& dt = wxDefaultDateTime,
 
217
                      const wxPoint& pos = wxDefaultPosition,
 
218
                      const wxSize& size = wxDefaultSize,
 
219
                      long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
 
220
                      const wxValidator& validator = wxDefaultValidator,
 
221
                      const wxString& name = wxPyDatePickerCtrlNameStr),
 
222
        "Create the GUI parts of the GenericDatePickerCtrl, for use in 2-phase
 
223
creation.", "");
 
224
    
 
225
};
 
226
 
 
227
//---------------------------------------------------------------------------
 
228
 
 
229