]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_pycontrol.i
fixed deadlock when calling wxPostEvent() from worker thread
[wxWidgets.git] / wxPython / src / _pycontrol.i
CommitLineData
d14a1e28
RD
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
d14a1e28
RD
20
21//---------------------------------------------------------------------------
22
23%{ // C++ version of Python aware wxControl
24class wxPyControl : public wxControl
25{
26 DECLARE_DYNAMIC_CLASS(wxPyControl)
27public:
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
0ef14ca5
RD
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
d14a1e28
RD
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
1a10485f 72 DEC_PYCALLBACK_BOOL_const(ShouldInheritColours);
1a10485f 73 DEC_PYCALLBACK_VIZATTR_(GetDefaultAttributes);
4d2962b1 74
b035e80b
RD
75 DEC_PYCALLBACK_BOOL_(HasTransparentBackground);
76
37617433
RD
77 DEC_PYCALLBACK_VOID_(OnInternalIdle);
78
d14a1e28
RD
79 PYPRIVATE;
80};
81
82IMPLEMENT_DYNAMIC_CLASS(wxPyControl, wxControl);
83
84IMP_PYCALLBACK_VOID_INT4(wxPyControl, wxControl, DoMoveWindow);
85IMP_PYCALLBACK_VOID_INT5(wxPyControl, wxControl, DoSetSize);
86IMP_PYCALLBACK_VOID_INTINT(wxPyControl, wxControl, DoSetClientSize);
87IMP_PYCALLBACK_VOID_INTINT(wxPyControl, wxControl, DoSetVirtualSize);
88
89IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyControl, wxControl, DoGetSize);
90IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyControl, wxControl, DoGetClientSize);
91IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyControl, wxControl, DoGetPosition);
92
93IMP_PYCALLBACK_SIZE_const(wxPyControl, wxControl, DoGetVirtualSize);
94IMP_PYCALLBACK_SIZE_const(wxPyControl, wxControl, DoGetBestSize);
95
96IMP_PYCALLBACK__(wxPyControl, wxControl, InitDialog);
97IMP_PYCALLBACK_BOOL_(wxPyControl, wxControl, TransferDataFromWindow);
98IMP_PYCALLBACK_BOOL_(wxPyControl, wxControl, TransferDataToWindow);
99IMP_PYCALLBACK_BOOL_(wxPyControl, wxControl, Validate);
100
101IMP_PYCALLBACK_BOOL_const(wxPyControl, wxControl, AcceptsFocus);
102IMP_PYCALLBACK_BOOL_const(wxPyControl, wxControl, AcceptsFocusFromKeyboard);
103IMP_PYCALLBACK_SIZE_const(wxPyControl, wxControl, GetMaxSize);
104
105IMP_PYCALLBACK_VOID_WXWINBASE(wxPyControl, wxControl, AddChild);
106IMP_PYCALLBACK_VOID_WXWINBASE(wxPyControl, wxControl, RemoveChild);
107
1a10485f 108IMP_PYCALLBACK_BOOL_const(wxPyControl, wxControl, ShouldInheritColours);
1a10485f 109IMP_PYCALLBACK_VIZATTR_(wxPyControl, wxControl, GetDefaultAttributes);
b035e80b
RD
110
111IMP_PYCALLBACK_BOOL_(wxPyControl, wxControl, HasTransparentBackground);
37617433
RD
112
113IMP_PYCALLBACK_VOID_(wxPyControl, wxControl, OnInternalIdle);
114%}
d14a1e28
RD
115
116// And now the one for SWIG to see
ab1f7d2a 117MustHaveApp(wxPyControl);
d14a1e28
RD
118class wxPyControl : public wxControl
119{
120public:
c25f90f6 121 %pythonAppend wxPyControl "self._setOORInfo(self);" setCallbackInfo(PyControl)
d43da706 122 %pythonAppend wxPyControl() ""
d14a1e28 123
d5573410 124 wxPyControl(wxWindow* parent, const wxWindowID id=-1,
d14a1e28
RD
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
1b8c7ba6 131 %RenameCtor(PrePyControl, wxPyControl());
d43da706 132
d14a1e28 133 void _setCallbackInfo(PyObject* self, PyObject* _class);
d14a1e28 134
4f84bfb6 135 %pythoncode { SetBestSize = wx.Window.SetInitialSize }
0ef14ca5
RD
136 bool DoEraseBackground(wxDC* dc);
137
a7a01418
RD
138 void DoMoveWindow(int x, int y, int width, int height);
139 void DoSetSize(int x, int y, int width, int height,
d14a1e28 140 int sizeFlags = wxSIZE_AUTO);
a7a01418
RD
141 void DoSetClientSize(int width, int height);
142 void DoSetVirtualSize( int x, int y );
d14a1e28 143
322913ce 144 DocDeclA(
a7a01418
RD
145 void, DoGetSize( int *OUTPUT, int *OUTPUT ) const,
146 "DoGetSize() -> (width, height)");
322913ce 147 DocDeclA(
a7a01418
RD
148 void, DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
149 "DoGetClientSize() -> (width, height)");
322913ce 150 DocDeclA(
a7a01418
RD
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);
37617433 195
d14a1e28
RD
196};
197
198
199//---------------------------------------------------------------------------
200//---------------------------------------------------------------------------