]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/windows2.i
fix text scrolling in GTK2 (patch 703988)
[wxWidgets.git] / wxPython / src / windows2.i
CommitLineData
7bf85405
RD
1/////////////////////////////////////////////////////////////////////////////
2// Name: windows2.i
3// Purpose: SWIG definitions of MORE window classes
4//
5// Author: Robin Dunn
6//
7// Created: 6/2/98
8// RCS-ID: $Id$
9// Copyright: (c) 1998 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
03e9bead 13%module windows2
7bf85405 14
03e9bead 15%{
7bf85405 16#include "helpers.h"
7bf85405 17#include <wx/notebook.h>
edadef3f 18#include <wx/listbook.h>
9c039d08 19#include <wx/splitter.h>
9416aa89 20#include <wx/imaglist.h>
b639c3c5 21#ifdef __WXMSW__
5a2a9da2 22#include <wx/taskbar.h>
b639c3c5 23#endif
7bf85405
RD
24%}
25
26//----------------------------------------------------------------------
27
137b5242
RD
28%{
29 // Put some wx default wxChar* values into wxStrings.
30 DECLARE_DEF_STRING(NOTEBOOK_NAME);
0b85cc38 31 DECLARE_DEF_STRING(PanelNameStr);
b0e5c039 32 DECLARE_DEF_STRING(ControlNameStr);
137b5242
RD
33
34 static const wxChar* wxSplitterNameStr = wxT("splitter");
35 DECLARE_DEF_STRING(SplitterNameStr);
36 static const wxString wxPyEmptyString(wxT(""));
37%}
38
39//----------------------------------------------------------------------
40
7bf85405
RD
41%include typemaps.i
42%include my_typemaps.i
43
44// Import some definitions of other classes, etc.
45%import _defs.i
46%import misc.i
47%import gdi.i
48%import windows.i
49%import controls.i
50%import events.i
51
b8b8dda7 52%pragma(python) code = "import wx"
9c039d08 53
edadef3f
RD
54//---------------------------------------------------------------------------
55//---------------------------------------------------------------------------
56
57// TODO: Virtualize this class so other book controls can be derived in Python
58
59class wxBookCtrl : public wxControl
60{
61public:
62 // This is an ABC, it can't be constructed...
63// wxBookCtrl(wxWindow *parent,
64// wxWindowID id,
65// const wxPoint& pos = wxDefaultPosition,
66// const wxSize& size = wxDefaultSize,
67// long style = 0,
68// const wxString& name = wxPyEmptyString);
69// %name(wxPreBookCtrl)wxBookCtrl();
70// bool Create(wxWindow *parent,
71// wxWindowID id,
72// const wxPoint& pos = wxDefaultPosition,
73// const wxSize& size = wxDefaultSize,
74// long style = 0,
75// const wxString& name = wxPyEmptyString);
76// %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
77// %pragma(python) addtomethod = "wxPreBookCtrl:val._setOORInfo(val)"
78
79
80 // get number of pages in the dialog
81 virtual size_t GetPageCount() const;
82
83 // get the panel which represents the given page
84 virtual wxWindow *GetPage(size_t n);
85
86 // get the currently selected page or wxNOT_FOUND if none
87 virtual int GetSelection() const = 0;
88
89 // set/get the title of a page
90 virtual bool SetPageText(size_t n, const wxString& strText) = 0;
91 virtual wxString GetPageText(size_t n) const = 0;
92
93
94 // image list stuff: each page may have an image associated with it (all
95 // images belong to the same image list)
96
97 // sets the image list to use, it is *not* deleted by the control
98 virtual void SetImageList(wxImageList *imageList);
99
100 // as SetImageList() but we will delete the image list ourselves
101 void AssignImageList(wxImageList *imageList);
102 %pragma(python) addtomethod = "AssignImageList:_args[0].thisown = 0"
103
104 // get pointer (may be NULL) to the associated image list
105 wxImageList* GetImageList() const;
106
107 // sets/returns item's image index in the current image list
108 virtual int GetPageImage(size_t n) const = 0;
109 virtual bool SetPageImage(size_t n, int imageId) = 0;
110
111
112 // resize the notebook so that all pages will have the specified size
113 virtual void SetPageSize(const wxSize& size);
114
115 // calculate the size of the control from the size of its page
116 virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const = 0;
117
118
119
120 // remove one page from the control and delete it
121 virtual bool DeletePage(size_t n);
122
123 // remove one page from the notebook, without deleting it
124 virtual bool RemovePage(size_t n);
125
126 // remove all pages and delete them
127 virtual bool DeleteAllPages();
128
129 // adds a new page to the control
130 virtual bool AddPage(wxWindow *page,
131 const wxString& text,
132 bool bSelect = false,
133 int imageId = -1);
134
135 // the same as AddPage(), but adds the page at the specified position
136 virtual bool InsertPage(size_t n,
137 wxWindow *page,
138 const wxString& text,
139 bool bSelect = false,
140 int imageId = -1) = 0;
141
142 // set the currently selected page, return the index of the previously
143 // selected one (or -1 on error)
144 //
145 // NB: this function will _not_ generate PAGE_CHANGING/ED events
146 virtual int SetSelection(size_t n) = 0;
147
148
149 // cycle thru the pages
150 void AdvanceSelection(bool forward = true);
151};
152
153
154
155class wxBookCtrlEvent : public wxNotifyEvent
156{
157public:
158 wxBookCtrlEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
159 int nSel = -1, int nOldSel = -1);
160
161 // the currently selected page (-1 if none)
162 int GetSelection() const;
163 void SetSelection(int nSel);
164 // the page that was selected before the change (-1 if none)
165 int GetOldSelection() const;
166 void SetOldSelection(int nOldSel);
167};
168
169
7bf85405
RD
170//---------------------------------------------------------------------------
171
1b62f00d 172enum {
3ef86e32 173 // notebook control event types
1b62f00d
RD
174 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
175 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING,
3ef86e32
RD
176
177 // styles
178 wxNB_FIXEDWIDTH,
179 wxNB_TOP,
180 wxNB_LEFT,
181 wxNB_RIGHT,
182 wxNB_BOTTOM,
183 wxNB_MULTILINE,
184
185 // hittest flags
186 wxNB_HITTEST_NOWHERE = 1, // not on tab
187 wxNB_HITTEST_ONICON = 2, // on icon
188 wxNB_HITTEST_ONLABEL = 4, // on label
189 wxNB_HITTEST_ONITEM = wxNB_HITTEST_ONICON | wxNB_HITTEST_ONLABEL,
190
1b62f00d
RD
191};
192
193
09f3d4e6 194
edadef3f 195class wxNotebook : public wxBookCtrl {
7bf85405
RD
196public:
197 wxNotebook(wxWindow *parent,
198 wxWindowID id,
b68dc582
RD
199 const wxPoint& pos = wxDefaultPosition,
200 const wxSize& size = wxDefaultSize,
7bf85405 201 long style = 0,
137b5242 202 const wxString& name = wxPyNOTEBOOK_NAME);
09f3d4e6 203 %name(wxPreNotebook)wxNotebook();
7bf85405 204
09f3d4e6
RD
205 bool Create(wxWindow *parent,
206 wxWindowID id,
207 const wxPoint& pos = wxDefaultPosition,
208 const wxSize& size = wxDefaultSize,
209 long style = 0,
137b5242 210 const wxString& name = wxPyNOTEBOOK_NAME);
9c039d08 211
0122b7e3 212 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
17c0e08c 213 %pragma(python) addtomethod = "wxPreNotebook:val._setOORInfo(val)"
0122b7e3 214
949853a4 215
edadef3f
RD
216 // get the number of rows for a control with wxNB_MULTILINE style (not all
217 // versions support it - they will always return 1 then)
218 virtual int GetRowCount() const;
3ef86e32 219
edadef3f
RD
220 // set the padding between tabs (in pixels)
221 virtual void SetPadding(const wxSize& padding);
3ef86e32 222
edadef3f
RD
223 // set the size of the tabs for wxNB_FIXEDWIDTH controls
224 virtual void SetTabSize(const wxSize& sz);
3ef86e32 225
edadef3f
RD
226 // hit test, returns which tab is hit and, optionally, where (icon, label)
227 // (not implemented on all platforms)
228 virtual int HitTest(const wxPoint& pt, long* OUTPUT) const;
3ef86e32 229
edadef3f
RD
230 // implement some base class functions
231 virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
3ef86e32 232
edadef3f 233#ifdef __WXMSW__
edadef3f
RD
234 // Windows only: attempts to apply the UX theme page background to this page
235 void ApplyThemeBackground(wxWindow* window, const wxColour& colour);
236#endif
237};
3ef86e32 238
3ef86e32 239
3ef86e32 240
3ef86e32 241
3ef86e32 242
edadef3f
RD
243class wxNotebookEvent : public wxNotifyEvent {
244public:
245 wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
246 int sel = -1, int oldSel = -1);
3ef86e32 247
edadef3f
RD
248 int GetSelection();
249 int GetOldSelection();
250 void SetOldSelection(int page);
251 void SetSelection(int page);
252};
3ef86e32
RD
253
254
edadef3f
RD
255%pragma(python) code = "
256# wxNotebook events
257def EVT_NOTEBOOK_PAGE_CHANGED(win, id, func):
258 win.Connect(id, -1, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, func)
3ef86e32 259
edadef3f
RD
260def EVT_NOTEBOOK_PAGE_CHANGING(win, id, func):
261 win.Connect(id, -1, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, func)
262"
3ef86e32 263
3ef86e32 264
edadef3f 265//---------------------------------------------------------------------------
3ef86e32 266
cf694132 267
edadef3f
RD
268enum
269{
270 // default alignment: left everywhere except Mac where it is top
271 wxLB_DEFAULT = 0,
3ef86e32 272
edadef3f
RD
273 // put the list control to the left/right/top/bottom of the page area
274 wxLB_TOP = 0x1,
275 wxLB_BOTTOM = 0x2,
276 wxLB_LEFT = 0x4,
277 wxLB_RIGHT = 0x8,
278
279 // the mask which can be used to extract the alignment from the style
280 wxLB_ALIGN_MASK = 0xf,
281
282
283 wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED,
284 wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING,
285
286};
287
288
289
290class wxListbook : public wxBookCtrl
291{
292public:
293 wxListbook(wxWindow *parent,
294 wxWindowID id,
295 const wxPoint& pos = wxDefaultPosition,
296 const wxSize& size = wxDefaultSize,
297 long style = 0,
298 const wxString& name = wxPyEmptyString);
299 %name(wxPreListbook)wxListbook();
3ef86e32 300
edadef3f
RD
301 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
302 %pragma(python) addtomethod = "wxPreListbook:val._setOORInfo(val)"
303
304
305 bool Create(wxWindow *parent,
306 wxWindowID id,
307 const wxPoint& pos = wxDefaultPosition,
308 const wxSize& size = wxDefaultSize,
309 long style = 0,
310 const wxString& name = wxPyEmptyString);
311
312 // returns true if we have wxLB_TOP or wxLB_BOTTOM style
313 bool IsVertical() const;
cf694132 314
7bf85405
RD
315};
316
edadef3f
RD
317
318
319class wxListbookEvent : public wxBookCtrlEvent
320{
321public:
322 wxListbookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
323 int nSel = -1, int nOldSel = -1);
324};
325
326
327
328%pragma(python) code = "
329#wxListbook events
330def EVT_LISTBOOK_PAGE_CHANGED(win, id, func):
331 win.Connect(id, -1, wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, func)
332
333def EVT_LISTBOOK_PAGE_CHANGING(win, id, func):
334 win.Connect(id, -1, wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, func)
335"
336
337//---------------------------------------------------------------------------
9c039d08
RD
338//---------------------------------------------------------------------------
339
f6bcfd97 340
1b62f00d
RD
341enum {
342 /* splitter window events */
343 wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING,
344 wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED,
345 wxEVT_COMMAND_SPLITTER_UNSPLIT,
346 wxEVT_COMMAND_SPLITTER_DOUBLECLICKED,
1b62f00d 347
f6bcfd97
BP
348 wxSPLIT_HORIZONTAL,
349 wxSPLIT_VERTICAL,
350 wxSPLIT_DRAG_NONE,
351 wxSPLIT_DRAG_DRAGGING,
3ef86e32
RD
352 wxSPLIT_DRAG_LEFT_DOWN,
353
354 wxSP_VERTICAL,
355 wxSP_HORIZONTAL,
356 wxSP_ARROW_KEYS,
357 wxSP_WRAP,
358 wxSP_NOBORDER,
359 wxSP_3D,
360 wxSP_3DSASH,
361 wxSP_3DBORDER,
362 wxSP_FULLSASH,
363 wxSP_BORDER,
364 wxSP_LIVE_UPDATE,
365 wxSP_PERMIT_UNSPLIT
f6bcfd97
BP
366};
367
368
756ed80c 369class wxSplitterEvent : public wxNotifyEvent {
bb0054cd 370public:
09f3d4e6
RD
371 wxSplitterEvent(wxEventType type = wxEVT_NULL,
372 wxSplitterWindow *splitter = NULL);
373
bb0054cd
RD
374 int GetSashPosition();
375 int GetX();
376 int GetY();
377 wxWindow* GetWindowBeingRemoved();
378 void SetSashPosition(int pos);
379}
380
381
382
383
9c039d08
RD
384class wxSplitterWindow : public wxWindow {
385public:
386 wxSplitterWindow(wxWindow* parent, wxWindowID id,
b68dc582
RD
387 const wxPoint& point = wxDefaultPosition,
388 const wxSize& size = wxDefaultSize,
b639c3c5 389 long style=wxSP_3D|wxCLIP_CHILDREN,
137b5242 390 const wxString& name = wxPySplitterNameStr);
09f3d4e6 391 %name(wxPreSplitterWindow)wxSplitterWindow();
9c039d08 392
09f3d4e6
RD
393 bool Create(wxWindow* parent, wxWindowID id,
394 const wxPoint& point = wxDefaultPosition,
395 const wxSize& size = wxDefaultSize,
396 long style=wxSP_3D|wxCLIP_CHILDREN,
137b5242 397 const wxString& name = wxPySplitterNameStr);
9c039d08 398
0122b7e3 399 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
17c0e08c 400 %pragma(python) addtomethod = "wxPreSplitterWindow:val._setOORInfo(val)"
09f3d4e6
RD
401
402 // Gets the only or left/top pane
403 wxWindow *GetWindow1();
404
405 // Gets the right/bottom pane
406 wxWindow *GetWindow2();
407
408 // Sets the split mode
409 void SetSplitMode(int mode);
410
411 // Gets the split mode
9c039d08 412 int GetSplitMode();
09f3d4e6
RD
413
414 // Initialize with one window
415 void Initialize(wxWindow *window);
416
417 // Associates the given window with window 2, drawing the appropriate sash
418 // and changing the split mode.
419 // Does nothing and returns FALSE if the window is already split.
420 // A sashPosition of 0 means choose a default sash position,
421 // negative sashPosition specifies the size of right/lower pane as it's
422 // absolute value rather than the size of left/upper pane.
423 virtual bool SplitVertically(wxWindow *window1,
424 wxWindow *window2,
425 int sashPosition = 0);
426 virtual bool SplitHorizontally(wxWindow *window1,
427 wxWindow *window2,
428 int sashPosition = 0);
429
430 // Removes the specified (or second) window from the view
431 // Doesn't actually delete the window.
432 bool Unsplit(wxWindow *toRemove = NULL);
433
434 // Replaces one of the windows with another one (neither old nor new
435 // parameter should be NULL)
436 bool ReplaceWindow(wxWindow *winOld, wxWindow *winNew);
437
438 // Is the window split?
9c039d08
RD
439 bool IsSplit();
440
09f3d4e6 441 // Sets the sash size
b639c3c5 442 void SetSashSize(int width);
09f3d4e6
RD
443
444 // Sets the border size
445 void SetBorderSize(int width);
446
447 // Gets the sash size
448 int GetSashSize();
449
450 // Gets the border size
451 int GetBorderSize();
452
453 // Set the sash position
454 void SetSashPosition(int position, bool redraw = TRUE);
455
456 // Gets the sash position
457 int GetSashPosition();
458
459 // If this is zero, we can remove panes by dragging the sash.
460 void SetMinimumPaneSize(int min);
461 int GetMinimumPaneSize();
462
3bd1e033
RD
463 // Resizes subwindows
464 virtual void SizeWindows();
465
466 void SetNeedUpdating(bool needUpdating) { m_needUpdating = needUpdating; }
467 bool GetNeedUpdating() const { return m_needUpdating ; }
468
9c039d08
RD
469};
470
471//---------------------------------------------------------------------------
472
3ef86e32 473// TODO: This should be usable on wxGTK now too...
b639c3c5
RD
474#ifdef __WXMSW__
475
476enum {
477 wxEVT_TASKBAR_MOVE,
478 wxEVT_TASKBAR_LEFT_DOWN,
479 wxEVT_TASKBAR_LEFT_UP,
480 wxEVT_TASKBAR_RIGHT_DOWN,
481 wxEVT_TASKBAR_RIGHT_UP,
482 wxEVT_TASKBAR_LEFT_DCLICK,
483 wxEVT_TASKBAR_RIGHT_DCLICK
484};
9c039d08
RD
485
486
3ef86e32
RD
487class wxTaskBarIconEvent : public wxEvent
488{
489public:
490 wxTaskBarIconEvent(wxEventType evtType, wxTaskBarIcon *tbIcon);
491};
492
493
b639c3c5
RD
494class wxTaskBarIcon : public wxEvtHandler {
495public:
496 wxTaskBarIcon();
497 ~wxTaskBarIcon();
498
0122b7e3
RD
499 //%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
500
c368d904 501 // We still use the magic methods here since that is the way it is documented...
b8b8dda7
RD
502 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnMouseMove', wxEVT_TASKBAR_MOVE)"
503 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDown', wxEVT_TASKBAR_LEFT_DOWN)"
504 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonUp', wxEVT_TASKBAR_LEFT_UP)"
505 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDown', wxEVT_TASKBAR_RIGHT_DOWN)"
506 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonUp', wxEVT_TASKBAR_RIGHT_UP)"
507 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDClick',wxEVT_TASKBAR_LEFT_DCLICK)"
508 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDClick',wxEVT_TASKBAR_RIGHT_DCLICK)"
b639c3c5 509
137b5242 510 bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxPyEmptyString);
b639c3c5 511 bool RemoveIcon(void);
be4d9c1f 512 bool PopupMenu(wxMenu *menu);
c368d904
RD
513 bool IsIconInstalled();
514 bool IsOK();
b639c3c5 515};
3ef86e32
RD
516
517
518
519%pragma(python) code = "
520def EVT_TASKBAR_MOVE(win, func):
521 win.Connect(-1, -1, wxEVT_TASKBAR_MOVE, func)
522
523def EVT_TASKBAR_LEFT_DOWN(win, func):
524 win.Connect(-1, -1, wxEVT_TASKBAR_LEFT_DOWN, func)
525
526def EVT_TASKBAR_LEFT_UP(win, func):
527 win.Connect(-1, -1, wxEVT_TASKBAR_LEFT_UP, func)
528
529def EVT_TASKBAR_RIGHT_DOWN(win, func):
530 win.Connect(-1, -1, wxEVT_TASKBAR_RIGHT_DOWN, func)
531
532def EVT_TASKBAR_RIGHT_UP(win, func):
533 win.Connect(-1, -1, wxEVT_TASKBAR_RIGHT_UP, func)
534
535def EVT_TASKBAR_LEFT_DCLICK(win, func):
536 win.Connect(-1, -1, wxEVT_TASKBAR_LEFT_DCLICK, func)
537
538def EVT_TASKBAR_RIGHT_DCLICK(win, func):
539 win.Connect(-1, -1, wxEVT_TASKBAR_RIGHT_DCLICK, func)
540"
541
542
b639c3c5
RD
543#endif
544
0b85cc38
RD
545//---------------------------------------------------------------------------
546//---------------------------------------------------------------------------
547// wxPyWindow derives from wxWindow and adds support for overriding many of
548// the virtual methods in Python derived classes.
549
efe12e95 550// Which (any?) of these should be done also???
b0e5c039
RD
551// Destroy
552// DoCaptureMouse
553// DoClientToScreen
554// DoHitTest
555// DoMoveWindow
556// DoPopupMenu
557// DoReleaseMouse
558// DoScreenToClient
559// DoSetToolTip
0b85cc38 560// Enable
b0e5c039
RD
561// Fit
562// GetCharHeight
563// GetCharWidth
564// GetClientAreaOrigin
0b85cc38 565// GetDefaultItem
0b85cc38 566// IsTopLevel
0b85cc38 567// SetBackgroundColour
b0e5c039
RD
568// SetDefaultItem
569// SetFocus
570// SetFocusFromKbd
0b85cc38 571// SetForegroundColour
b0e5c039
RD
572// SetSizeHints
573// SetVirtualSizeHints
574// Show
575
576
577%{ // C++ version of Python aware wxWindow
578class wxPyWindow : public wxWindow
579{
580 DECLARE_DYNAMIC_CLASS(wxPyWindow)
581public:
582 wxPyWindow() : wxWindow() {}
583 wxPyWindow(wxWindow* parent, const wxWindowID id,
584 const wxPoint& pos = wxDefaultPosition,
585 const wxSize& size = wxDefaultSize,
586 long style = 0,
587 const wxString& name = wxPyPanelNameStr)
588 : wxWindow(parent, id, pos, size, style, name) {}
589
590
591 DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
592 DEC_PYCALLBACK_VOID_INT5(DoSetSize);
593 DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
594 DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
595
596 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
597 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
598 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
599
600 DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
601 DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
602
603 DEC_PYCALLBACK__(InitDialog);
604 DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
605 DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
606 DEC_PYCALLBACK_BOOL_(Validate);
607
608 DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
609 DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
610 DEC_PYCALLBACK_SIZE_const(GetMaxSize);
611
aaad759f
RD
612 DEC_PYCALLBACK_VOID_WXWINBASE(AddChild);
613 DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild);
614
b0e5c039
RD
615 PYPRIVATE;
616};
0b85cc38 617
b0e5c039 618IMPLEMENT_DYNAMIC_CLASS(wxPyWindow, wxWindow);
0b85cc38 619
b0e5c039
RD
620IMP_PYCALLBACK_VOID_INT4(wxPyWindow, wxWindow, DoMoveWindow);
621IMP_PYCALLBACK_VOID_INT5(wxPyWindow, wxWindow, DoSetSize);
622IMP_PYCALLBACK_VOID_INTINT(wxPyWindow, wxWindow, DoSetClientSize);
623IMP_PYCALLBACK_VOID_INTINT(wxPyWindow, wxWindow, DoSetVirtualSize);
0b85cc38 624
b0e5c039
RD
625IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetSize);
626IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetClientSize);
627IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetPosition);
0b85cc38 628
b0e5c039
RD
629IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, DoGetVirtualSize);
630IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, DoGetBestSize);
0b85cc38 631
b0e5c039
RD
632IMP_PYCALLBACK__(wxPyWindow, wxWindow, InitDialog);
633IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, TransferDataFromWindow);
634IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, TransferDataToWindow);
635IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, Validate);
636
637IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocus);
638IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocusFromKeyboard);
639IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, GetMaxSize);
640
aaad759f
RD
641IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWindow, wxWindow, AddChild);
642IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWindow, wxWindow, RemoveChild);
643
b0e5c039
RD
644%}
645
646// And now the one for SWIG to see
647class wxPyWindow : public wxWindow
648{
649public:
650 wxPyWindow(wxWindow* parent, const wxWindowID id,
651 const wxPoint& pos = wxDefaultPosition,
652 const wxSize& size = wxDefaultSize,
653 long style = 0,
654 const wxString& name = wxPyPanelNameStr);
655
656 void _setCallbackInfo(PyObject* self, PyObject* _class);
657 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyWindow)"
658 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
659
660
661 void base_DoMoveWindow(int x, int y, int width, int height);
662 void base_DoSetSize(int x, int y, int width, int height,
663 int sizeFlags = wxSIZE_AUTO);
664 void base_DoSetClientSize(int width, int height);
665 void base_DoSetVirtualSize( int x, int y );
666
667 void base_DoGetSize( int *OUTPUT, int *OUTPUT ) const;
668 void base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const;
669 void base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const;
670
671 wxSize base_DoGetVirtualSize() const;
672 wxSize base_DoGetBestSize() const;
673
674 void base_InitDialog();
675 bool base_TransferDataToWindow();
676 bool base_TransferDataFromWindow();
677 bool base_Validate();
678
679 bool base_AcceptsFocus() const;
680 bool base_AcceptsFocusFromKeyboard() const;
681 wxSize base_GetMaxSize() const;
aaad759f
RD
682
683 void base_AddChild(wxWindow* child);
684 void base_RemoveChild(wxWindow* child);
b0e5c039
RD
685}
686
687//---------------------------------------------------------------------------
688// Do the same thing for wxControl
689
690
691%{ // C++ version of Python aware wxControl
692class wxPyControl : public wxControl
693{
694 DECLARE_DYNAMIC_CLASS(wxPyControl)
695public:
696 wxPyControl() : wxControl() {}
697 wxPyControl(wxWindow* parent, const wxWindowID id,
698 const wxPoint& pos = wxDefaultPosition,
699 const wxSize& size = wxDefaultSize,
700 long style = 0,
701 const wxValidator& validator=wxDefaultValidator,
702 const wxString& name = wxPyControlNameStr)
703 : wxControl(parent, id, pos, size, style, validator, name) {}
704
705
706 DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
707 DEC_PYCALLBACK_VOID_INT5(DoSetSize);
708 DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
709 DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
710
711 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
712 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
713 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
714
715 DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
716 DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
717
718 DEC_PYCALLBACK__(InitDialog);
719 DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
720 DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
721 DEC_PYCALLBACK_BOOL_(Validate);
722
723 DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
724 DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
725 DEC_PYCALLBACK_SIZE_const(GetMaxSize);
726
aaad759f
RD
727 DEC_PYCALLBACK_VOID_WXWINBASE(AddChild);
728 DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild);
729
b0e5c039
RD
730 PYPRIVATE;
731};
732
733IMPLEMENT_DYNAMIC_CLASS(wxPyControl, wxControl);
734
735IMP_PYCALLBACK_VOID_INT4(wxPyControl, wxControl, DoMoveWindow);
736IMP_PYCALLBACK_VOID_INT5(wxPyControl, wxControl, DoSetSize);
737IMP_PYCALLBACK_VOID_INTINT(wxPyControl, wxControl, DoSetClientSize);
738IMP_PYCALLBACK_VOID_INTINT(wxPyControl, wxControl, DoSetVirtualSize);
739
740IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyControl, wxControl, DoGetSize);
741IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyControl, wxControl, DoGetClientSize);
742IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyControl, wxControl, DoGetPosition);
743
744IMP_PYCALLBACK_SIZE_const(wxPyControl, wxControl, DoGetVirtualSize);
745IMP_PYCALLBACK_SIZE_const(wxPyControl, wxControl, DoGetBestSize);
746
747IMP_PYCALLBACK__(wxPyControl, wxControl, InitDialog);
748IMP_PYCALLBACK_BOOL_(wxPyControl, wxControl, TransferDataFromWindow);
749IMP_PYCALLBACK_BOOL_(wxPyControl, wxControl, TransferDataToWindow);
750IMP_PYCALLBACK_BOOL_(wxPyControl, wxControl, Validate);
751
752IMP_PYCALLBACK_BOOL_const(wxPyControl, wxControl, AcceptsFocus);
753IMP_PYCALLBACK_BOOL_const(wxPyControl, wxControl, AcceptsFocusFromKeyboard);
754IMP_PYCALLBACK_SIZE_const(wxPyControl, wxControl, GetMaxSize);
755
aaad759f
RD
756IMP_PYCALLBACK_VOID_WXWINBASE(wxPyControl, wxControl, AddChild);
757IMP_PYCALLBACK_VOID_WXWINBASE(wxPyControl, wxControl, RemoveChild);
758
b0e5c039
RD
759%}
760
761// And now the one for SWIG to see
762class wxPyControl : public wxControl
763{
764public:
765 wxPyControl(wxWindow* parent, const wxWindowID id,
766 const wxPoint& pos = wxDefaultPosition,
767 const wxSize& size = wxDefaultSize,
768 long style = 0,
769 const wxValidator& validator=wxDefaultValidator,
770 const wxString& name = wxPyControlNameStr);
771
772 void _setCallbackInfo(PyObject* self, PyObject* _class);
773 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyControl)"
774 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
775
776
777 void base_DoMoveWindow(int x, int y, int width, int height);
778 void base_DoSetSize(int x, int y, int width, int height,
779 int sizeFlags = wxSIZE_AUTO);
780 void base_DoSetClientSize(int width, int height);
781 void base_DoSetVirtualSize( int x, int y );
782
783 void base_DoGetSize( int *OUTPUT, int *OUTPUT ) const;
784 void base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const;
785 void base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const;
786
787 wxSize base_DoGetVirtualSize() const;
788 wxSize base_DoGetBestSize() const;
789
790 void base_InitDialog();
791 bool base_TransferDataToWindow();
792 bool base_TransferDataFromWindow();
793 bool base_Validate();
794
795 bool base_AcceptsFocus() const;
796 bool base_AcceptsFocusFromKeyboard() const;
797 wxSize base_GetMaxSize() const;
aaad759f
RD
798
799 void base_AddChild(wxWindow* child);
800 void base_RemoveChild(wxWindow* child);
b0e5c039 801}
0b85cc38 802
86a12675
RD
803//---------------------------------------------------------------------------
804// and for wxPanel
805
806%{ // C++ version of Python aware wxPanel
807class wxPyPanel : public wxPanel
808{
809 DECLARE_DYNAMIC_CLASS(wxPyPanel)
810public:
811 wxPyPanel() : wxPanel() {}
812 wxPyPanel(wxWindow* parent, const wxWindowID id,
813 const wxPoint& pos = wxDefaultPosition,
814 const wxSize& size = wxDefaultSize,
815 long style = 0,
816 const wxString& name = wxPyPanelNameStr)
817 : wxPanel(parent, id, pos, size, style, name) {}
818
819
820 DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
821 DEC_PYCALLBACK_VOID_INT5(DoSetSize);
822 DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
823 DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
824
825 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
826 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
827 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
828
829 DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
830 DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
831
832 DEC_PYCALLBACK__(InitDialog);
833 DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
834 DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
835 DEC_PYCALLBACK_BOOL_(Validate);
836
837 DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
838 DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
839 DEC_PYCALLBACK_SIZE_const(GetMaxSize);
840
aaad759f
RD
841 DEC_PYCALLBACK_VOID_WXWINBASE(AddChild);
842 DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild);
843
86a12675
RD
844 PYPRIVATE;
845};
846
847IMPLEMENT_DYNAMIC_CLASS(wxPyPanel, wxPanel);
848
849IMP_PYCALLBACK_VOID_INT4(wxPyPanel, wxPanel, DoMoveWindow);
850IMP_PYCALLBACK_VOID_INT5(wxPyPanel, wxPanel, DoSetSize);
851IMP_PYCALLBACK_VOID_INTINT(wxPyPanel, wxPanel, DoSetClientSize);
852IMP_PYCALLBACK_VOID_INTINT(wxPyPanel, wxPanel, DoSetVirtualSize);
853
854IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetSize);
855IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetClientSize);
856IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetPosition);
857
858IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetVirtualSize);
859IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetBestSize);
860
861IMP_PYCALLBACK__(wxPyPanel, wxPanel, InitDialog);
862IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, TransferDataFromWindow);
863IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, TransferDataToWindow);
864IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, Validate);
865
866IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocus);
867IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocusFromKeyboard);
868IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, GetMaxSize);
869
aaad759f
RD
870IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, AddChild);
871IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, RemoveChild);
872
86a12675
RD
873%}
874
875// And now the one for SWIG to see
876class wxPyPanel : public wxPanel
877{
878public:
879 wxPyPanel(wxWindow* parent, const wxWindowID id,
880 const wxPoint& pos = wxDefaultPosition,
881 const wxSize& size = wxDefaultSize,
882 long style = 0,
883 const wxString& name = wxPyPanelNameStr);
884
885 void _setCallbackInfo(PyObject* self, PyObject* _class);
886 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyPanel)"
887 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
888
889
890 void base_DoMoveWindow(int x, int y, int width, int height);
891 void base_DoSetSize(int x, int y, int width, int height,
892 int sizeFlags = wxSIZE_AUTO);
893 void base_DoSetClientSize(int width, int height);
894 void base_DoSetVirtualSize( int x, int y );
895
896 void base_DoGetSize( int *OUTPUT, int *OUTPUT ) const;
897 void base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const;
898 void base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const;
899
900 wxSize base_DoGetVirtualSize() const;
901 wxSize base_DoGetBestSize() const;
902
903 void base_InitDialog();
904 bool base_TransferDataToWindow();
905 bool base_TransferDataFromWindow();
906 bool base_Validate();
907
908 bool base_AcceptsFocus() const;
909 bool base_AcceptsFocusFromKeyboard() const;
910 wxSize base_GetMaxSize() const;
aaad759f
RD
911
912 void base_AddChild(wxWindow* child);
913 void base_RemoveChild(wxWindow* child);
eb67b703 914};
86a12675
RD
915
916
7bf85405 917//---------------------------------------------------------------------------