]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_pycontrol.i
Committing in .
[wxWidgets.git] / wxPython / src / _pycontrol.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: _pywindows.i
3 // Purpose: SWIG interface for wxPyControl, See also _pywindows.i
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 2-June-1998
8 // RCS-ID: $Id$
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 // Not a %module
14
15
16 //---------------------------------------------------------------------------
17 %newgroup
18
19
20
21 //---------------------------------------------------------------------------
22
23 %{ // C++ version of Python aware wxControl
24 class wxPyControl : public wxControl
25 {
26 DECLARE_DYNAMIC_CLASS(wxPyControl)
27 public:
28 wxPyControl() : wxControl() {}
29 wxPyControl(wxWindow* parent, const wxWindowID id,
30 const wxPoint& pos = wxDefaultPosition,
31 const wxSize& size = wxDefaultSize,
32 long style = 0,
33 const wxValidator& validator=wxDefaultValidator,
34 const wxString& name = wxPyControlNameStr)
35 : wxControl(parent, id, pos, size, style, validator, name) {}
36
37
38 bool DoEraseBackground(wxDC* dc) {
39 #ifdef __WXMSW__
40 return wxWindow::DoEraseBackground(dc->GetHDC());
41 #else
42 dc->SetBackground(wxBrush(GetBackgroundColour()));
43 dc->Clear();
44 return true;
45 #endif
46 }
47
48 DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
49 DEC_PYCALLBACK_VOID_INT5(DoSetSize);
50 DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
51 DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
52
53 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
54 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
55 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
56
57 DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
58 DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
59
60 DEC_PYCALLBACK__(InitDialog);
61 DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
62 DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
63 DEC_PYCALLBACK_BOOL_(Validate);
64
65 DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
66 DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
67 DEC_PYCALLBACK_SIZE_const(GetMaxSize);
68
69 DEC_PYCALLBACK_VOID_WXWINBASE(AddChild);
70 DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild);
71
72 DEC_PYCALLBACK_BOOL_const(ShouldInheritColours);
73 DEC_PYCALLBACK_VIZATTR_(GetDefaultAttributes);
74
75 DEC_PYCALLBACK_BOOL_(HasTransparentBackground);
76
77 DEC_PYCALLBACK_VOID_(OnInternalIdle);
78
79 PYPRIVATE;
80 };
81
82 IMPLEMENT_DYNAMIC_CLASS(wxPyControl, wxControl);
83
84 IMP_PYCALLBACK_VOID_INT4(wxPyControl, wxControl, DoMoveWindow);
85 IMP_PYCALLBACK_VOID_INT5(wxPyControl, wxControl, DoSetSize);
86 IMP_PYCALLBACK_VOID_INTINT(wxPyControl, wxControl, DoSetClientSize);
87 IMP_PYCALLBACK_VOID_INTINT(wxPyControl, wxControl, DoSetVirtualSize);
88
89 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyControl, wxControl, DoGetSize);
90 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyControl, wxControl, DoGetClientSize);
91 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyControl, wxControl, DoGetPosition);
92
93 IMP_PYCALLBACK_SIZE_const(wxPyControl, wxControl, DoGetVirtualSize);
94 IMP_PYCALLBACK_SIZE_const(wxPyControl, wxControl, DoGetBestSize);
95
96 IMP_PYCALLBACK__(wxPyControl, wxControl, InitDialog);
97 IMP_PYCALLBACK_BOOL_(wxPyControl, wxControl, TransferDataFromWindow);
98 IMP_PYCALLBACK_BOOL_(wxPyControl, wxControl, TransferDataToWindow);
99 IMP_PYCALLBACK_BOOL_(wxPyControl, wxControl, Validate);
100
101 IMP_PYCALLBACK_BOOL_const(wxPyControl, wxControl, AcceptsFocus);
102 IMP_PYCALLBACK_BOOL_const(wxPyControl, wxControl, AcceptsFocusFromKeyboard);
103 IMP_PYCALLBACK_SIZE_const(wxPyControl, wxControl, GetMaxSize);
104
105 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyControl, wxControl, AddChild);
106 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyControl, wxControl, RemoveChild);
107
108 IMP_PYCALLBACK_BOOL_const(wxPyControl, wxControl, ShouldInheritColours);
109 IMP_PYCALLBACK_VIZATTR_(wxPyControl, wxControl, GetDefaultAttributes);
110
111 IMP_PYCALLBACK_BOOL_(wxPyControl, wxControl, HasTransparentBackground);
112
113 IMP_PYCALLBACK_VOID_(wxPyControl, wxControl, OnInternalIdle);
114 %}
115
116 // And now the one for SWIG to see
117 MustHaveApp(wxPyControl);
118 class wxPyControl : public wxControl
119 {
120 public:
121 %pythonAppend wxPyControl "self._setOORInfo(self);" setCallbackInfo(PyControl)
122 %pythonAppend wxPyControl() ""
123
124 wxPyControl(wxWindow* parent, const wxWindowID id=-1,
125 const wxPoint& pos = wxDefaultPosition,
126 const wxSize& size = wxDefaultSize,
127 long style = 0,
128 const wxValidator& validator=wxDefaultValidator,
129 const wxString& name = wxPyControlNameStr);
130
131 %RenameCtor(PrePyControl, wxPyControl());
132
133 void _setCallbackInfo(PyObject* self, PyObject* _class);
134
135 %pythoncode { SetBestSize = wx.Window.SetInitialSize }
136 bool DoEraseBackground(wxDC* dc);
137
138 void DoMoveWindow(int x, int y, int width, int height);
139 void DoSetSize(int x, int y, int width, int height,
140 int sizeFlags = wxSIZE_AUTO);
141 void DoSetClientSize(int width, int height);
142 void DoSetVirtualSize( int x, int y );
143
144 DocDeclA(
145 void, DoGetSize( int *OUTPUT, int *OUTPUT ) const,
146 "DoGetSize() -> (width, height)");
147 DocDeclA(
148 void, DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
149 "DoGetClientSize() -> (width, height)");
150 DocDeclA(
151 void, DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
152 "DoGetPosition() -> (x,y)");
153
154 wxSize DoGetVirtualSize() const;
155 wxSize DoGetBestSize() const;
156
157 void InitDialog();
158 bool TransferDataToWindow();
159 bool TransferDataFromWindow();
160 bool Validate();
161
162 bool AcceptsFocus() const;
163 bool AcceptsFocusFromKeyboard() const;
164 wxSize GetMaxSize() const;
165
166 void AddChild(wxWindow* child);
167 void RemoveChild(wxWindow* child);
168
169 bool ShouldInheritColours() const;
170 wxVisualAttributes GetDefaultAttributes();
171
172 void OnInternalIdle();
173
174 %MAKE_BASE_FUNC(PyScrolledWindow, DoMoveWindow);
175 %MAKE_BASE_FUNC(PyScrolledWindow, DoSetSize);
176 %MAKE_BASE_FUNC(PyScrolledWindow, DoSetClientSize);
177 %MAKE_BASE_FUNC(PyScrolledWindow, DoSetVirtualSize);
178 %MAKE_BASE_FUNC(PyScrolledWindow, DoGetSize);
179 %MAKE_BASE_FUNC(PyScrolledWindow, DoGetClientSize);
180 %MAKE_BASE_FUNC(PyScrolledWindow, DoGetPosition);
181 %MAKE_BASE_FUNC(PyScrolledWindow, DoGetVirtualSize);
182 %MAKE_BASE_FUNC(PyScrolledWindow, DoGetBestSize);
183 %MAKE_BASE_FUNC(PyScrolledWindow, InitDialog);
184 %MAKE_BASE_FUNC(PyScrolledWindow, TransferDataToWindow);
185 %MAKE_BASE_FUNC(PyScrolledWindow, TransferDataFromWindow);
186 %MAKE_BASE_FUNC(PyScrolledWindow, Validate);
187 %MAKE_BASE_FUNC(PyScrolledWindow, AcceptsFocus);
188 %MAKE_BASE_FUNC(PyScrolledWindow, AcceptsFocusFromKeyboard);
189 %MAKE_BASE_FUNC(PyScrolledWindow, GetMaxSize);
190 %MAKE_BASE_FUNC(PyScrolledWindow, AddChild);
191 %MAKE_BASE_FUNC(PyScrolledWindow, RemoveChild);
192 %MAKE_BASE_FUNC(PyScrolledWindow, ShouldInheritColours);
193 %MAKE_BASE_FUNC(PyScrolledWindow, GetDefaultAttributes);
194 %MAKE_BASE_FUNC(PyScrolledWindow, OnInternalIdle);
195
196 };
197
198
199 //---------------------------------------------------------------------------
200 //---------------------------------------------------------------------------