]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/src/windows.i
592bdeb5511b8474751ed6216c0a17a54d8ae344
[wxWidgets.git] / utils / wxPython / src / windows.i
1 %module windows
2 %{
3 /////////////////////////////////////////////////////////////////////////////
4 // Name: windows.i
5 // Purpose: SWIG definitions of various window classes
6 //
7 // Author: Robin Dunn
8 //
9 // Created: 6/24/97
10 // RCS-ID: $Id$
11 // Copyright: (c) 1998 by Total Control Software
12 // Licence: wxWindows license
13 /////////////////////////////////////////////////////////////////////////////
14
15
16 #include "helpers.h"
17
18 #ifdef __WXMSW__
19 // wxGTK defines wxMenuItem inside menu.h
20 #include <wx/menuitem.h>
21 #endif
22
23 #ifdef __WXMSW__
24 #include <wx/minifram.h>
25 #endif
26 %}
27
28 //----------------------------------------------------------------------
29
30 %include typemaps.i
31 %include my_typemaps.i
32
33 // Import some definitions of other classes, etc.
34 %import _defs.i
35 %import misc.i
36 %import gdi.i
37
38
39 //---------------------------------------------------------------------------
40
41 class wxEvtHandler {
42 public:
43 %addmethods {
44 void Connect( int id, int lastId, int eventType, PyObject* func) {
45 if (PyCallable_Check(func)) {
46 self->Connect(id, lastId, eventType,
47 (wxObjectEventFunction) &wxPyCallback::EventThunker,
48 new wxPyCallback(func));
49 }
50 }
51 }
52 };
53
54
55 //----------------------------------------------------------------------
56
57
58 class wxWindow : public wxEvtHandler {
59 public:
60
61 wxWindow(wxWindow* parent, const wxWindowID id,
62 const wxPoint& pos = wxPyDefaultPosition,
63 const wxSize& size = wxPyDefaultSize,
64 long style = 0,
65 char* name = "panel");
66
67
68 void CaptureMouse();
69 //void Center(int direction = wxHORIZONTAL);
70 void Centre(int direction = wxHORIZONTAL);
71 void ClientToScreen(int *BOTH, int *BOTH);
72 bool Close(int force = FALSE);
73 bool Destroy();
74 void DestroyChildren();
75 #ifdef __WXMSW__
76 void DragAcceptFiles(bool accept);
77 #endif
78 void Enable(bool enable);
79 //bool FakePopupMenu(wxMenu* menu, int x, int y);
80 void Fit();
81 wxColour GetBackgroundColour();
82 #ifdef __WXMSW__
83 int GetCharHeight();
84 int GetCharWidth();
85 #endif
86 void GetClientSize(int *OUTPUT, int *OUTPUT);
87 wxLayoutConstraints * GetConstraints();
88 #ifdef __WXMSW__
89 wxButton* GetDefaultItem();
90 #endif
91 //wxEvtHandler* GetEventHandler();
92 wxFont* GetFont();
93 #ifdef __WXMSW__
94 wxColour GetForegroundColour();
95 wxWindow * GetGrandParent();
96 #endif
97 int GetId();
98 void GetPosition(int *OUTPUT, int *OUTPUT);
99 #ifdef __WXMSW__
100 wxString& GetLabel();
101 wxString& GetName();
102 #else
103 wxString GetLabel();
104 wxString GetName();
105 #endif
106 wxWindow * GetParent();
107 int GetReturnCode();
108 int GetScrollThumb(int orientation);
109 int GetScrollPos(int orientation);
110 int GetScrollRange(int orientation);
111 void GetSize(int *OUTPUT, int *OUTPUT);
112 #ifdef __WXMSW__
113 void GetTextExtent(const wxString& string, int *OUTPUT, int *OUTPUT); // int* descent = NULL, int* externalLeading = NULL, const wxFont* font = NULL, bool use16 = FALSE)
114 #endif
115 #ifdef __WXMSW__
116 wxString& GetTitle();
117 #else
118 wxString GetTitle();
119 #endif
120 long GetWindowStyleFlag();
121 void InitDialog();
122 bool IsEnabled();
123 bool IsRetained();
124 bool IsShown();
125 void Layout();
126 #ifdef __WXMSW__
127 bool LoadFromResource(wxWindow* parent, const wxString& resourceName, const wxResourceTable* resourceTable = NULL);
128 #endif
129 void Lower();
130 void MakeModal(bool flag);
131 void Move(int x, int y);
132
133 //wxEvtHandler* PopEventHandler(bool deleteHandler = FALSE);
134 bool PopupMenu(wxMenu *menu, int x, int y);
135 //void PushEventHandler(wxEvtHandler* handler);
136
137 void Raise();
138 void Refresh(bool eraseBackground = TRUE, const wxRect* rect = NULL);
139 void ReleaseMouse();
140 void ScreenToClient(int *BOTH, int *BOTH);
141 void ScrollWindow(int dx, int dy, const wxRect* rect = NULL);
142 void SetAutoLayout(bool autoLayout);
143 void SetBackgroundColour(const wxColour& colour);
144 void SetConstraints(wxLayoutConstraints *constraints);
145 void SetDoubleClick(bool allowDoubleClick);
146 void SetFocus();
147 void SetFont(const wxFont& font);
148 #ifdef __WXMSW__
149 void SetForegroundColour(const wxColour& colour);
150 #endif
151 void SetId(int id);
152 void SetName(const wxString& name);
153 void SetReturnCode(int retCode);
154 void SetScrollbar(int orientation, int position, int thumbSize, int range, bool refresh = TRUE);
155 void SetScrollPos(int orientation, int pos, bool refresh = TRUE);
156
157 //void SetSize(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO);
158 //%name(SetSizeOnly) void SetSize(int width, int height);
159
160 %name(SetDimensions) void SetSize(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO);
161 %addmethods {
162 void SetSize(const wxSize& size) {
163 self->SetSize(size.x, size.y);
164 }
165
166 void SetPosition(const wxPoint& pos) {
167 self->SetSize(pos.x, pos.y, -1, -1);
168 }
169 }
170
171 #ifdef __WXMSW__
172 void SetSizeHints(int minW=-1, int minH=-1, int maxW=-1, int maxH=-1, int incW=-1, int incH=-1);
173 #endif
174 void SetClientSize(int width, int height);
175 //void SetPalette(wxPalette* palette);
176 //void SetColourMap(wxColourMap *colourMap);
177 void SetCursor(const wxCursor&cursor);
178 //void SetEventHandler(wxEvtHandler* handler);
179 void SetTitle(const wxString& title);
180 bool Show(bool show);
181 bool TransferDataFromWindow();
182 bool TransferDataToWindow();
183 bool Validate();
184 #ifdef __WXMSW__
185 void WarpPointer(int x, int y);
186 #endif
187
188 };
189
190
191 // Static method(s)
192 #ifdef __WXMSW__
193 %inline %{
194 wxWindow* wxWindow_FindFocus() {
195 return wxWindow::FindFocus();
196 }
197 %}
198 #endif
199
200 //----------------------------------------------------------------------
201
202 class wxFrame : public wxWindow {
203 public:
204 wxFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
205 const wxPoint& pos = wxPyDefaultPosition,
206 const wxSize& size = wxPyDefaultSize,
207 long style = wxDEFAULT_FRAME_STYLE,
208 char* name = "frame");
209
210 void Centre(int direction = wxBOTH);
211 #ifdef __WXMSW__
212 void Command(int id);
213 #endif
214 bool CreateStatusBar(int number = 1);
215 wxMenuBar* GetMenuBar();
216 wxStatusBar* GetStatusBar();
217 #ifdef __WXMSW__
218 wxString& GetTitle();
219 #else
220 wxString GetTitle();
221 #endif
222 #ifdef __WXMSW__
223 void Iconize(bool iconize);
224 bool IsIconized();
225 void SetAcceleratorTable(const wxAcceleratorTable& accel);
226 void Maximize(bool maximize);
227 #endif
228 void SetIcon(const wxIcon& icon);
229 void SetMenuBar(wxMenuBar* menuBar);
230 void SetStatusText(const wxString& text, int number = 0);
231 void SetStatusWidths(int LCOUNT, int* LIST); // use typemap
232 void SetTitle(const wxString& title);
233
234 };
235
236 //---------------------------------------------------------------------------
237
238 #ifdef __WXMSW__
239 class wxMiniFrame : public wxFrame {
240 public:
241 wxMiniFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
242 const wxPoint& pos = wxPyDefaultPosition,
243 const wxSize& size = wxPyDefaultSize,
244 long style = wxDEFAULT_FRAME_STYLE,
245 char* name = "frame");
246 };
247 #endif
248
249 //---------------------------------------------------------------------------
250
251 class wxPanel : public wxWindow {
252 public:
253 wxPanel(wxWindow* parent,
254 const wxWindowID id,
255 const wxPoint& pos = wxPyDefaultPosition,
256 const wxSize& size = wxPyDefaultSize,
257 long style = wxTAB_TRAVERSAL,
258 const char* name = "panel");
259
260 void InitDialog();
261 };
262
263 //---------------------------------------------------------------------------
264
265 class wxDialog : public wxPanel {
266 public:
267 wxDialog(wxWindow* parent,
268 const wxWindowID id,
269 const wxString& title,
270 const wxPoint& pos = wxPyDefaultPosition,
271 const wxSize& size = wxPyDefaultSize,
272 long style = wxDEFAULT_DIALOG_STYLE,
273 const char* name = "dialogBox");
274
275 void Centre(int direction = wxBOTH);
276 void EndModal(int retCode);
277 wxString GetTitle();
278 #ifdef __WXMSW__
279 void Iconize(bool iconize);
280 bool IsIconized();
281 void SetModal(bool flag);
282 #endif
283 bool IsModal();
284 void SetTitle(const wxString& title);
285 bool Show(bool show);
286 int ShowModal();
287 };
288
289 //---------------------------------------------------------------------------
290
291 class wxScrolledWindow : public wxWindow {
292 public:
293 wxScrolledWindow(wxWindow* parent,
294 const wxWindowID id = -1,
295 const wxPoint& pos = wxPyDefaultPosition,
296 const wxSize& size = wxPyDefaultSize,
297 long style = wxHSCROLL | wxVSCROLL,
298 char* name = "scrolledWindow");
299
300 void EnableScrolling(bool xScrolling, bool yScrolling);
301 void GetScrollPixelsPerUnit(int* OUTPUT, int* OUTPUT);
302 void GetVirtualSize(int* OUTPUT, int* OUTPUT);
303 bool IsRetained();
304 void PrepareDC(wxDC& dc);
305 void Scroll(int x, int y);
306 void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
307 int noUnitsX, int noUnitsY,
308 int xPos = 0, int yPos = 0);
309 void ViewStart(int* OUTPUT, int* OUTPUT);
310 };
311
312 //----------------------------------------------------------------------
313
314
315 class wxMenu : public wxEvtHandler {
316 public:
317 wxMenu(const wxString& title = wxPyEmptyStr);
318
319 void Append(int id, const wxString& item,
320 const wxString& helpString = wxPyEmptyStr,
321 int checkable = FALSE);
322 %name(AppendMenu)void Append(int id, const wxString& item, wxMenu *subMenu,
323 const wxString& helpString = wxPyEmptyStr);
324 void AppendSeparator();
325 void Break();
326 void Check(int id, bool flag);
327 void Enable(int id, bool enable);
328 int FindItem(const wxString& itemString);
329 #ifdef __WXMSW__
330 wxMenuItem* FindItemForId(int id);
331 wxString& GetHelpString(int id);
332 wxString GetLabel(int id);
333 wxString GetTitle();
334 void SetHelpString(int id, const wxString& helpString);
335 void SetTitle(const wxString& title);
336 #endif
337 bool IsChecked(int id);
338 bool IsEnabled(int id);
339 void SetLabel(int id, const wxString& label);
340 };
341
342
343 #ifdef __WXMSW__
344 //
345 // This one knows how to set a callback and handle INC- and DECREFing it. To
346 // be used for PopupMenus, but you must retain a referece to it while using
347 // it.
348 //
349 class wxPyMenu : public wxMenu {
350 public:
351 wxPyMenu(const wxString& title = wxPyEmptyStr, PyObject* func = NULL);
352 ~wxPyMenu();
353 };
354 #endif
355
356 //----------------------------------------------------------------------
357
358 class wxMenuBar : public wxEvtHandler {
359 public:
360 wxMenuBar();
361
362 void Append(wxMenu *menu, const wxString& title);
363 void Check(int id, bool flag);
364 bool Checked(int id);
365 void Enable(int id, bool enable);
366 int FindMenuItem(const wxString& menuString, const wxString& itemString);
367 #ifdef __WXMSW__
368 void EnableTop(int pos, bool enable);
369 wxMenuItem * FindItemForId(int id);
370 wxString GetHelpString(int id);
371 wxString GetLabel(int id);
372 void SetHelpString(int id, const wxString& helpString);
373 void SetLabel(int id, const wxString& label);
374 wxString GetLabelTop(int pos);
375 void SetLabelTop(int pos, const wxString& label);
376 #endif
377 };
378
379
380 //----------------------------------------------------------------------
381
382 class wxMenuItem {
383 public:
384 bool IsSeparator();
385 bool IsEnabled();
386 bool IsChecked();
387 int GetId();
388 wxMenu* GetSubMenu();
389 #ifdef __WXMSW__
390 const wxString& GetHelp();
391 void SetName(const wxString& strName);
392 void SetHelp(const wxString& strHelp);
393 #endif
394 void Enable(bool bDoEnable = TRUE);
395 void Check(bool bDoCheck = TRUE);
396 #ifdef __WXMSW__
397 void DeleteSubMenu();
398 const wxString& GetName();
399 #endif
400 bool IsCheckable();
401 };
402
403 //---------------------------------------------------------------------------
404 /////////////////////////////////////////////////////////////////////////////
405 //
406 // $Log$
407 // Revision 1.2 1998/08/14 23:36:46 RD
408 // Beginings of wxGTK compatibility
409 //
410 // Revision 1.1 1998/08/09 08:25:52 RD
411 // Initial version
412 //
413 //
414
415