]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/windows.i
SWIGged code update for wxMac
[wxWidgets.git] / 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 18#include <wx/menuitem.h>
9416aa89 19#include <wx/tooltip.h>
7bf85405
RD
20%}
21
22//----------------------------------------------------------------------
23
24%include typemaps.i
25%include my_typemaps.i
26
27// Import some definitions of other classes, etc.
28%import _defs.i
29%import misc.i
30%import gdi.i
b1462dfa 31%import clip_dnd.i
efc5f224 32
2f90df85 33%pragma(python) code = "import wx"
7bf85405 34
b68dc582 35
137b5242
RD
36//----------------------------------------------------------------------
37
38%{
39 // Put some wx default wxChar* values into wxStrings.
40 DECLARE_DEF_STRING(PanelNameStr);
41 static const wxString wxPyEmptyString(wxT(""));
42%}
43
7bf85405
RD
44//---------------------------------------------------------------------------
45
9416aa89 46class wxEvtHandler : public wxObject {
7bf85405 47public:
c368d904
RD
48 wxEvtHandler();
49
cf694132 50 bool ProcessEvent(wxEvent& event);
f6bcfd97 51 void AddPendingEvent(wxEvent& event);
2f90df85
RD
52 //bool SearchEventTable(wxEventTable& table, wxEvent& event);
53
54 bool GetEvtHandlerEnabled();
55 void SetEvtHandlerEnabled(bool enabled);
56
57 wxEvtHandler* GetNextHandler();
58 wxEvtHandler* GetPreviousHandler();
59 void SetNextHandler(wxEvtHandler* handler);
60 void SetPreviousHandler(wxEvtHandler* handler);
61
62
7bf85405
RD
63 %addmethods {
64 void Connect( int id, int lastId, int eventType, PyObject* func) {
65 if (PyCallable_Check(func)) {
66 self->Connect(id, lastId, eventType,
853b255a 67 (wxObjectEventFunction) &wxPyCallback::EventThunker,
7bf85405
RD
68 new wxPyCallback(func));
69 }
25b00b4e
RD
70 else if (func == Py_None) {
71 self->Disconnect(id, lastId, eventType,
72 (wxObjectEventFunction)
73 &wxPyCallback::EventThunker);
74 }
75 else {
76 PyErr_SetString(PyExc_TypeError, "Expected callable object or None.");
77 }
7bf85405 78 }
6999b0d8
RD
79
80 bool Disconnect(int id, int lastId = -1,
81 wxEventType eventType = wxEVT_NULL) {
82 return self->Disconnect(id, lastId, eventType,
83 (wxObjectEventFunction)
84 &wxPyCallback::EventThunker);
85 }
7bf85405 86 }
f6bcfd97 87
0122b7e3
RD
88 %addmethods {
89 void _setOORInfo(PyObject* _self) {
4acff284 90 self->SetClientObject(new wxPyOORClientData(_self));
0122b7e3
RD
91 }
92 }
7bf85405
RD
93};
94
95
2f90df85
RD
96//----------------------------------------------------------------------
97
98class wxValidator : public wxEvtHandler {
99public:
100 wxValidator();
101 //~wxValidator();
102
0122b7e3
RD
103 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
104
2f90df85
RD
105 wxValidator* Clone();
106 wxWindow* GetWindow();
107 void SetWindow(wxWindow* window);
f6bcfd97 108
9416aa89
RD
109 static bool IsSilent();
110 static void SetBellOnError(int doIt = TRUE);
111
2f90df85
RD
112};
113
2f90df85
RD
114
115//----------------------------------------------------------------------
116%{
117class wxPyValidator : public wxValidator {
118 DECLARE_DYNAMIC_CLASS(wxPyValidator);
119public:
120 wxPyValidator() {
121 }
2f90df85
RD
122
123 ~wxPyValidator() {
124 }
125
19a97bd6 126 wxObject* Clone() const {
694759cf
RD
127 wxPyValidator* ptr = NULL;
128 wxPyValidator* self = (wxPyValidator*)this;
129
4268f798 130 wxPyBeginBlockThreads();
694759cf
RD
131 if (self->m_myInst.findCallback("Clone")) {
132 PyObject* ro;
133 ro = self->m_myInst.callCallbackObj(Py_BuildValue("()"));
f6bcfd97
BP
134 if (ro) {
135 SWIG_GetPtrObj(ro, (void **)&ptr, "_wxPyValidator_p");
136 Py_DECREF(ro);
137 }
694759cf 138 }
4268f798 139 wxPyEndBlockThreads();
19a97bd6 140
694759cf
RD
141 // This is very dangerous!!! But is the only way I could find
142 // to squash a memory leak. Currently it is okay, but if the
143 // validator architecture in wxWindows ever changes, problems
144 // could arise.
145 delete self;
694759cf 146 return ptr;
2f90df85 147 }
2f90df85 148
9416aa89 149
2f90df85
RD
150 DEC_PYCALLBACK_BOOL_WXWIN(Validate);
151 DEC_PYCALLBACK_BOOL_(TransferToWindow);
152 DEC_PYCALLBACK_BOOL_(TransferFromWindow);
153
154 PYPRIVATE;
2f90df85
RD
155};
156
157IMP_PYCALLBACK_BOOL_WXWIN(wxPyValidator, wxValidator, Validate);
158IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferToWindow);
159IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferFromWindow);
160
161IMPLEMENT_DYNAMIC_CLASS(wxPyValidator, wxValidator);
162
163%}
164
165class wxPyValidator : public wxValidator {
166public:
167 wxPyValidator();
2f90df85 168
0122b7e3
RD
169 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=TRUE);
170 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyValidator, 1)"
2f90df85 171
0122b7e3 172 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
2f90df85
RD
173};
174
7bf85405
RD
175//----------------------------------------------------------------------
176
efc5f224 177%apply int * INOUT { int* x, int* y };
7bf85405
RD
178
179class wxWindow : public wxEvtHandler {
180public:
7bf85405 181 wxWindow(wxWindow* parent, const wxWindowID id,
b68dc582
RD
182 const wxPoint& pos = wxDefaultPosition,
183 const wxSize& size = wxDefaultSize,
7bf85405 184 long style = 0,
137b5242 185 const wxString& name = wxPyPanelNameStr);
09f3d4e6 186 %name(wxPreWindow)wxWindow();
7bf85405 187
09f3d4e6
RD
188 bool Create(wxWindow* parent, const wxWindowID id,
189 const wxPoint& pos = wxDefaultPosition,
190 const wxSize& size = wxDefaultSize,
191 long style = 0,
137b5242 192 const wxString& name = wxPyPanelNameStr);
7bf85405 193
0122b7e3 194 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
17c0e08c 195 %pragma(python) addtomethod = "wxPreWindow:val._setOORInfo(val)"
0122b7e3
RD
196
197
8bf5d46e
RD
198 void Center(int direction = wxBOTH);
199 void Centre(int direction = wxBOTH);
200 void CentreOnParent(int direction = wxBOTH );
201 void CenterOnParent(int direction = wxBOTH );
3ca6a5f0
BP
202 void CentreOnScreen(int direction = wxBOTH );
203 void CenterOnScreen(int direction = wxBOTH );
efc5f224 204
d56cebe7
RD
205 void Clear();
206
efc5f224
RD
207 // (uses apply'ed INOUT typemap, see above)
208 %name(ClientToScreenXY)void ClientToScreen(int* x, int* y);
af309447 209 wxPoint ClientToScreen(const wxPoint& pt);
efc5f224 210
7bf85405
RD
211 bool Close(int force = FALSE);
212 bool Destroy();
213 void DestroyChildren();
10e07c70 214 bool IsBeingDeleted();
853b255a 215#ifdef __WXMSW__
7bf85405 216 void DragAcceptFiles(bool accept);
853b255a 217#endif
7bf85405 218 void Enable(bool enable);
203c2f9a
RD
219
220 // Find child window by ID or name
af309447 221 %name(FindWindowById) wxWindow* FindWindow(long id);
714e6a9e 222 %name(FindWindowByName) wxWindow* FindWindow(const wxString& name);
203c2f9a 223
7bf85405
RD
224 void Fit();
225 wxColour GetBackgroundColour();
23bed520 226 wxBorder GetBorder() const;
d426c97e
RD
227
228 //wxList& GetChildren();
229 %addmethods {
230 PyObject* GetChildren() {
231 wxWindowList& list = self->GetChildren();
232 return wxPy_ConvertList(&list, "wxWindow");
233 }
234 }
235
7bf85405
RD
236 int GetCharHeight();
237 int GetCharWidth();
b8b8dda7
RD
238 %name(GetClientSizeTuple) void GetClientSize(int *OUTPUT, int *OUTPUT);
239 wxSize GetClientSize();
23bed520
RD
240
241 // get the origin of the client area of the window relative to the
242 // window top left corner (the client area may be shifted because of
243 // the borders, scrollbars, other decorations...)
244 wxPoint GetClientAreaOrigin() const;
245
246 // get the client rectangle in window (i.e. client) coordinates
247 wxRect GetClientRect() const;
248
7bf85405 249 wxLayoutConstraints * GetConstraints();
3ab72185 250 wxEvtHandler* GetEventHandler();
105e45b9 251
c5943253 252 wxFont GetFont();
7bf85405
RD
253 wxColour GetForegroundColour();
254 wxWindow * GetGrandParent();
2abc0a0f
RD
255 %addmethods {
256 long GetHandle() {
54b96882 257 return wxPyGetWinHandle(self); //(long)self->GetHandle();
2abc0a0f
RD
258 }
259 }
7bf85405 260 int GetId();
853b255a 261 wxString GetLabel();
bb0054cd 262 void SetLabel(const wxString& label);
853b255a 263 wxString GetName();
7bf85405 264 wxWindow * GetParent();
b8b8dda7
RD
265 %name(GetPositionTuple) void GetPosition(int *OUTPUT, int *OUTPUT);
266 wxPoint GetPosition();
267 wxRect GetRect();
7bf85405
RD
268 int GetScrollThumb(int orientation);
269 int GetScrollPos(int orientation);
270 int GetScrollRange(int orientation);
b8b8dda7
RD
271 %name(GetSizeTuple) void GetSize(int *OUTPUT, int *OUTPUT);
272 wxSize GetSize();
af309447
RD
273 void GetTextExtent(const wxString& string, int *OUTPUT, int *OUTPUT);
274 %name(GetFullTextExtent)void GetTextExtent(const wxString& string,
275 int *OUTPUT, int *OUTPUT, int *OUTPUT, int* OUTPUT,
276 const wxFont* font = NULL); //, bool use16 = FALSE)
853b255a 277 wxString GetTitle();
8bf5d46e 278 wxRegion GetUpdateRegion();
7bf85405 279 long GetWindowStyleFlag();
f6bcfd97
BP
280 void SetWindowStyleFlag(long style);
281 void SetWindowStyle(long style);
23bed520 282 bool HasScrollbar(int orient) const;
bb0054cd 283 bool Hide();
23bed520 284 wxHitTest HitTest(const wxPoint& pt);
7bf85405
RD
285 void InitDialog();
286 bool IsEnabled();
1b55cabf
RD
287 bool IsExposed( int x, int y, int w=0, int h=0 );
288 %name(IsExposedPoint) bool IsExposed( const wxPoint& pt );
289 %name(IsExposedRect) bool IsExposed( const wxRect& rect );
7bf85405
RD
290 bool IsRetained();
291 bool IsShown();
bb0054cd 292 bool IsTopLevel();
7bf85405
RD
293 void Layout();
294 bool LoadFromResource(wxWindow* parent, const wxString& resourceName, const wxResourceTable* resourceTable = NULL);
295 void Lower();
ecc08ead 296 void MakeModal(bool flag=TRUE);
23bed520
RD
297 %name(MoveXY)void Move(int x, int y, int flags = wxSIZE_USE_EXISTING);
298 void Move(const wxPoint& point, int flags = wxSIZE_USE_EXISTING);
7bf85405 299
3ab72185
RD
300 wxEvtHandler* PopEventHandler(bool deleteHandler = FALSE);
301 void PushEventHandler(wxEvtHandler* handler);
7bf85405 302
c6c593e8
RD
303 // find the given handler in the event handler chain and remove (but
304 // not delete) it from the event handler chain, return TRUE if it was
305 // found and FALSE otherwise (this also results in an assert failure so
306 // this function should only be called when the handler is supposed to
307 // be there)
308 bool RemoveEventHandler(wxEvtHandler *handler);
309
8bf5d46e
RD
310 %name(PopupMenuXY)bool PopupMenu(wxMenu *menu, int x, int y);
311 bool PopupMenu(wxMenu *menu, const wxPoint& pos);
312
7bf85405
RD
313 void Raise();
314 void Refresh(bool eraseBackground = TRUE, const wxRect* rect = NULL);
09f3d4e6
RD
315 void RefreshRect(const wxRect& rect);
316
203c2f9a 317 void AddChild(wxWindow* child);
b7e72427 318 void RemoveChild(wxWindow* child);
bb0054cd
RD
319 bool Reparent( wxWindow* newParent );
320
efc5f224
RD
321 // (uses apply'ed INOUT typemap, see above)
322 %name(ScreenToClientXY)void ScreenToClient(int *x, int *y);
af309447
RD
323 wxPoint ScreenToClient(const wxPoint& pt);
324
7bf85405
RD
325 void ScrollWindow(int dx, int dy, const wxRect* rect = NULL);
326 void SetAutoLayout(bool autoLayout);
1dec68aa 327 bool GetAutoLayout();
7bf85405
RD
328 void SetBackgroundColour(const wxColour& colour);
329 void SetConstraints(wxLayoutConstraints *constraints);
2f90df85 330 void UnsetConstraints(wxLayoutConstraints *constraints);
7bf85405 331 void SetFocus();
2a74d141 332 void SetFocusFromKbd();
2f90df85 333 bool AcceptsFocus();
7bf85405
RD
334 void SetFont(const wxFont& font);
335 void SetForegroundColour(const wxColour& colour);
336 void SetId(int id);
337 void SetName(const wxString& name);
eb715945 338 void SetScrollbar(int orientation, int position, int thumbSize, int range, int refresh = TRUE);
7bf85405
RD
339 void SetScrollPos(int orientation, int pos, bool refresh = TRUE);
340
7bf85405
RD
341 %name(SetDimensions) void SetSize(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO);
342 %addmethods {
343 void SetSize(const wxSize& size) {
b7e72427 344 self->SetSize(size);
7bf85405
RD
345 }
346
23bed520
RD
347 void SetPosition(const wxPoint& pos, int flags = wxSIZE_USE_EXISTING) {
348 self->Move(pos, flags);
7bf85405 349 }
33510773
RD
350
351 void SetRect(const wxRect& rect, int sizeFlags=wxSIZE_AUTO) {
352 self->SetSize(rect, sizeFlags);
353 }
7bf85405
RD
354 }
355
2a74d141
RD
356 void SetSizeHints(int minW, int minH,
357 int maxW=-1, int maxH=-1,
358 int incW=-1, int incH=-1);
359 void SetVirtualSizeHints( int minW, int minH,
360 int maxW = -1, int maxH = -1 );
361
362 void SetVirtualSize( const wxSize &size );
363 %name(SetVirtualSizeWH)void SetVirtualSize( int x, int y );
364
365 wxSize GetVirtualSize() const;
366 %name(GetVirtualSizeTuple)void GetVirtualSize( int *OUTPUT, int *OUTPUT ) const;
367
af309447
RD
368 %name(SetClientSizeWH)void SetClientSize(int width, int height);
369 void SetClientSize(const wxSize& size);
7bf85405 370 //void SetPalette(wxPalette* palette);
203c2f9a
RD
371 bool SetCursor(const wxCursor& cursor);
372 wxCursor& GetCursor();
3ab72185 373 void SetEventHandler(wxEvtHandler* handler);
83b18bab 374 void SetExtraStyle(long exStyle);
7bf85405 375 void SetTitle(const wxString& title);
7b7ac0ab 376 bool Show(bool show=TRUE);
7bf85405
RD
377 bool TransferDataFromWindow();
378 bool TransferDataToWindow();
23bed520 379 void UpdateWindowUI();
7bf85405 380 bool Validate();
7bf85405 381
b8b8dda7
RD
382 %name(ConvertDialogPointToPixels) wxPoint ConvertDialogToPixels(const wxPoint& pt);
383 %name(ConvertDialogSizeToPixels) wxSize ConvertDialogToPixels(const wxSize& sz);
384
cf694132
RD
385 %name(DLG_PNT) wxPoint ConvertDialogToPixels(const wxPoint& pt);
386 %name(DLG_SZE) wxSize ConvertDialogToPixels(const wxSize& sz);
387
b8b8dda7
RD
388 %name(ConvertPixelPointToDialog) wxPoint ConvertPixelsToDialog(const wxPoint& pt);
389 %name(ConvertPixelSizeToDialog) wxSize ConvertPixelsToDialog(const wxSize& sz);
390
af309447
RD
391 %name(SetToolTipString)void SetToolTip(const wxString &tip);
392 void SetToolTip(wxToolTip *tooltip);
393 wxToolTip* GetToolTip();
2f90df85 394
a541c325 395 void SetSizer(wxSizer* sizer, bool deleteOld=TRUE);
2a74d141 396 void SetSizerAndFit(wxSizer *sizer, bool deleteOld=TRUE);
f6bcfd97
BP
397 wxSizer* GetSizer();
398
be90c029 399 // Track if this window is a member of a sizer
14afa2cb
RD
400 void SetContainingSizer(wxSizer* sizer);
401 wxSizer *GetContainingSizer() const;
be90c029 402
2f90df85
RD
403 wxValidator* GetValidator();
404 void SetValidator(const wxValidator& validator);
405
b1462dfa
RD
406 void SetDropTarget(wxDropTarget* target);
407 wxDropTarget* GetDropTarget();
408 %pragma(python) addtomethod = "SetDropTarget:_args[0].thisown = 0"
694759cf
RD
409
410 wxSize GetBestSize();
a541c325 411 wxSize GetMaxSize();
a1df7a95
RD
412
413 void SetCaret(wxCaret *caret);
414 wxCaret *GetCaret();
9416aa89 415 %pragma(python) addtoclass = "# replaces broken shadow method
a1df7a95
RD
416 def GetCaret(self, *_args, **_kwargs):
417 from misc2 import wxCaretPtr
418 val = apply(windowsc.wxWindow_GetCaret,(self,) + _args, _kwargs)
419 if val: val = wxCaretPtr(val)
420 return val
f6bcfd97 421 "
c368d904 422
3a0958b1
RD
423 void Freeze();
424 void Thaw();
09f3d4e6 425 void Update();
3a0958b1 426
4f3449b4
RD
427 wxString GetHelpText();
428 void SetHelpText(const wxString& helpText);
23bed520 429 void SetHelpTextForId(const wxString& text);
4f3449b4 430
c7e7022c
RD
431 bool ScrollLines(int lines);
432 bool ScrollPages(int pages);
433 bool LineUp();
434 bool LineDown();
435 bool PageUp();
436 bool PageDown();
437
09f3d4e6
RD
438 static wxWindow* FindFocus();
439 static int NewControlId();
440 static int NextControlId(int id);
441 static int PrevControlId(int id);
c7e7022c 442
ecc08ead
RD
443 void SetAcceleratorTable(const wxAcceleratorTable& accel);
444 wxAcceleratorTable *GetAcceleratorTable();
78e8819c 445
74bcba0e 446#ifdef __WXMSW__
07c99b26 447 // A way to do the native draw first... Too bad it isn't in wxGTK too.
74bcba0e
RD
448 void OnPaint(wxPaintEvent& event);
449#endif
5a2930ab 450
26e335b8
RD
451 wxWindow* GetDefaultItem();
452 wxWindow* SetDefaultItem(wxWindow *btn);
0b85cc38 453 void SetTmpDefaultItem(wxWindow *win);
6d26dc89
RD
454
455 // move the mouse to the specified position
456 void WarpPointer(int x, int y);
457
458 // start or end mouse capture, these functions maintain the stack of
459 // windows having captured the mouse and after calling ReleaseMouse()
460 // the mouse is not released but returns to the window which had had
461 // captured it previously (if any)
462 void CaptureMouse();
463 void ReleaseMouse();
464
465 // get the window which currently captures the mouse or NULL
466 static wxWindow *GetCapture();
467
468 // does this window have the capture?
469 bool HasCapture() const;
7bf85405
RD
470};
471
efc5f224
RD
472
473
474
b8b8dda7 475%pragma(python) code = "
bb0054cd
RD
476def wxDLG_PNT(win, point_or_x, y=None):
477 if y is None:
478 return win.ConvertDialogPointToPixels(point_or_x)
479 else:
480 return win.ConvertDialogPointToPixels(wxPoint(point_or_x, y))
481
482def wxDLG_SZE(win, size_width, height=None):
483 if height is None:
484 return win.ConvertDialogSizeToPixels(size_width)
485 else:
486 return win.ConvertDialogSizeToPixels(wxSize(size_width, height))
b8b8dda7 487"
7bf85405 488
af309447 489
c368d904 490#ifdef __WXMSW__
af309447
RD
491%inline %{
492wxWindow* wxWindow_FromHWND(unsigned long hWnd) {
493 wxWindow* win = new wxWindow;
494 win->SetHWND(hWnd);
495 win->SubclassWin(hWnd);
496 return win;
497}
498%}
853b255a 499#endif
7bf85405 500
efc5f224 501
203c2f9a
RD
502// Unfortunatly the names of these new static methods clash with the
503// names wxPython has been using forever for the overloaded
504// wxWindow::FindWindow, so instead of swigging them as statics create
505// standalone functions for them.
506%inline %{
507wxWindow* wxFindWindowById( long id, const wxWindow *parent = NULL ) {
508 return wxWindow::FindWindowById(id, parent);
509}
510
511wxWindow* wxFindWindowByName( const wxString& name,
512 const wxWindow *parent = NULL ) {
513 return wxWindow::FindWindowByName(name, parent);
514}
515
516wxWindow* wxFindWindowByLabel( const wxString& label,
517 const wxWindow *parent = NULL ) {
518 return wxWindow::FindWindowByLabel(label, parent);
519}
520%}
521
522
7bf85405
RD
523//---------------------------------------------------------------------------
524
525class wxPanel : public wxWindow {
526public:
527 wxPanel(wxWindow* parent,
528 const wxWindowID id,
b68dc582
RD
529 const wxPoint& pos = wxDefaultPosition,
530 const wxSize& size = wxDefaultSize,
7bf85405 531 long style = wxTAB_TRAVERSAL,
137b5242 532 const wxString& name = wxPyPanelNameStr);
09f3d4e6 533 %name(wxPrePanel)wxPanel();
7bf85405 534
09f3d4e6
RD
535 bool Create(wxWindow* parent,
536 const wxWindowID id,
537 const wxPoint& pos = wxDefaultPosition,
538 const wxSize& size = wxDefaultSize,
539 long style = wxTAB_TRAVERSAL,
137b5242 540 const wxString& name = wxPyPanelNameStr);
9c039d08 541
0122b7e3 542 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
7b7ac0ab 543 %pragma(python) addtomethod = "wxPrePanel:val._setOORInfo(val)"
0122b7e3 544
7bf85405 545 void InitDialog();
bb0054cd 546
7bf85405
RD
547};
548
549//---------------------------------------------------------------------------
550
0adbc166
RD
551
552// TODO: Add wrappers for the wxScrollHelper class, make wxScrolledWindow
553// derive from it and wxPanel.
554
555
bb0054cd 556class wxScrolledWindow : public wxPanel {
7bf85405
RD
557public:
558 wxScrolledWindow(wxWindow* parent,
559 const wxWindowID id = -1,
b68dc582
RD
560 const wxPoint& pos = wxDefaultPosition,
561 const wxSize& size = wxDefaultSize,
7bf85405 562 long style = wxHSCROLL | wxVSCROLL,
137b5242 563 const wxString& name = wxPyPanelNameStr);
09f3d4e6
RD
564 %name(wxPreScrolledWindow)wxScrolledWindow();
565
566 bool Create(wxWindow* parent,
567 const wxWindowID id = -1,
568 const wxPoint& pos = wxDefaultPosition,
569 const wxSize& size = wxDefaultSize,
570 long style = wxHSCROLL | wxVSCROLL,
137b5242 571 const wxString& name = wxPyPanelNameStr);
9c039d08 572
0122b7e3 573 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
17c0e08c 574 %pragma(python) addtomethod = "wxPreScrolledWindow:val._setOORInfo(val)"
0122b7e3 575
7bf85405 576 void EnableScrolling(bool xScrolling, bool yScrolling);
b7e72427 577 int GetScrollPageSize(int orient);
7bf85405 578 void GetScrollPixelsPerUnit(int* OUTPUT, int* OUTPUT);
b7e72427 579 wxWindow* GetTargetWindow();
7bf85405
RD
580 bool IsRetained();
581 void PrepareDC(wxDC& dc);
582 void Scroll(int x, int y);
583 void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
584 int noUnitsX, int noUnitsY,
f6bcfd97 585 int xPos = 0, int yPos = 0, int noRefresh=FALSE);
b7e72427 586 void SetScrollPageSize(int orient, int pageSize);
eb715945 587 void SetTargetWindow(wxWindow* window);
4c9993c3 588 void GetViewStart(int* OUTPUT, int* OUTPUT);
0adbc166 589 %pragma(python) addtoclass = "ViewStart = GetViewStart"
9d8bd15f 590
e9159fe8
RD
591 %name(CalcScrolledPosition1)wxPoint CalcScrolledPosition(const wxPoint& pt);
592 %name(CalcScrolledPosition2)void CalcScrolledPosition( int x, int y, int *OUTPUT, int *OUTPUT);
593
594 %name(CalcUnscrolledPosition1)wxPoint CalcUnscrolledPosition(const wxPoint& pt);
595 %name(CalcUnscrolledPosition2)void CalcUnscrolledPosition( int x, int y, int *OUTPUT, int *OUTPUT);
596
597 %pragma(python) addtoclass = "
598 def CalcScrolledPosition(self, *args):
599 if len(args) == 1:
600 return apply(self.CalcScrolledPosition1, args)
601 elif len(args) == 2:
602 return apply(self.CalcScrolledPosition2, args)
603 else:
604 raise TypeError, 'Invalid parameters: only (x,y) or (point) allowed'
605
606 def CalcUnscrolledPosition(self, *args):
607 if len(args) == 1:
608 return apply(self.CalcUnscrolledPosition1, args)
609 elif len(args) == 2:
610 return apply(self.CalcUnscrolledPosition2, args)
611 else:
612 raise TypeError, 'Invalid parameters: only (x,y) or (point) allowed'
613"
9d8bd15f 614
d1679124
RD
615 void SetScale(double xs, double ys);
616 double GetScaleX();
617 double GetScaleY();
618
619 void AdjustScrollbars();
26e335b8
RD
620
621 bool Layout();
2a74d141
RD
622
623 // Set the x, y scrolling increments.
624 void SetScrollRate( int xstep, int ystep );
625
7bf85405
RD
626};
627
628//----------------------------------------------------------------------
629
630
631class wxMenu : public wxEvtHandler {
632public:
137b5242 633 wxMenu(const wxString& title = wxPyEmptyString, long style = 0);
7bf85405 634
0122b7e3
RD
635 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
636
7bf85405 637 void Append(int id, const wxString& item,
137b5242 638 const wxString& helpString = wxPyEmptyString,
546bfbea 639 wxItemKind kind = wxITEM_NORMAL);
7bf85405 640 %name(AppendMenu)void Append(int id, const wxString& item, wxMenu *subMenu,
137b5242 641 const wxString& helpString = wxPyEmptyString);
af309447 642 %name(AppendItem)void Append(const wxMenuItem* item);
e9159fe8
RD
643 void AppendCheckItem(int id,
644 const wxString& text,
137b5242 645 const wxString& help = wxPyEmptyString);
e9159fe8
RD
646 void AppendRadioItem(int id,
647 const wxString& text,
137b5242 648 const wxString& help = wxPyEmptyString);
7bf85405 649 void AppendSeparator();
e9159fe8
RD
650
651
652 void Insert(size_t pos,
653 int id,
654 const wxString& text,
137b5242 655 const wxString& help = wxPyEmptyString,
546bfbea 656 wxItemKind kind = wxITEM_NORMAL);
e9159fe8
RD
657 void InsertSeparator(size_t pos);
658 void InsertCheckItem(size_t pos,
659 int id,
660 const wxString& text,
137b5242 661 const wxString& help = wxPyEmptyString);
e9159fe8
RD
662 void InsertRadioItem(size_t pos,
663 int id,
664 const wxString& text,
137b5242 665 const wxString& help = wxPyEmptyString);
e9159fe8
RD
666 %name(InsertMenu)void Insert(size_t pos,
667 int id,
668 const wxString& text,
669 wxMenu *submenu,
137b5242 670 const wxString& help = wxPyEmptyString);
e9159fe8
RD
671 %name(InsertItem)bool Insert(size_t pos, wxMenuItem *item);
672
673
674 void Prepend(int id,
675 const wxString& text,
137b5242 676 const wxString& help = wxPyEmptyString,
546bfbea 677 wxItemKind kind = wxITEM_NORMAL);
e9159fe8
RD
678 void PrependSeparator();
679 void PrependCheckItem(int id,
680 const wxString& text,
137b5242 681 const wxString& help = wxPyEmptyString);
e9159fe8
RD
682 void PrependRadioItem(int id,
683 const wxString& text,
137b5242 684 const wxString& help = wxPyEmptyString);
e9159fe8
RD
685 %name(PrependMenu)void Prepend(int id,
686 const wxString& text,
687 wxMenu *submenu,
137b5242 688 const wxString& help = wxPyEmptyString);
e9159fe8
RD
689 %name(PrependItem)void Prepend(wxMenuItem *item);
690
691
7bf85405
RD
692 void Break();
693 void Check(int id, bool flag);
b1462dfa 694 bool IsChecked(int id);
7bf85405 695 void Enable(int id, bool enable);
b1462dfa
RD
696 bool IsEnabled(int id);
697
7bf85405 698 int FindItem(const wxString& itemString);
b1462dfa
RD
699 %name(FindItemById)wxMenuItem* FindItem(int id/*, wxMenu **menu = NULL*/);
700
7bf85405 701 wxString GetTitle();
7bf85405 702 void SetTitle(const wxString& title);
b1462dfa 703
714e6a9e 704 wxString GetLabel(int id);
853b255a 705 void SetLabel(int id, const wxString& label);
b1462dfa
RD
706
707 wxString GetHelpString(int id);
708 void SetHelpString(int id, const wxString& helpString);
8bf5d46e 709 void UpdateUI(wxEvtHandler* source = NULL);
efc5f224 710
b1462dfa
RD
711 bool Delete(int id);
712 %name(DeleteItem)bool Delete(wxMenuItem *item);
b1462dfa
RD
713 wxMenuItem *Remove(int id);
714 %name(RemoveItem) wxMenuItem *Remove(wxMenuItem *item);
715
e9159fe8
RD
716
717
718
efc5f224 719 %addmethods {
eb715945 720 void Destroy() { delete self; }
efc5f224 721 }
b1462dfa
RD
722 %name(DestroyId)bool Destroy(int id);
723 %name(DestroyItem)bool Destroy(wxMenuItem *item);
efc5f224 724
b1462dfa
RD
725 size_t GetMenuItemCount();
726 //wxMenuItemList& GetMenuItems();
727 %addmethods {
728 PyObject* GetMenuItems() {
729 wxMenuItemList& list = self->GetMenuItems();
730 return wxPy_ConvertList(&list, "wxMenuItem");
731 }
732 }
7bf85405 733
b1462dfa
RD
734 void SetEventHandler(wxEvtHandler *handler);
735 wxEvtHandler *GetEventHandler();
736
737 void SetInvokingWindow(wxWindow *win);
738 wxWindow *GetInvokingWindow();
739
740 long GetStyle();
741
742 bool IsAttached();
743
744 void SetParent(wxMenu *parent);
745 wxMenu *GetParent();
746};
7bf85405 747
7bf85405
RD
748
749//----------------------------------------------------------------------
750
b1462dfa 751class wxMenuBar : public wxWindow {
7bf85405 752public:
c368d904 753 wxMenuBar(long style = 0);
7bf85405 754
0122b7e3
RD
755 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
756
b1462dfa
RD
757 bool Append(wxMenu *menu, const wxString& title);
758 bool Insert(size_t pos, wxMenu *menu, const wxString& title);
759 size_t GetMenuCount();
760 wxMenu *GetMenu(size_t pos);
761 wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title);
762 wxMenu *Remove(size_t pos);
763 void EnableTop(size_t pos, bool enable);
764 void SetLabelTop(size_t pos, const wxString& label);
765 wxString GetLabelTop(size_t pos);
3a0958b1 766 int FindMenu(const wxString& title);
b1462dfa
RD
767 int FindMenuItem(const wxString& menuString, const wxString& itemString);
768 %name(FindItemById)wxMenuItem* FindItem(int id/*, wxMenu **menu = NULL*/);
7bf85405 769 void Enable(int id, bool enable);
b1462dfa 770 void Check(int id, bool check);
2abc0a0f
RD
771 bool IsChecked(int id);
772 bool IsEnabled(int id);
b1462dfa
RD
773
774 void SetLabel(int id, const wxString &label);
7bf85405 775 wxString GetLabel(int id);
b1462dfa 776
7bf85405 777 void SetHelpString(int id, const wxString& helpString);
b1462dfa 778 wxString GetHelpString(int id);
2abc0a0f 779
7bf85405
RD
780};
781
782
783//----------------------------------------------------------------------
784
9416aa89 785class wxMenuItem : public wxObject {
7bf85405 786public:
4c9993c3 787 wxMenuItem(wxMenu* parentMenu=NULL, int id=wxID_SEPARATOR,
137b5242
RD
788 const wxString& text = wxPyEmptyString,
789 const wxString& help = wxPyEmptyString,
546bfbea 790 wxItemKind kind = wxITEM_NORMAL,
e9159fe8 791 wxMenu* subMenu = NULL);
cf694132 792
b1462dfa
RD
793
794 wxMenu *GetMenu();
2abc0a0f 795 void SetId(int id);
b1462dfa
RD
796 int GetId();
797 bool IsSeparator();
2abc0a0f 798 void SetText(const wxString& str);
b1462dfa 799 wxString GetLabel();
2abc0a0f 800 const wxString& GetText();
e9159fe8 801 wxItemKind GetKind();
2abc0a0f 802 void SetCheckable(bool checkable);
b1462dfa
RD
803 bool IsCheckable();
804 bool IsSubMenu();
2abc0a0f 805 void SetSubMenu(wxMenu *menu);
b1462dfa
RD
806 wxMenu *GetSubMenu();
807 void Enable(bool enable = TRUE);
808 bool IsEnabled();
809 void Check(bool check = TRUE);
810 bool IsChecked();
811 void Toggle();
812 void SetHelp(const wxString& str);
813 const wxString& GetHelp();
814 wxAcceleratorEntry *GetAccel();
815 void SetAccel(wxAcceleratorEntry *accel);
816
1b62f00d 817 static wxString GetLabelFromText(const wxString& text);
e9159fe8 818// static wxAcceleratorEntry *GetAccelFromString(const wxString& label);
1b62f00d 819
f3d9dc1d 820 // wxOwnerDrawn methods
4662be59 821#ifdef __WXMSW__
f3d9dc1d 822 void SetFont(const wxFont& font);
c5943253 823 wxFont GetFont();
f3d9dc1d 824 void SetTextColour(const wxColour& colText);
25832b3f 825 wxColour GetTextColour();
f3d9dc1d 826 void SetBackgroundColour(const wxColour& colBack);
25832b3f 827 wxColour GetBackgroundColour();
f3d9dc1d
RD
828 void SetBitmaps(const wxBitmap& bmpChecked,
829 const wxBitmap& bmpUnchecked = wxNullBitmap);
830 void SetBitmap(const wxBitmap& bmpChecked);
c5943253 831 wxBitmap GetBitmap(bool bChecked = TRUE);
f3d9dc1d
RD
832 void SetMarginWidth(int nWidth);
833 int GetMarginWidth();
834 static int GetDefaultMarginWidth();
835 //void SetName(const wxString& strName);
836 //const wxString& GetName();
837 //void SetCheckable(bool checkable);
838 //bool IsCheckable();
839 bool IsOwnerDrawn();
840 void ResetOwnerDrawn();
4662be59 841#endif
7bf85405
RD
842};
843
844//---------------------------------------------------------------------------
7bf85405
RD
845
846
694759cf 847