1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG definitions of MORE window classes
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
20 #include <wx/notebook.h>
21 #include <wx/splitter.h>
22 #include <wx/imaglist.h>
24 #include <wx/msw/taskbar.h>
28 //----------------------------------------------------------------------
31 // Put some wx default wxChar* values into wxStrings.
32 DECLARE_DEF_STRING(NOTEBOOK_NAME);
33 DECLARE_DEF_STRING(PanelNameStr);
34 DECLARE_DEF_STRING(ControlNameStr);
36 static const wxChar* wxSplitterNameStr = wxT("splitter");
37 DECLARE_DEF_STRING(SplitterNameStr);
38 static const wxString wxPyEmptyString(wxT(""));
41 //----------------------------------------------------------------------
44 %include my_typemaps.i
46 // Import some definitions of other classes, etc.
54 %pragma(python) code = "import wx"
56 //---------------------------------------------------------------------------
59 /* notebook control event types */
60 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
61 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING,
65 class wxNotebookEvent : public wxNotifyEvent {
67 wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
68 int nSel = -1, int nOldSel = -1);
71 int GetOldSelection();
72 void SetOldSelection(int page);
73 void SetSelection(int page);
78 class wxNotebook : public wxControl {
80 wxNotebook(wxWindow *parent,
82 const wxPoint& pos = wxDefaultPosition,
83 const wxSize& size = wxDefaultSize,
85 const wxString& name = wxPyNOTEBOOK_NAME);
86 %name(wxPreNotebook)wxNotebook();
88 bool Create(wxWindow *parent,
90 const wxPoint& pos = wxDefaultPosition,
91 const wxSize& size = wxDefaultSize,
93 const wxString& name = wxPyNOTEBOOK_NAME);
95 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
96 %pragma(python) addtomethod = "wxPreNotebook:val._setOORInfo(val)"
99 int SetSelection(int nPage);
100 void AdvanceSelection(bool bForward = TRUE);
102 bool SetPageText(int nPage, const wxString& strText);
103 wxString GetPageText(int nPage) const;
105 void SetImageList(wxImageList* imageList);
106 void AssignImageList(wxImageList *imageList) ;
107 %pragma(python) addtomethod = "AssignImageList:_args[0].thisown = 0"
109 wxImageList* GetImageList();
110 int GetPageImage(int nPage);
111 bool SetPageImage(int nPage, int nImage);
114 void SetPageSize(const wxSize& size);
115 void SetPadding(const wxSize& padding);
116 bool DeletePage(int nPage);
117 bool RemovePage(int nPage);
118 bool DeleteAllPages();
119 bool AddPage(/*wxNotebookPage*/ wxWindow *pPage,
120 const wxString& strText,
123 bool InsertPage(int nPage,
124 /*wxNotebookPage*/ wxWindow *pPage,
125 const wxString& strText,
126 bool bSelect = FALSE,
128 /*wxNotebookPage*/ wxWindow *GetPage(int nPage);
131 void ResizeChildren() {
132 wxSizeEvent evt(self->GetClientSize());
133 self->GetEventHandler()->ProcessEvent(evt);
140 //---------------------------------------------------------------------------
144 /* splitter window events */
145 wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING,
146 wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED,
147 wxEVT_COMMAND_SPLITTER_UNSPLIT,
148 wxEVT_COMMAND_SPLITTER_DOUBLECLICKED,
157 wxSPLIT_DRAG_DRAGGING,
158 wxSPLIT_DRAG_LEFT_DOWN
162 class wxSplitterEvent : public wxNotifyEvent {
164 wxSplitterEvent(wxEventType type = wxEVT_NULL,
165 wxSplitterWindow *splitter = NULL);
167 int GetSashPosition();
170 wxWindow* GetWindowBeingRemoved();
171 void SetSashPosition(int pos);
177 class wxSplitterWindow : public wxWindow {
179 wxSplitterWindow(wxWindow* parent, wxWindowID id,
180 const wxPoint& point = wxDefaultPosition,
181 const wxSize& size = wxDefaultSize,
182 long style=wxSP_3D|wxCLIP_CHILDREN,
183 const wxString& name = wxPySplitterNameStr);
184 %name(wxPreSplitterWindow)wxSplitterWindow();
186 bool Create(wxWindow* parent, wxWindowID id,
187 const wxPoint& point = wxDefaultPosition,
188 const wxSize& size = wxDefaultSize,
189 long style=wxSP_3D|wxCLIP_CHILDREN,
190 const wxString& name = wxPySplitterNameStr);
192 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
193 %pragma(python) addtomethod = "wxPreSplitterWindow:val._setOORInfo(val)"
195 // Gets the only or left/top pane
196 wxWindow *GetWindow1();
198 // Gets the right/bottom pane
199 wxWindow *GetWindow2();
201 // Sets the split mode
202 void SetSplitMode(int mode);
204 // Gets the split mode
207 // Initialize with one window
208 void Initialize(wxWindow *window);
210 // Associates the given window with window 2, drawing the appropriate sash
211 // and changing the split mode.
212 // Does nothing and returns FALSE if the window is already split.
213 // A sashPosition of 0 means choose a default sash position,
214 // negative sashPosition specifies the size of right/lower pane as it's
215 // absolute value rather than the size of left/upper pane.
216 virtual bool SplitVertically(wxWindow *window1,
218 int sashPosition = 0);
219 virtual bool SplitHorizontally(wxWindow *window1,
221 int sashPosition = 0);
223 // Removes the specified (or second) window from the view
224 // Doesn't actually delete the window.
225 bool Unsplit(wxWindow *toRemove = NULL);
227 // Replaces one of the windows with another one (neither old nor new
228 // parameter should be NULL)
229 bool ReplaceWindow(wxWindow *winOld, wxWindow *winNew);
231 // Is the window split?
234 // Sets the sash size
235 void SetSashSize(int width);
237 // Sets the border size
238 void SetBorderSize(int width);
240 // Gets the sash size
243 // Gets the border size
246 // Set the sash position
247 void SetSashPosition(int position, bool redraw = TRUE);
249 // Gets the sash position
250 int GetSashPosition();
252 // If this is zero, we can remove panes by dragging the sash.
253 void SetMinimumPaneSize(int min);
254 int GetMinimumPaneSize();
256 // Resizes subwindows
257 virtual void SizeWindows();
259 void SetNeedUpdating(bool needUpdating) { m_needUpdating = needUpdating; }
260 bool GetNeedUpdating() const { return m_needUpdating ; }
264 //---------------------------------------------------------------------------
270 wxEVT_TASKBAR_LEFT_DOWN,
271 wxEVT_TASKBAR_LEFT_UP,
272 wxEVT_TASKBAR_RIGHT_DOWN,
273 wxEVT_TASKBAR_RIGHT_UP,
274 wxEVT_TASKBAR_LEFT_DCLICK,
275 wxEVT_TASKBAR_RIGHT_DCLICK
279 class wxTaskBarIcon : public wxEvtHandler {
284 //%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
286 // We still use the magic methods here since that is the way it is documented...
287 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnMouseMove', wxEVT_TASKBAR_MOVE)"
288 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDown', wxEVT_TASKBAR_LEFT_DOWN)"
289 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonUp', wxEVT_TASKBAR_LEFT_UP)"
290 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDown', wxEVT_TASKBAR_RIGHT_DOWN)"
291 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonUp', wxEVT_TASKBAR_RIGHT_UP)"
292 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDClick',wxEVT_TASKBAR_LEFT_DCLICK)"
293 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDClick',wxEVT_TASKBAR_RIGHT_DCLICK)"
295 bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxPyEmptyString);
296 bool RemoveIcon(void);
297 bool PopupMenu(wxMenu *menu);
298 bool IsIconInstalled();
303 //---------------------------------------------------------------------------
304 //---------------------------------------------------------------------------
305 // wxPyWindow derives from wxWindow and adds support for overriding many of
306 // the virtual methods in Python derived classes.
308 // Which of these should be done???
323 // GetClientAreaOrigin
327 // SetBackgroundColour
331 // SetForegroundColour
333 // SetVirtualSizeHints
337 %{ // C++ version of Python aware wxWindow
338 class wxPyWindow : public wxWindow
340 DECLARE_DYNAMIC_CLASS(wxPyWindow)
342 wxPyWindow() : wxWindow() {}
343 wxPyWindow(wxWindow* parent, const wxWindowID id,
344 const wxPoint& pos = wxDefaultPosition,
345 const wxSize& size = wxDefaultSize,
347 const wxString& name = wxPyPanelNameStr)
348 : wxWindow(parent, id, pos, size, style, name) {}
351 DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
352 DEC_PYCALLBACK_VOID_INT5(DoSetSize);
353 DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
354 DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
356 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
357 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
358 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
360 DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
361 DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
363 DEC_PYCALLBACK__(InitDialog);
364 DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
365 DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
366 DEC_PYCALLBACK_BOOL_(Validate);
368 DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
369 DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
370 DEC_PYCALLBACK_SIZE_const(GetMaxSize);
375 IMPLEMENT_DYNAMIC_CLASS(wxPyWindow, wxWindow);
377 IMP_PYCALLBACK_VOID_INT4(wxPyWindow, wxWindow, DoMoveWindow);
378 IMP_PYCALLBACK_VOID_INT5(wxPyWindow, wxWindow, DoSetSize);
379 IMP_PYCALLBACK_VOID_INTINT(wxPyWindow, wxWindow, DoSetClientSize);
380 IMP_PYCALLBACK_VOID_INTINT(wxPyWindow, wxWindow, DoSetVirtualSize);
382 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetSize);
383 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetClientSize);
384 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetPosition);
386 IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, DoGetVirtualSize);
387 IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, DoGetBestSize);
389 IMP_PYCALLBACK__(wxPyWindow, wxWindow, InitDialog);
390 IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, TransferDataFromWindow);
391 IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, TransferDataToWindow);
392 IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, Validate);
394 IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocus);
395 IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocusFromKeyboard);
396 IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, GetMaxSize);
400 // And now the one for SWIG to see
401 class wxPyWindow : public wxWindow
404 wxPyWindow(wxWindow* parent, const wxWindowID id,
405 const wxPoint& pos = wxDefaultPosition,
406 const wxSize& size = wxDefaultSize,
408 const wxString& name = wxPyPanelNameStr);
410 void _setCallbackInfo(PyObject* self, PyObject* _class);
411 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyWindow)"
412 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
415 void base_DoMoveWindow(int x, int y, int width, int height);
416 void base_DoSetSize(int x, int y, int width, int height,
417 int sizeFlags = wxSIZE_AUTO);
418 void base_DoSetClientSize(int width, int height);
419 void base_DoSetVirtualSize( int x, int y );
421 void base_DoGetSize( int *OUTPUT, int *OUTPUT ) const;
422 void base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const;
423 void base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const;
425 wxSize base_DoGetVirtualSize() const;
426 wxSize base_DoGetBestSize() const;
428 void base_InitDialog();
429 bool base_TransferDataToWindow();
430 bool base_TransferDataFromWindow();
431 bool base_Validate();
433 bool base_AcceptsFocus() const;
434 bool base_AcceptsFocusFromKeyboard() const;
435 wxSize base_GetMaxSize() const;
438 //---------------------------------------------------------------------------
439 // Do the same thing for wxControl
442 %{ // C++ version of Python aware wxControl
443 class wxPyControl : public wxControl
445 DECLARE_DYNAMIC_CLASS(wxPyControl)
447 wxPyControl() : wxControl() {}
448 wxPyControl(wxWindow* parent, const wxWindowID id,
449 const wxPoint& pos = wxDefaultPosition,
450 const wxSize& size = wxDefaultSize,
452 const wxValidator& validator=wxDefaultValidator,
453 const wxString& name = wxPyControlNameStr)
454 : wxControl(parent, id, pos, size, style, validator, name) {}
457 DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
458 DEC_PYCALLBACK_VOID_INT5(DoSetSize);
459 DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
460 DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
462 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
463 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
464 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
466 DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
467 DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
469 DEC_PYCALLBACK__(InitDialog);
470 DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
471 DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
472 DEC_PYCALLBACK_BOOL_(Validate);
474 DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
475 DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
476 DEC_PYCALLBACK_SIZE_const(GetMaxSize);
481 IMPLEMENT_DYNAMIC_CLASS(wxPyControl, wxControl);
483 IMP_PYCALLBACK_VOID_INT4(wxPyControl, wxControl, DoMoveWindow);
484 IMP_PYCALLBACK_VOID_INT5(wxPyControl, wxControl, DoSetSize);
485 IMP_PYCALLBACK_VOID_INTINT(wxPyControl, wxControl, DoSetClientSize);
486 IMP_PYCALLBACK_VOID_INTINT(wxPyControl, wxControl, DoSetVirtualSize);
488 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyControl, wxControl, DoGetSize);
489 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyControl, wxControl, DoGetClientSize);
490 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyControl, wxControl, DoGetPosition);
492 IMP_PYCALLBACK_SIZE_const(wxPyControl, wxControl, DoGetVirtualSize);
493 IMP_PYCALLBACK_SIZE_const(wxPyControl, wxControl, DoGetBestSize);
495 IMP_PYCALLBACK__(wxPyControl, wxControl, InitDialog);
496 IMP_PYCALLBACK_BOOL_(wxPyControl, wxControl, TransferDataFromWindow);
497 IMP_PYCALLBACK_BOOL_(wxPyControl, wxControl, TransferDataToWindow);
498 IMP_PYCALLBACK_BOOL_(wxPyControl, wxControl, Validate);
500 IMP_PYCALLBACK_BOOL_const(wxPyControl, wxControl, AcceptsFocus);
501 IMP_PYCALLBACK_BOOL_const(wxPyControl, wxControl, AcceptsFocusFromKeyboard);
502 IMP_PYCALLBACK_SIZE_const(wxPyControl, wxControl, GetMaxSize);
506 // And now the one for SWIG to see
507 class wxPyControl : public wxControl
510 wxPyControl(wxWindow* parent, const wxWindowID id,
511 const wxPoint& pos = wxDefaultPosition,
512 const wxSize& size = wxDefaultSize,
514 const wxValidator& validator=wxDefaultValidator,
515 const wxString& name = wxPyControlNameStr);
517 void _setCallbackInfo(PyObject* self, PyObject* _class);
518 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyControl)"
519 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
522 void base_DoMoveWindow(int x, int y, int width, int height);
523 void base_DoSetSize(int x, int y, int width, int height,
524 int sizeFlags = wxSIZE_AUTO);
525 void base_DoSetClientSize(int width, int height);
526 void base_DoSetVirtualSize( int x, int y );
528 void base_DoGetSize( int *OUTPUT, int *OUTPUT ) const;
529 void base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const;
530 void base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const;
532 wxSize base_DoGetVirtualSize() const;
533 wxSize base_DoGetBestSize() const;
535 void base_InitDialog();
536 bool base_TransferDataToWindow();
537 bool base_TransferDataFromWindow();
538 bool base_Validate();
540 bool base_AcceptsFocus() const;
541 bool base_AcceptsFocusFromKeyboard() const;
542 wxSize base_GetMaxSize() const;
545 //---------------------------------------------------------------------------