File: _datectrl.i

package info (click to toggle)
wxpython3.0 3.0.1.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 481,208 kB
  • ctags: 520,541
  • sloc: cpp: 2,126,470; python: 293,214; makefile: 51,927; ansic: 19,032; sh: 3,011; xml: 1,629; perl: 17
file content (229 lines) | stat: -rw-r--r-- 8,204 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
/////////////////////////////////////////////////////////////////////////////
// Name:        _datectrl.i
// Purpose:     SWIG interface defs for wxDatePickerCtrl
//
// Author:      Robin Dunn
//
// Created:     15-Feb-2005
// RCS-ID:      $Id$
// Copyright:   (c) 2005 by Total Control Software
// Licence:     wxWindows license
/////////////////////////////////////////////////////////////////////////////

// Not a %module


//---------------------------------------------------------------------------

MAKE_CONST_WXSTRING(DatePickerCtrlNameStr);

//---------------------------------------------------------------------------
%newgroup

DocStr(wxDatePickerCtrl,
"This control allows the user to select a date. Unlike
`wx.calendar.CalendarCtrl`, which is a relatively big control,
`wx.DatePickerCtrl` is implemented as a small window showing the
currently selected date. The control can be edited using the keyboard,
and can also display a popup window for more user-friendly date
selection, depending on the styles used and the platform.", "

Styles
------
    =================  ======================================================
    wx.DP_SPIN         Creates a control without month calendar drop down but
                       with spin control-like arrows to change individual
                       date components. This style is not supported by the
                       generic version.

    wx.DP_DROPDOWN     Creates a control with a month calendar drop down
                       part from which the user can select a date.

    wx.DP_DEFAULT      Creates a control with default style which is the
                       best supported for the current platform
                       (currently wx.DP_SPIN under Windows and
                       wx.DP_DROPDOWN elsewhere).

    wx.DP_ALLOWNONE    With this style, the control allows the user to not
                       enter any valid date at all. Without it -- which
                       is by default -- the control always has some
                       valid date.

    wx.DP_SHOWCENTURY  Forces display of the century in the default
                       date format. Without this flag the century
                       could be displayed or not depending on the
                       default date representation in the system.
    =================  ======================================================

Events
------

    =================  ======================================================
    EVT_DATE_CHANGED   This event fires when the user changes the current
                       selection in the control.
    =================  ======================================================

:see: `wx.calendar.CalendarCtrl`, `wx.DateEvent`
");




enum
{
    wxDP_DEFAULT = 0,
    wxDP_SPIN = 1,
    wxDP_DROPDOWN = 2,
    wxDP_SHOWCENTURY = 4,
    wxDP_ALLOWNONE = 8
};


MustHaveApp(wxDatePickerCtrl);

class wxDatePickerCtrlBase : public wxControl
{
public:
    // ****  ABC

    DocDeclStr(
        virtual void , SetValue(const wxDateTime& dt),
        "Changes the current value of the control. The date should be valid and
included in the currently selected range, if any.

Calling this method does not result in a date change event.", "");
    
    DocDeclStr(
        virtual wxDateTime , GetValue() const,
        "Returns the currently selected date. If there is no selection or the
selection is outside of the current range, an invalid `wx.DateTime`
object is returned.", "");
    

    DocDeclStr(
        virtual void , SetRange(const wxDateTime& dt1, const wxDateTime& dt2),
        "Sets the valid range for the date selection. If dt1 is valid, it
becomes the earliest date (inclusive) accepted by the control. If dt2
is valid, it becomes the latest possible date.

If the current value of the control is outside of the newly set range
bounds, the behaviour is undefined.", "");
    
    // virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const;

    %extend {
        DocStr(
            GetLowerLimit,
            "Get the lower limit of the valid range for the date selection, if any.
If there is no range or there is no lower limit, then the
`wx.DateTime` value returned will be invalid.", "");
        wxDateTime GetLowerLimit() {
            wxDateTime rv;
            self->GetRange(&rv, NULL);
            return rv;
        }

        
        DocStr(
            GetUpperLimit,
            "Get the upper limit of the valid range for the date selection, if any.
If there is no range or there is no upper limit, then the
`wx.DateTime` value returned will be invalid.", "");
        wxDateTime GetUpperLimit() {
            wxDateTime rv;
            self->GetRange(NULL, &rv);
            return rv;
        }
    }
    
    %property(LowerLimit, GetLowerLimit, doc="See `GetLowerLimit`");
    %property(UpperLimit, GetUpperLimit, doc="See `GetUpperLimit`");
    %property(Value, GetValue, SetValue, doc="See `GetValue` and `SetValue`");
};


class wxDatePickerCtrl : public wxDatePickerCtrlBase
{
public:
    %pythonAppend wxDatePickerCtrl         "self._setOORInfo(self)";
    %pythonAppend wxDatePickerCtrl()       "";

    DocCtorStr(
        wxDatePickerCtrl(wxWindow *parent,
                         wxWindowID id=-1,
                         const wxDateTime& dt = wxDefaultDateTime,
                         const wxPoint& pos = wxDefaultPosition,
                         const wxSize& size = wxDefaultSize,
                         long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
                         const wxValidator& validator = wxDefaultValidator,
                         const wxString& name = wxPyDatePickerCtrlNameStr),
        "Create a new DatePickerCtrl.", "");

    
    DocCtorStrName(
        wxDatePickerCtrl(),
        "Precreate a DatePickerCtrl for use in 2-phase creation.", "",
        PreDatePickerCtrl);
    

    DocDeclStr(
        bool , Create(wxWindow *parent,
                      wxWindowID id=-1,
                      const wxDateTime& dt = wxDefaultDateTime,
                      const wxPoint& pos = wxDefaultPosition,
                      const wxSize& size = wxDefaultSize,
                      long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
                      const wxValidator& validator = wxDefaultValidator,
                      const wxString& name = wxPyDatePickerCtrlNameStr),
        "Create the GUI parts of the DatePickerCtrl, for use in 2-phase
creation.", "");
    
};



MustHaveApp(wxDatePickerCtrlGeneric);

%rename(GenericDatePickerCtrl) wxDatePickerCtrlGeneric;

class wxDatePickerCtrlGeneric : public wxDatePickerCtrlBase
{
public:
    %pythonAppend wxDatePickerCtrlGeneric         "self._setOORInfo(self)";
    %pythonAppend wxDatePickerCtrlGeneric()       "";

    DocCtorStr(
        wxDatePickerCtrlGeneric(wxWindow *parent,
                         wxWindowID id=-1,
                         const wxDateTime& dt = wxDefaultDateTime,
                         const wxPoint& pos = wxDefaultPosition,
                         const wxSize& size = wxDefaultSize,
                         long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
                         const wxValidator& validator = wxDefaultValidator,
                         const wxString& name = wxPyDatePickerCtrlNameStr),
        "Create a new GenericDatePickerCtrl.", "");

    
    DocCtorStrName(
        wxDatePickerCtrlGeneric(),
        "Precreate a GenericDatePickerCtrl for use in 2-phase creation.", "",
        PreGenericDatePickerCtrl);
    
 
    DocDeclStr(
        bool , Create(wxWindow *parent,
                      wxWindowID id=-1,
                      const wxDateTime& dt = wxDefaultDateTime,
                      const wxPoint& pos = wxDefaultPosition,
                      const wxSize& size = wxDefaultSize,
                      long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
                      const wxValidator& validator = wxDefaultValidator,
                      const wxString& name = wxPyDatePickerCtrlNameStr),
        "Create the GUI parts of the GenericDatePickerCtrl, for use in 2-phase
creation.", "");
    
};

//---------------------------------------------------------------------------