]> git.saurik.com Git - wxWidgets.git/blame - utils/wxPython/src/windows.i
jconfig.h uses configures results
[wxWidgets.git] / utils / wxPython / src / windows.i
CommitLineData
7bf85405
RD
1/////////////////////////////////////////////////////////////////////////////
2// Name: windows.i
3// Purpose: SWIG definitions of various window classes
4//
5// Author: Robin Dunn
6//
7// Created: 6/24/97
8// RCS-ID: $Id$
9// Copyright: (c) 1998 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13
03e9bead
RD
14%module windows
15
16%{
7bf85405 17#include "helpers.h"
7bf85405
RD
18#include <wx/menuitem.h>
19%}
20
21//----------------------------------------------------------------------
22
23%include typemaps.i
24%include my_typemaps.i
25
26// Import some definitions of other classes, etc.
27%import _defs.i
28%import misc.i
29%import gdi.i
30
b8b8dda7 31%pragma(python) code = "import wx"
7bf85405
RD
32
33//---------------------------------------------------------------------------
34
35class wxEvtHandler {
36public:
cf694132 37 bool ProcessEvent(wxEvent& event);
7bf85405
RD
38 %addmethods {
39 void Connect( int id, int lastId, int eventType, PyObject* func) {
40 if (PyCallable_Check(func)) {
41 self->Connect(id, lastId, eventType,
853b255a 42 (wxObjectEventFunction) &wxPyCallback::EventThunker,
7bf85405
RD
43 new wxPyCallback(func));
44 }
45 }
46 }
47};
48
49
50//----------------------------------------------------------------------
51
52
53class wxWindow : public wxEvtHandler {
54public:
55
56 wxWindow(wxWindow* parent, const wxWindowID id,
57 const wxPoint& pos = wxPyDefaultPosition,
58 const wxSize& size = wxPyDefaultSize,
59 long style = 0,
60 char* name = "panel");
61
b8b8dda7 62 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
7bf85405
RD
63
64 void CaptureMouse();
714e6a9e 65 void Center(int direction = wxHORIZONTAL);
7bf85405 66 void Centre(int direction = wxHORIZONTAL);
af309447 67 %name(ClientToScreenXY)void ClientToScreen(int *BOTH, int *BOTH);
b57bdb5a 68#ifndef __WXGTK__
af309447 69 wxPoint ClientToScreen(const wxPoint& pt);
b57bdb5a 70#endif
7bf85405
RD
71 bool Close(int force = FALSE);
72 bool Destroy();
73 void DestroyChildren();
853b255a 74#ifdef __WXMSW__
7bf85405 75 void DragAcceptFiles(bool accept);
853b255a 76#endif
7bf85405
RD
77 void Enable(bool enable);
78 //bool FakePopupMenu(wxMenu* menu, int x, int y);
af309447 79 %name(FindWindowById) wxWindow* FindWindow(long id);
714e6a9e 80 %name(FindWindowByName) wxWindow* FindWindow(const wxString& name);
7bf85405
RD
81 void Fit();
82 wxColour GetBackgroundColour();
83 int GetCharHeight();
84 int GetCharWidth();
b8b8dda7
RD
85 %name(GetClientSizeTuple) void GetClientSize(int *OUTPUT, int *OUTPUT);
86 wxSize GetClientSize();
7bf85405 87 wxLayoutConstraints * GetConstraints();
853b255a 88#ifdef __WXMSW__
7bf85405 89 wxButton* GetDefaultItem();
853b255a 90#endif
7bf85405 91 //wxEvtHandler* GetEventHandler();
105e45b9 92
b8b8dda7 93 wxFont& GetFont();
7bf85405
RD
94 wxColour GetForegroundColour();
95 wxWindow * GetGrandParent();
96 int GetId();
853b255a
RD
97 wxString GetLabel();
98 wxString GetName();
7bf85405 99 wxWindow * GetParent();
b8b8dda7
RD
100 %name(GetPositionTuple) void GetPosition(int *OUTPUT, int *OUTPUT);
101 wxPoint GetPosition();
102 wxRect GetRect();
7bf85405
RD
103 int GetReturnCode();
104 int GetScrollThumb(int orientation);
105 int GetScrollPos(int orientation);
106 int GetScrollRange(int orientation);
b8b8dda7
RD
107 %name(GetSizeTuple) void GetSize(int *OUTPUT, int *OUTPUT);
108 wxSize GetSize();
af309447
RD
109 void GetTextExtent(const wxString& string, int *OUTPUT, int *OUTPUT);
110 %name(GetFullTextExtent)void GetTextExtent(const wxString& string,
111 int *OUTPUT, int *OUTPUT, int *OUTPUT, int* OUTPUT,
112 const wxFont* font = NULL); //, bool use16 = FALSE)
853b255a 113 wxString GetTitle();
7bf85405
RD
114 long GetWindowStyleFlag();
115 void InitDialog();
116 bool IsEnabled();
117 bool IsRetained();
118 bool IsShown();
119 void Layout();
120 bool LoadFromResource(wxWindow* parent, const wxString& resourceName, const wxResourceTable* resourceTable = NULL);
121 void Lower();
122 void MakeModal(bool flag);
af309447
RD
123 %name(MoveXY)void Move(int x, int y);
124 void Move(const wxPoint& point);
7bf85405
RD
125
126 //wxEvtHandler* PopEventHandler(bool deleteHandler = FALSE);
127 bool PopupMenu(wxMenu *menu, int x, int y);
128 //void PushEventHandler(wxEvtHandler* handler);
129
130 void Raise();
131 void Refresh(bool eraseBackground = TRUE, const wxRect* rect = NULL);
132 void ReleaseMouse();
af309447 133 %name(ScreenToClientXY)void ScreenToClient(int *BOTH, int *BOTH);
b57bdb5a 134#ifndef __WXGTK__
af309447 135 wxPoint ScreenToClient(const wxPoint& pt);
b57bdb5a 136#endif
af309447 137
7bf85405 138 void ScrollWindow(int dx, int dy, const wxRect* rect = NULL);
b8b8dda7 139 void SetAcceleratorTable(const wxAcceleratorTable& accel);
7bf85405
RD
140 void SetAutoLayout(bool autoLayout);
141 void SetBackgroundColour(const wxColour& colour);
142 void SetConstraints(wxLayoutConstraints *constraints);
143 void SetDoubleClick(bool allowDoubleClick);
144 void SetFocus();
145 void SetFont(const wxFont& font);
146 void SetForegroundColour(const wxColour& colour);
147 void SetId(int id);
148 void SetName(const wxString& name);
149 void SetReturnCode(int retCode);
150 void SetScrollbar(int orientation, int position, int thumbSize, int range, bool refresh = TRUE);
151 void SetScrollPos(int orientation, int pos, bool refresh = TRUE);
152
7bf85405
RD
153 %name(SetDimensions) void SetSize(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO);
154 %addmethods {
155 void SetSize(const wxSize& size) {
156 self->SetSize(size.x, size.y);
157 }
158
159 void SetPosition(const wxPoint& pos) {
160 self->SetSize(pos.x, pos.y, -1, -1);
161 }
162 }
163
164 void SetSizeHints(int minW=-1, int minH=-1, int maxW=-1, int maxH=-1, int incW=-1, int incH=-1);
af309447
RD
165 %name(SetClientSizeWH)void SetClientSize(int width, int height);
166 void SetClientSize(const wxSize& size);
7bf85405 167 //void SetPalette(wxPalette* palette);
7bf85405
RD
168 void SetCursor(const wxCursor&cursor);
169 //void SetEventHandler(wxEvtHandler* handler);
170 void SetTitle(const wxString& title);
171 bool Show(bool show);
172 bool TransferDataFromWindow();
173 bool TransferDataToWindow();
174 bool Validate();
175 void WarpPointer(int x, int y);
176
b8b8dda7
RD
177 %name(ConvertDialogPointToPixels) wxPoint ConvertDialogToPixels(const wxPoint& pt);
178 %name(ConvertDialogSizeToPixels) wxSize ConvertDialogToPixels(const wxSize& sz);
179
cf694132
RD
180 %name(DLG_PNT) wxPoint ConvertDialogToPixels(const wxPoint& pt);
181 %name(DLG_SZE) wxSize ConvertDialogToPixels(const wxSize& sz);
182
b8b8dda7
RD
183 %name(ConvertPixelPointToDialog) wxPoint ConvertPixelsToDialog(const wxPoint& pt);
184 %name(ConvertPixelSizeToDialog) wxSize ConvertPixelsToDialog(const wxSize& sz);
185
af309447
RD
186 %name(SetToolTipString)void SetToolTip(const wxString &tip);
187 void SetToolTip(wxToolTip *tooltip);
188 wxToolTip* GetToolTip();
7bf85405
RD
189};
190
b8b8dda7
RD
191%pragma(python) code = "
192def wxDLG_PNT(win, point):
193 return win.ConvertDialogPointToPixels(point)
194
195def wxDLG_SZE(win, size):
af309447 196 return win.ConvertDialogSizeToPixels(size)
b8b8dda7 197"
7bf85405 198
853b255a 199#ifdef __WXMSW__
7bf85405
RD
200%inline %{
201 wxWindow* wxWindow_FindFocus() {
202 return wxWindow::FindFocus();
203 }
204%}
af309447
RD
205
206
207%inline %{
208wxWindow* wxWindow_FromHWND(unsigned long hWnd) {
209 wxWindow* win = new wxWindow;
210 win->SetHWND(hWnd);
211 win->SubclassWin(hWnd);
212 return win;
213}
214%}
853b255a 215#endif
7bf85405 216
7bf85405
RD
217
218//---------------------------------------------------------------------------
219
220class wxPanel : public wxWindow {
221public:
222 wxPanel(wxWindow* parent,
223 const wxWindowID id,
224 const wxPoint& pos = wxPyDefaultPosition,
225 const wxSize& size = wxPyDefaultSize,
226 long style = wxTAB_TRAVERSAL,
227 const char* name = "panel");
228
b8b8dda7 229 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 230
7bf85405
RD
231 void InitDialog();
232};
233
234//---------------------------------------------------------------------------
235
236class wxDialog : public wxPanel {
237public:
238 wxDialog(wxWindow* parent,
239 const wxWindowID id,
240 const wxString& title,
241 const wxPoint& pos = wxPyDefaultPosition,
242 const wxSize& size = wxPyDefaultSize,
243 long style = wxDEFAULT_DIALOG_STYLE,
244 const char* name = "dialogBox");
245
b8b8dda7 246 %pragma(python) addtomethod = "__init__:wx._StdDialogCallbacks(self)"
9c039d08 247
7bf85405
RD
248 void Centre(int direction = wxBOTH);
249 void EndModal(int retCode);
250 wxString GetTitle();
251 void Iconize(bool iconize);
252 bool IsIconized();
7bf85405 253 void SetModal(bool flag);
853b255a 254 bool IsModal();
7bf85405
RD
255 void SetTitle(const wxString& title);
256 bool Show(bool show);
257 int ShowModal();
258};
259
260//---------------------------------------------------------------------------
261
262class wxScrolledWindow : public wxWindow {
263public:
264 wxScrolledWindow(wxWindow* parent,
265 const wxWindowID id = -1,
266 const wxPoint& pos = wxPyDefaultPosition,
267 const wxSize& size = wxPyDefaultSize,
268 long style = wxHSCROLL | wxVSCROLL,
269 char* name = "scrolledWindow");
270
b8b8dda7
RD
271 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
272 %pragma(python) addtomethod = "__init__:wx._StdOnScrollCallbacks(self)"
9c039d08 273
7bf85405
RD
274 void EnableScrolling(bool xScrolling, bool yScrolling);
275 void GetScrollPixelsPerUnit(int* OUTPUT, int* OUTPUT);
276 void GetVirtualSize(int* OUTPUT, int* OUTPUT);
277 bool IsRetained();
278 void PrepareDC(wxDC& dc);
279 void Scroll(int x, int y);
280 void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
281 int noUnitsX, int noUnitsY,
282 int xPos = 0, int yPos = 0);
283 void ViewStart(int* OUTPUT, int* OUTPUT);
284};
285
286//----------------------------------------------------------------------
287
288
289class wxMenu : public wxEvtHandler {
290public:
291 wxMenu(const wxString& title = wxPyEmptyStr);
292
293 void Append(int id, const wxString& item,
294 const wxString& helpString = wxPyEmptyStr,
295 int checkable = FALSE);
296 %name(AppendMenu)void Append(int id, const wxString& item, wxMenu *subMenu,
297 const wxString& helpString = wxPyEmptyStr);
b57bdb5a 298#ifndef __WXGTK__
af309447 299 %name(AppendItem)void Append(const wxMenuItem* item);
b57bdb5a 300#endif
af309447 301
7bf85405
RD
302 void AppendSeparator();
303 void Break();
304 void Check(int id, bool flag);
7bf85405
RD
305 void Enable(int id, bool enable);
306 int FindItem(const wxString& itemString);
7bf85405 307 wxString GetTitle();
7bf85405 308 void SetTitle(const wxString& title);
714e6a9e
RD
309 wxMenuItem* FindItemForId(int id);
310 wxString GetHelpString(int id);
311 wxString GetLabel(int id);
312 void SetHelpString(int id, const wxString& helpString);
853b255a
RD
313 bool IsChecked(int id);
314 bool IsEnabled(int id);
315 void SetLabel(int id, const wxString& label);
7bf85405
RD
316};
317
318
7bf85405
RD
319//
320// This one knows how to set a callback and handle INC- and DECREFing it. To
321// be used for PopupMenus, but you must retain a referece to it while using
322// it.
323//
324class wxPyMenu : public wxMenu {
325public:
326 wxPyMenu(const wxString& title = wxPyEmptyStr, PyObject* func = NULL);
327 ~wxPyMenu();
328};
329
330//----------------------------------------------------------------------
331
332class wxMenuBar : public wxEvtHandler {
333public:
334 wxMenuBar();
335
336 void Append(wxMenu *menu, const wxString& title);
337 void Check(int id, bool flag);
338 bool Checked(int id);
339 void Enable(int id, bool enable);
714e6a9e 340 bool Enabled(int id);
7bf85405 341 int FindMenuItem(const wxString& menuString, const wxString& itemString);
c95e68d8 342 wxMenuItem * FindItemForId(int id);
aeeb6a44 343#ifdef __WXMSW__
714e6a9e 344 void EnableTop(int pos, bool enable);
7bf85405
RD
345 wxString GetHelpString(int id);
346 wxString GetLabel(int id);
7bf85405
RD
347 void SetHelpString(int id, const wxString& helpString);
348 void SetLabel(int id, const wxString& label);
853b255a 349 wxString GetLabelTop(int pos);
7bf85405 350 void SetLabelTop(int pos, const wxString& label);
853b255a 351#endif
714e6a9e
RD
352 int GetMenuCount();
353 wxMenu* GetMenu(int i);
7bf85405
RD
354};
355
356
357//----------------------------------------------------------------------
358
359class wxMenuItem {
360public:
cf694132
RD
361#ifndef __WXGTK__
362 wxMenuItem(wxMenu* parentMenu=NULL, int id=ID_SEPARATOR,
363 const wxString& text = wxPyEmptyStr,
364 const wxString& helpString = wxPyEmptyStr,
365 bool checkable = FALSE, wxMenu* subMenu = NULL);
366#else
367 wxMenuItem();
368#endif
369
7bf85405
RD
370 bool IsSeparator();
371 bool IsEnabled();
372 bool IsChecked();
714e6a9e 373 bool IsCheckable();
7bf85405 374 int GetId();
7bf85405
RD
375 wxMenu* GetSubMenu();
376 void SetName(const wxString& strName);
cf694132
RD
377 wxString GetName();
378 wxString GetHelp();
714e6a9e
RD
379 void SetHelp(const wxString& strHelp);
380 void Enable(bool bDoEnable = TRUE);
381 void Check(bool bDoCheck = TRUE);
c95e68d8 382
4f22cf8d 383#ifdef __WXMSW__
cf694132
RD
384 wxColour& GetBackgroundColour();
385 wxBitmap GetBitmap(bool checked = TRUE);
386 wxFont& GetFont();
387 int GetMarginWidth();
388 wxColour& GetTextColour();
389 void SetBackgroundColour(const wxColour& colour);
390 void SetBitmaps(const wxBitmap& checked, const wxBitmap& unchecked = wxNullBitmap);
391 void SetFont(const wxFont& font);
392 void SetMarginWidth(int width);
393 void SetTextColour(const wxColour& colour);
4f22cf8d
RR
394 void DeleteSubMenu();
395#endif
7bf85405
RD
396};
397
398//---------------------------------------------------------------------------
399/////////////////////////////////////////////////////////////////////////////
400//
401// $Log$
cf694132
RD
402// Revision 1.15 1999/04/30 03:29:19 RD
403// wxPython 2.0b9, first phase (win32)
404// Added gobs of stuff, see wxPython/README.txt for details
405//
406// Revision 1.14.4.3 1999/03/27 23:29:15 RD
407//
408// wxPython 2.0b8
409// Python thread support
410// various minor additions
411// various minor fixes
412//
413// Revision 1.14.4.2 1999/03/16 06:26:29 RD
414//
415// wxPython 2.0b7
416//
417// Revision 1.14.4.1 1999/03/16 06:04:04 RD
418//
419// wxPython 2.0b7
420//
afc48cd0 421// Revision 1.14 1999/02/23 23:48:33 RD
cf694132 422//
afc48cd0
RD
423// reenabled some methods for wxPython on wxGTK
424//
b57bdb5a 425// Revision 1.13 1999/02/20 10:02:38 RD
afc48cd0 426//
b57bdb5a
RD
427// Changes needed to enable wxGTK compatibility.
428//
af309447
RD
429// Revision 1.12 1999/02/20 09:03:03 RD
430// Added wxWindow_FromHWND(hWnd) for wxMSW to construct a wxWindow from a
431// window handle. If you can get the window handle into the python code,
432// it should just work... More news on this later.
433//
434// Added wxImageList, wxToolTip.
435//
436// Re-enabled wxConfig.DeleteAll() since it is reportedly fixed for the
437// wxRegConfig class.
438//
439// As usual, some bug fixes, tweaks, etc.
440//
aeeb6a44 441// Revision 1.11 1998/12/18 15:49:10 RR
af309447 442//
aeeb6a44
RR
443// wxClipboard now serves the primary selection as well
444// wxPython fixes
445// warning mesages
446//
c95e68d8 447// Revision 1.10 1998/12/17 17:52:20 RD
aeeb6a44 448//
c95e68d8
RD
449// wxPython 0.5.2
450// Minor fixes and SWIG code generation for RR's changes. MSW and GTK
451// versions are much closer now!
452//
4f22cf8d 453// Revision 1.9 1998/12/17 14:07:46 RR
c95e68d8 454//
4f22cf8d
RR
455// Removed minor differences between wxMSW and wxGTK
456//
105e45b9 457// Revision 1.8 1998/12/16 22:10:56 RD
4f22cf8d 458//
105e45b9
RD
459// Tweaks needed to be able to build wxPython with wxGTK.
460//
b8b8dda7
RD
461// Revision 1.7 1998/12/15 20:41:25 RD
462// Changed the import semantics from "from wxPython import *" to "from
463// wxPython.wx import *" This is for people who are worried about
464// namespace pollution, they can use "from wxPython import wx" and then
465// prefix all the wxPython identifiers with "wx."
466//
467// Added wxTaskbarIcon for wxMSW.
468//
469// Made the events work for wxGrid.
470//
471// Added wxConfig.
472//
473// Added wxMiniFrame for wxGTK, (untested.)
474//
475// Changed many of the args and return values that were pointers to gdi
476// objects to references to reflect changes in the wxWindows API.
477//
478// Other assorted fixes and additions.
479//
9c039d08 480// Revision 1.6 1998/10/02 06:40:43 RD
b8b8dda7 481//
9c039d08
RD
482// Version 0.4 of wxPython for MSW.
483//
652e7bb4
RD
484// Revision 1.5 1998/08/17 18:29:40 RD
485// Removed an extra method definition
486//
714e6a9e
RD
487// Revision 1.4 1998/08/16 04:31:11 RD
488// More wxGTK work.
489//
03e9bead
RD
490// Revision 1.3 1998/08/15 07:36:47 RD
491// - Moved the header in the .i files out of the code that gets put into
492// the .cpp files. It caused CVS conflicts because of the RCS ID being
493// different each time.
494//
495// - A few minor fixes.
496//
853b255a
RD
497// Revision 1.2 1998/08/14 23:36:46 RD
498// Beginings of wxGTK compatibility
499//
7bf85405
RD
500// Revision 1.1 1998/08/09 08:25:52 RD
501// Initial version
502//
503//
504
505