Lines 53-64
Link Here
|
53 |
MethodDef(name='wxWindowIDRef', className='wxWindowIDRef', isCtor=True, |
53 |
MethodDef(name='wxWindowIDRef', className='wxWindowIDRef', isCtor=True, |
54 |
briefDoc='Create reference from an ID', |
54 |
briefDoc='Create reference from an ID', |
55 |
items=[ ParamDef(type='int', name='id') ]), |
55 |
items=[ ParamDef(type='int', name='id') ]), |
56 |
|
56 |
|
57 |
MethodDef(name='wxWindowIDRef', className='wxWindowIDRef', isCtor=True, |
57 |
MethodDef(name='wxWindowIDRef', className='wxWindowIDRef', isCtor=True, |
58 |
briefDoc='Copy an ID reference', |
58 |
briefDoc='Copy an ID reference', |
59 |
items=[ ParamDef(type='const wxWindowIDRef&', name='idref') ]), |
59 |
items=[ ParamDef(type='const wxWindowIDRef&', name='idref') ]), |
60 |
]), |
60 |
]), |
61 |
|
61 |
|
62 |
MethodDef(name='~wxWindowIDRef', className='wxWindowIDRef', isDtor=True), |
62 |
MethodDef(name='~wxWindowIDRef', className='wxWindowIDRef', isDtor=True), |
63 |
|
63 |
|
64 |
MethodDef(type='int', name='GetValue', |
64 |
MethodDef(type='int', name='GetValue', |
Lines 73-83
Link Here
|
73 |
""") |
73 |
""") |
74 |
|
74 |
|
75 |
klass.addCppMethod('int', '__int__', '()', |
75 |
klass.addCppMethod('int', '__int__', '()', |
76 |
doc="Alias for GetValue allowing the IDRef to be passed as the WindowID parameter when creating widgets or etc.", |
76 |
doc="Alias for GetValue allowing the IDRef to be passed as the WindowID parameter when creating widgets or other places an integer type is needed.", |
77 |
body="""\ |
77 |
body="return self->GetValue();") |
78 |
return self->GetValue(); |
78 |
klass.addCppMethod('int', '__index__', '()', |
79 |
""") |
79 |
doc="See :meth:`__int__`", |
80 |
|
80 |
body="return self->GetValue();") |
|
|
81 |
|
82 |
|
81 |
klass.addCppMethod('bool', '__eq__', '(wxWindowID id)', "return self->GetValue() == id;") |
83 |
klass.addCppMethod('bool', '__eq__', '(wxWindowID id)', "return self->GetValue() == id;") |
82 |
klass.addCppMethod('bool', '__ne__', '(wxWindowID id)', "return self->GetValue() != id;") |
84 |
klass.addCppMethod('bool', '__ne__', '(wxWindowID id)', "return self->GetValue() != id;") |
83 |
klass.addCppMethod('bool', '__lt__', '(wxWindowID id)', "return self->GetValue() < id;") |
85 |
klass.addCppMethod('bool', '__lt__', '(wxWindowID id)', "return self->GetValue() < id;") |
Lines 92-108
Link Here
|
92 |
# and finish it up by adding it to the module |
94 |
# and finish it up by adding it to the module |
93 |
module.addItem(klass) |
95 |
module.addItem(klass) |
94 |
|
96 |
|
95 |
# Now, let's add a new Python function to the global scope that reserves an |
97 |
# Now, let's add a new Python function to the global scope that reserves an |
96 |
# ID (or range) and returns a ref object for it. |
98 |
# ID (or range) and returns a ref object for it. |
97 |
module.addPyFunction('NewIdRef', '(count=1)', |
99 |
module.addPyFunction('NewIdRef', '(count=1)', |
98 |
doc="""\ |
100 |
doc="""\ |
99 |
Reserves a new Window ID (or range of WindowIDs) and returns a |
101 |
Reserves a new Window ID (or range of WindowIDs) and returns a |
100 |
:class:`wx.WindowIDRef` object (or list of them) that will help |
102 |
:class:`wx.WindowIDRef` object (or list of them) that will help |
101 |
manage the reservation of that ID. |
103 |
manage the reservation of that ID. |
102 |
|
104 |
|
103 |
This function is intended to be a drop-in replacement of the old |
105 |
This function is intended to be a drop-in replacement of the old |
104 |
and deprecated :func:`wx.NewId` function, with the added benefit |
106 |
and deprecated :func:`wx.NewId` function, with the added benefit |
105 |
that the ID should never conflict with an in-use ID or other IDs |
107 |
that the ID should never conflict with an in-use ID or other IDs |
106 |
generated by this function. |
108 |
generated by this function. |
107 |
""", |
109 |
""", |
108 |
body="""\ |
110 |
body="""\ |