]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/windows.i
wxZipFSHandler does not report non-local zip archives as openable anymore
[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
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
b1462dfa 30%import clip_dnd.i
efc5f224 31
2f90df85 32%pragma(python) code = "import wx"
7bf85405 33
b68dc582
RD
34
35%{
36 static wxString wxPyEmptyStr("");
37%}
38
7bf85405
RD
39//---------------------------------------------------------------------------
40
41class wxEvtHandler {
42public:
c368d904
RD
43 wxEvtHandler();
44
cf694132 45 bool ProcessEvent(wxEvent& event);
f6bcfd97 46 void AddPendingEvent(wxEvent& event);
2f90df85
RD
47 //bool SearchEventTable(wxEventTable& table, wxEvent& event);
48
49 bool GetEvtHandlerEnabled();
50 void SetEvtHandlerEnabled(bool enabled);
51
52 wxEvtHandler* GetNextHandler();
53 wxEvtHandler* GetPreviousHandler();
54 void SetNextHandler(wxEvtHandler* handler);
55 void SetPreviousHandler(wxEvtHandler* handler);
56
57
7bf85405
RD
58 %addmethods {
59 void Connect( int id, int lastId, int eventType, PyObject* func) {
60 if (PyCallable_Check(func)) {
61 self->Connect(id, lastId, eventType,
853b255a 62 (wxObjectEventFunction) &wxPyCallback::EventThunker,
7bf85405
RD
63 new wxPyCallback(func));
64 }
65 }
6999b0d8
RD
66
67 bool Disconnect(int id, int lastId = -1,
68 wxEventType eventType = wxEVT_NULL) {
69 return self->Disconnect(id, lastId, eventType,
70 (wxObjectEventFunction)
71 &wxPyCallback::EventThunker);
72 }
73
7bf85405 74 }
f6bcfd97
BP
75
76 %pragma(python) addtoclass = "
77 _prop_list_ = {}
78 "
79
80// %pragma(python) addtoclass = "
81// def __getattr__(self, name):
82// pl = self._prop_list_
83// if pl.has_key(name):
84// getFunc, setFunc = pl[name]
85// if getFunc:
86// return getattr(self, getFunc)()
87// else:
88// raise TypeError, '%s property is write-only' % name
89// raise AttributeError, name
90
91// def __setattr__(self, name, value):
92// pl = self._prop_list_
93// if pl.has_key(name):
94// getFunc, setFunc = pl[name]
95// if setFunc:
96// return getattr(self, setFunc)(value)
97// else:
98// raise TypeError, '%s property is read-only' % name
99// self.__dict__[name] = value
100// "
7bf85405
RD
101};
102
103
2f90df85
RD
104//----------------------------------------------------------------------
105
106class wxValidator : public wxEvtHandler {
107public:
108 wxValidator();
109 //~wxValidator();
110
111 wxValidator* Clone();
112 wxWindow* GetWindow();
113 void SetWindow(wxWindow* window);
f6bcfd97 114
c368d904
RD
115// // Properties list
116// %pragma(python) addtoclass = "
117// _prop_list_ = {
118// 'window' : ('GetWindow', 'SetWindow'),
119// }
120// _prop_list_.update(wxEvtHandler._prop_list_)
121// "
2f90df85
RD
122};
123
124%inline %{
125 bool wxValidator_IsSilent() {
126 return wxValidator::IsSilent();
127 }
128
129 void wxValidator_SetBellOnError(int doIt = TRUE) {
130 wxValidator::SetBellOnError(doIt);
131 }
132%}
133
134//----------------------------------------------------------------------
135%{
136class wxPyValidator : public wxValidator {
137 DECLARE_DYNAMIC_CLASS(wxPyValidator);
138public:
139 wxPyValidator() {
140 }
141// wxPyValidator(const wxPyValidator& other);
142
143 ~wxPyValidator() {
144 }
145
146 wxObject* wxPyValidator::Clone() const {
694759cf
RD
147 wxPyValidator* ptr = NULL;
148 wxPyValidator* self = (wxPyValidator*)this;
149
150 bool doSave = wxPyRestoreThread();
151 if (self->m_myInst.findCallback("Clone")) {
152 PyObject* ro;
153 ro = self->m_myInst.callCallbackObj(Py_BuildValue("()"));
f6bcfd97
BP
154 if (ro) {
155 SWIG_GetPtrObj(ro, (void **)&ptr, "_wxPyValidator_p");
156 Py_DECREF(ro);
157 }
694759cf
RD
158 }
159 // This is very dangerous!!! But is the only way I could find
160 // to squash a memory leak. Currently it is okay, but if the
161 // validator architecture in wxWindows ever changes, problems
162 // could arise.
163 delete self;
164
165 wxPySaveThread(doSave);
166 return ptr;
2f90df85 167 }
2f90df85
RD
168
169 DEC_PYCALLBACK_BOOL_WXWIN(Validate);
170 DEC_PYCALLBACK_BOOL_(TransferToWindow);
171 DEC_PYCALLBACK_BOOL_(TransferFromWindow);
172
173 PYPRIVATE;
174// PyObject* m_data;
175};
176
177IMP_PYCALLBACK_BOOL_WXWIN(wxPyValidator, wxValidator, Validate);
178IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferToWindow);
179IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferFromWindow);
180
181IMPLEMENT_DYNAMIC_CLASS(wxPyValidator, wxValidator);
182
183%}
184
185class wxPyValidator : public wxValidator {
186public:
187 wxPyValidator();
188// ~wxPyValidator();
189
9b3d3bc4 190 %addmethods { void Destroy() { delete self; } }
2f90df85 191
f6bcfd97
BP
192 void _setSelf(PyObject* self, PyObject* _class, int incref=TRUE);
193 %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyValidator, 0)"
2f90df85
RD
194
195};
196
7bf85405
RD
197//----------------------------------------------------------------------
198
efc5f224 199%apply int * INOUT { int* x, int* y };
7bf85405
RD
200
201class wxWindow : public wxEvtHandler {
202public:
203
204 wxWindow(wxWindow* parent, const wxWindowID id,
b68dc582
RD
205 const wxPoint& pos = wxDefaultPosition,
206 const wxSize& size = wxDefaultSize,
7bf85405
RD
207 long style = 0,
208 char* name = "panel");
209
f6bcfd97 210 %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
7bf85405
RD
211
212 void CaptureMouse();
8bf5d46e
RD
213 void Center(int direction = wxBOTH);
214 void Centre(int direction = wxBOTH);
215 void CentreOnParent(int direction = wxBOTH );
216 void CenterOnParent(int direction = wxBOTH );
3ca6a5f0
BP
217 void CentreOnScreen(int direction = wxBOTH );
218 void CenterOnScreen(int direction = wxBOTH );
efc5f224
RD
219
220 // (uses apply'ed INOUT typemap, see above)
221 %name(ClientToScreenXY)void ClientToScreen(int* x, int* y);
af309447 222 wxPoint ClientToScreen(const wxPoint& pt);
efc5f224 223
7bf85405
RD
224 bool Close(int force = FALSE);
225 bool Destroy();
226 void DestroyChildren();
853b255a 227#ifdef __WXMSW__
7bf85405 228 void DragAcceptFiles(bool accept);
853b255a 229#endif
7bf85405
RD
230 void Enable(bool enable);
231 //bool FakePopupMenu(wxMenu* menu, int x, int y);
af309447 232 %name(FindWindowById) wxWindow* FindWindow(long id);
714e6a9e 233 %name(FindWindowByName) wxWindow* FindWindow(const wxString& name);
7bf85405
RD
234 void Fit();
235 wxColour GetBackgroundColour();
d426c97e
RD
236
237 //wxList& GetChildren();
238 %addmethods {
239 PyObject* GetChildren() {
240 wxWindowList& list = self->GetChildren();
241 return wxPy_ConvertList(&list, "wxWindow");
242 }
243 }
244
7bf85405
RD
245 int GetCharHeight();
246 int GetCharWidth();
b8b8dda7
RD
247 %name(GetClientSizeTuple) void GetClientSize(int *OUTPUT, int *OUTPUT);
248 wxSize GetClientSize();
7bf85405 249 wxLayoutConstraints * GetConstraints();
3ab72185 250 wxEvtHandler* GetEventHandler();
105e45b9 251
b8b8dda7 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);
bb0054cd 282 bool Hide();
7bf85405
RD
283 void InitDialog();
284 bool IsEnabled();
1b55cabf
RD
285 bool IsExposed( int x, int y, int w=0, int h=0 );
286 %name(IsExposedPoint) bool IsExposed( const wxPoint& pt );
287 %name(IsExposedRect) bool IsExposed( const wxRect& rect );
7bf85405
RD
288 bool IsRetained();
289 bool IsShown();
bb0054cd 290 bool IsTopLevel();
7bf85405
RD
291 void Layout();
292 bool LoadFromResource(wxWindow* parent, const wxString& resourceName, const wxResourceTable* resourceTable = NULL);
293 void Lower();
294 void MakeModal(bool flag);
af309447
RD
295 %name(MoveXY)void Move(int x, int y);
296 void Move(const wxPoint& point);
7bf85405 297
3ab72185
RD
298 wxEvtHandler* PopEventHandler(bool deleteHandler = FALSE);
299 void PushEventHandler(wxEvtHandler* handler);
7bf85405 300
8bf5d46e
RD
301 %name(PopupMenuXY)bool PopupMenu(wxMenu *menu, int x, int y);
302 bool PopupMenu(wxMenu *menu, const wxPoint& pos);
303
7bf85405
RD
304 void Raise();
305 void Refresh(bool eraseBackground = TRUE, const wxRect* rect = NULL);
306 void ReleaseMouse();
b7e72427 307 void RemoveChild(wxWindow* child);
bb0054cd
RD
308 bool Reparent( wxWindow* newParent );
309
efc5f224
RD
310 // (uses apply'ed INOUT typemap, see above)
311 %name(ScreenToClientXY)void ScreenToClient(int *x, int *y);
af309447
RD
312 wxPoint ScreenToClient(const wxPoint& pt);
313
7bf85405 314 void ScrollWindow(int dx, int dy, const wxRect* rect = NULL);
b8b8dda7 315 void SetAcceleratorTable(const wxAcceleratorTable& accel);
7bf85405 316 void SetAutoLayout(bool autoLayout);
1dec68aa 317 bool GetAutoLayout();
7bf85405
RD
318 void SetBackgroundColour(const wxColour& colour);
319 void SetConstraints(wxLayoutConstraints *constraints);
2f90df85 320 void UnsetConstraints(wxLayoutConstraints *constraints);
7bf85405 321 void SetFocus();
2f90df85 322 bool AcceptsFocus();
7bf85405
RD
323 void SetFont(const wxFont& font);
324 void SetForegroundColour(const wxColour& colour);
325 void SetId(int id);
326 void SetName(const wxString& name);
eb715945 327 void SetScrollbar(int orientation, int position, int thumbSize, int range, int refresh = TRUE);
7bf85405
RD
328 void SetScrollPos(int orientation, int pos, bool refresh = TRUE);
329
7bf85405
RD
330 %name(SetDimensions) void SetSize(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO);
331 %addmethods {
332 void SetSize(const wxSize& size) {
b7e72427 333 self->SetSize(size);
7bf85405
RD
334 }
335
336 void SetPosition(const wxPoint& pos) {
b7e72427 337 self->Move(pos);
7bf85405 338 }
33510773
RD
339
340 void SetRect(const wxRect& rect, int sizeFlags=wxSIZE_AUTO) {
341 self->SetSize(rect, sizeFlags);
342 }
7bf85405
RD
343 }
344
345 void SetSizeHints(int minW=-1, int minH=-1, int maxW=-1, int maxH=-1, int incW=-1, int incH=-1);
af309447
RD
346 %name(SetClientSizeWH)void SetClientSize(int width, int height);
347 void SetClientSize(const wxSize& size);
7bf85405 348 //void SetPalette(wxPalette* palette);
7bf85405 349 void SetCursor(const wxCursor&cursor);
3ab72185 350 void SetEventHandler(wxEvtHandler* handler);
83b18bab 351 void SetExtraStyle(long exStyle);
7bf85405
RD
352 void SetTitle(const wxString& title);
353 bool Show(bool show);
354 bool TransferDataFromWindow();
355 bool TransferDataToWindow();
356 bool Validate();
357 void WarpPointer(int x, int y);
358
b8b8dda7
RD
359 %name(ConvertDialogPointToPixels) wxPoint ConvertDialogToPixels(const wxPoint& pt);
360 %name(ConvertDialogSizeToPixels) wxSize ConvertDialogToPixels(const wxSize& sz);
361
cf694132
RD
362 %name(DLG_PNT) wxPoint ConvertDialogToPixels(const wxPoint& pt);
363 %name(DLG_SZE) wxSize ConvertDialogToPixels(const wxSize& sz);
364
b8b8dda7
RD
365 %name(ConvertPixelPointToDialog) wxPoint ConvertPixelsToDialog(const wxPoint& pt);
366 %name(ConvertPixelSizeToDialog) wxSize ConvertPixelsToDialog(const wxSize& sz);
367
af309447
RD
368 %name(SetToolTipString)void SetToolTip(const wxString &tip);
369 void SetToolTip(wxToolTip *tooltip);
370 wxToolTip* GetToolTip();
2f90df85
RD
371
372 void SetSizer(wxSizer* sizer);
f6bcfd97
BP
373 wxSizer* GetSizer();
374
2f90df85
RD
375 wxValidator* GetValidator();
376 void SetValidator(const wxValidator& validator);
377
b1462dfa
RD
378 void SetDropTarget(wxDropTarget* target);
379 wxDropTarget* GetDropTarget();
380 %pragma(python) addtomethod = "SetDropTarget:_args[0].thisown = 0"
694759cf
RD
381
382 wxSize GetBestSize();
a1df7a95
RD
383
384 void SetCaret(wxCaret *caret);
385 wxCaret *GetCaret();
c368d904 386 %pragma(python) addtoclass = "# replaces broken shadow methods
a1df7a95
RD
387 def GetCaret(self, *_args, **_kwargs):
388 from misc2 import wxCaretPtr
389 val = apply(windowsc.wxWindow_GetCaret,(self,) + _args, _kwargs)
390 if val: val = wxCaretPtr(val)
391 return val
f6bcfd97 392
c368d904
RD
393 def GetSizer(self, *_args, **_kwargs):
394 from sizers import wxSizerPtr
395 val = apply(windowsc.wxWindow_GetSizer,(self,) + _args, _kwargs)
396 if val: val = wxSizerPtr(val)
397 return val
f6bcfd97 398
c368d904
RD
399 def GetToolTip(self, *_args, **_kwargs):
400 from misc2 import wxToolTipPtr
401 val = apply(windowsc.wxWindow_GetToolTip,(self,) + _args, _kwargs)
402 if val: val = wxToolTipPtr(val)
403 return val
f6bcfd97 404 "
c368d904
RD
405
406
407// // Properties list
408// %pragma(python) addtoclass = "
409// _prop_list_ = {
410// 'size' : ('GetSize', 'SetSize'),
411// 'enabled' : ('IsEnabled', 'Enable'),
412// 'background' : ('GetBackgroundColour', 'SetBackgroundColour'),
413// 'foreground' : ('GetForegroundColour', 'SetForegroundColour'),
414// 'children' : ('GetChildren', None),
415// 'charHeight' : ('GetCharHeight', None),
416// 'charWidth' : ('GetCharWidth', None),
417// 'clientSize' : ('GetClientSize', 'SetClientSize'),
418// 'font' : ('GetFont', 'SetFont'),
419// 'grandParent' : ('GetGrandParent', None),
420// 'handle' : ('GetHandle', None),
421// 'label' : ('GetLabel', 'SetLabel'),
422// 'name' : ('GetName', 'SetName'),
423// 'parent' : ('GetParent', None),
424// 'position' : ('GetPosition', 'SetPosition'),
425// 'title' : ('GetTitle', 'SetTitle'),
426// 'style' : ('GetWindowStyleFlag', 'SetWindowStyleFlag'),
427// 'visible' : ('IsShown', 'Show'),
428// 'toolTip' : ('GetToolTip', 'SetToolTip'),
429// 'sizer' : ('GetSizer', 'SetSizer'),
430// 'validator' : ('GetValidator', 'SetValidator'),
431// 'dropTarget' : ('GetDropTarget', 'SetDropTarget'),
432// 'caret' : ('GetCaret', 'SetCaret'),
433// 'autoLayout' : ('GetAutoLayout', 'SetAutoLayout'),
434// 'constraints' : ('GetConstraints', 'SetConstraints'),
435
436// }
437// _prop_list_.update(wxEvtHandler._prop_list_)
438// "
7bf85405
RD
439};
440
efc5f224
RD
441
442
443
b8b8dda7 444%pragma(python) code = "
bb0054cd
RD
445def wxDLG_PNT(win, point_or_x, y=None):
446 if y is None:
447 return win.ConvertDialogPointToPixels(point_or_x)
448 else:
449 return win.ConvertDialogPointToPixels(wxPoint(point_or_x, y))
450
451def wxDLG_SZE(win, size_width, height=None):
452 if height is None:
453 return win.ConvertDialogSizeToPixels(size_width)
454 else:
455 return win.ConvertDialogSizeToPixels(wxSize(size_width, height))
b8b8dda7 456"
7bf85405 457
7bf85405
RD
458%inline %{
459 wxWindow* wxWindow_FindFocus() {
460 return wxWindow::FindFocus();
461 }
462%}
af309447
RD
463
464
c368d904 465#ifdef __WXMSW__
af309447
RD
466%inline %{
467wxWindow* wxWindow_FromHWND(unsigned long hWnd) {
468 wxWindow* win = new wxWindow;
469 win->SetHWND(hWnd);
470 win->SubclassWin(hWnd);
471 return win;
472}
473%}
853b255a 474#endif
7bf85405 475
a1df7a95
RD
476%inline %{
477 int wxWindow_NewControlId() {
478 return wxWindow::NewControlId();
479 }
480 int wxWindow_NextControlId(int id) {
481 return wxWindow::NextControlId(id);
482 }
483 int wxWindow_PrevControlId(int id) {
484 return wxWindow::PrevControlId(id);
485 }
486%}
7bf85405 487
efc5f224 488
7bf85405
RD
489//---------------------------------------------------------------------------
490
491class wxPanel : public wxWindow {
492public:
493 wxPanel(wxWindow* parent,
494 const wxWindowID id,
b68dc582
RD
495 const wxPoint& pos = wxDefaultPosition,
496 const wxSize& size = wxDefaultSize,
7bf85405
RD
497 long style = wxTAB_TRAVERSAL,
498 const char* name = "panel");
499
f6bcfd97 500 %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
9c039d08 501
7bf85405 502 void InitDialog();
bb0054cd
RD
503 wxButton* GetDefaultItem();
504 void SetDefaultItem(wxButton *btn);
505
3ab72185 506 // fix some SWIG trouble...
bb0054cd
RD
507 %pragma(python) addtoclass = "
508 def GetDefaultItem(self):
509 import controls
510 val = windowsc.wxPanel_GetDefaultItem(self.this)
511 val = controls.wxButtonPtr(val)
512 return val
513"
7bf85405
RD
514};
515
516//---------------------------------------------------------------------------
517
518class wxDialog : public wxPanel {
519public:
520 wxDialog(wxWindow* parent,
521 const wxWindowID id,
522 const wxString& title,
b68dc582
RD
523 const wxPoint& pos = wxDefaultPosition,
524 const wxSize& size = wxDefaultSize,
7bf85405
RD
525 long style = wxDEFAULT_DIALOG_STYLE,
526 const char* name = "dialogBox");
527
f6bcfd97 528 %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)"
9c039d08 529
7bf85405
RD
530 void Centre(int direction = wxBOTH);
531 void EndModal(int retCode);
532 wxString GetTitle();
533 void Iconize(bool iconize);
534 bool IsIconized();
7bf85405 535 void SetModal(bool flag);
853b255a 536 bool IsModal();
7bf85405
RD
537 void SetTitle(const wxString& title);
538 bool Show(bool show);
539 int ShowModal();
4cd9591a
RD
540
541 int GetReturnCode();
542 void SetReturnCode(int retCode);
7bf85405
RD
543};
544
545//---------------------------------------------------------------------------
546
bb0054cd 547class wxScrolledWindow : public wxPanel {
7bf85405
RD
548public:
549 wxScrolledWindow(wxWindow* parent,
550 const wxWindowID id = -1,
b68dc582
RD
551 const wxPoint& pos = wxDefaultPosition,
552 const wxSize& size = wxDefaultSize,
7bf85405
RD
553 long style = wxHSCROLL | wxVSCROLL,
554 char* name = "scrolledWindow");
555
f6bcfd97
BP
556 %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
557 %pragma(python) addtomethod = "__init__:#wx._StdOnScrollCallbacks(self)"
9c039d08 558
7bf85405 559 void EnableScrolling(bool xScrolling, bool yScrolling);
b7e72427 560 int GetScrollPageSize(int orient);
7bf85405 561 void GetScrollPixelsPerUnit(int* OUTPUT, int* OUTPUT);
b7e72427 562 wxWindow* GetTargetWindow();
7bf85405
RD
563 void GetVirtualSize(int* OUTPUT, int* OUTPUT);
564 bool IsRetained();
565 void PrepareDC(wxDC& dc);
566 void Scroll(int x, int y);
567 void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
568 int noUnitsX, int noUnitsY,
f6bcfd97 569 int xPos = 0, int yPos = 0, int noRefresh=FALSE);
b7e72427 570 void SetScrollPageSize(int orient, int pageSize);
eb715945 571 void SetTargetWindow(wxWindow* window);
4c9993c3 572 void GetViewStart(int* OUTPUT, int* OUTPUT);
7bf85405 573 void ViewStart(int* OUTPUT, int* OUTPUT);
9d8bd15f
RD
574
575 void CalcScrolledPosition( int x, int y, int *OUTPUT, int *OUTPUT);
576 void CalcUnscrolledPosition( int x, int y, int *OUTPUT, int *OUTPUT);
577
7bf85405
RD
578};
579
580//----------------------------------------------------------------------
581
582
583class wxMenu : public wxEvtHandler {
584public:
8bf5d46e 585 wxMenu(const wxString& title = wxPyEmptyStr, long style = 0);
7bf85405
RD
586
587 void Append(int id, const wxString& item,
588 const wxString& helpString = wxPyEmptyStr,
589 int checkable = FALSE);
590 %name(AppendMenu)void Append(int id, const wxString& item, wxMenu *subMenu,
591 const wxString& helpString = wxPyEmptyStr);
af309447
RD
592 %name(AppendItem)void Append(const wxMenuItem* item);
593
7bf85405
RD
594 void AppendSeparator();
595 void Break();
596 void Check(int id, bool flag);
b1462dfa 597 bool IsChecked(int id);
7bf85405 598 void Enable(int id, bool enable);
b1462dfa
RD
599 bool IsEnabled(int id);
600
7bf85405 601 int FindItem(const wxString& itemString);
b1462dfa
RD
602 %name(FindItemById)wxMenuItem* FindItem(int id/*, wxMenu **menu = NULL*/);
603
7bf85405 604 wxString GetTitle();
7bf85405 605 void SetTitle(const wxString& title);
b1462dfa 606
714e6a9e 607 wxString GetLabel(int id);
853b255a 608 void SetLabel(int id, const wxString& label);
b1462dfa
RD
609
610 wxString GetHelpString(int id);
611 void SetHelpString(int id, const wxString& helpString);
8bf5d46e 612 void UpdateUI(wxEvtHandler* source = NULL);
efc5f224 613
b1462dfa
RD
614 bool Delete(int id);
615 %name(DeleteItem)bool Delete(wxMenuItem *item);
616 bool Insert(size_t pos, wxMenuItem *item);
617 wxMenuItem *Remove(int id);
618 %name(RemoveItem) wxMenuItem *Remove(wxMenuItem *item);
619
efc5f224 620 %addmethods {
eb715945 621 void Destroy() { delete self; }
efc5f224 622 }
b1462dfa
RD
623 %name(DestroyId)bool Destroy(int id);
624 %name(DestroyItem)bool Destroy(wxMenuItem *item);
efc5f224 625
b1462dfa
RD
626 size_t GetMenuItemCount();
627 //wxMenuItemList& GetMenuItems();
628 %addmethods {
629 PyObject* GetMenuItems() {
630 wxMenuItemList& list = self->GetMenuItems();
631 return wxPy_ConvertList(&list, "wxMenuItem");
632 }
633 }
7bf85405 634
b1462dfa
RD
635 void SetEventHandler(wxEvtHandler *handler);
636 wxEvtHandler *GetEventHandler();
637
638 void SetInvokingWindow(wxWindow *win);
639 wxWindow *GetInvokingWindow();
640
641 long GetStyle();
642
643 bool IsAttached();
644
645 void SetParent(wxMenu *parent);
646 wxMenu *GetParent();
647};
7bf85405 648
7bf85405
RD
649
650//----------------------------------------------------------------------
651
b1462dfa 652class wxMenuBar : public wxWindow {
7bf85405 653public:
c368d904 654 wxMenuBar(long style = 0);
7bf85405 655
b1462dfa
RD
656 bool Append(wxMenu *menu, const wxString& title);
657 bool Insert(size_t pos, wxMenu *menu, const wxString& title);
658 size_t GetMenuCount();
659 wxMenu *GetMenu(size_t pos);
660 wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title);
661 wxMenu *Remove(size_t pos);
662 void EnableTop(size_t pos, bool enable);
663 void SetLabelTop(size_t pos, const wxString& label);
664 wxString GetLabelTop(size_t pos);
665 int FindMenuItem(const wxString& menuString, const wxString& itemString);
666 %name(FindItemById)wxMenuItem* FindItem(int id/*, wxMenu **menu = NULL*/);
7bf85405 667 void Enable(int id, bool enable);
b1462dfa 668 void Check(int id, bool check);
2abc0a0f
RD
669 bool IsChecked(int id);
670 bool IsEnabled(int id);
b1462dfa
RD
671
672 void SetLabel(int id, const wxString &label);
7bf85405 673 wxString GetLabel(int id);
b1462dfa 674
7bf85405 675 void SetHelpString(int id, const wxString& helpString);
b1462dfa 676 wxString GetHelpString(int id);
2abc0a0f 677
7bf85405
RD
678};
679
680
681//----------------------------------------------------------------------
682
683class wxMenuItem {
684public:
4c9993c3 685 wxMenuItem(wxMenu* parentMenu=NULL, int id=wxID_SEPARATOR,
cf694132 686 const wxString& text = wxPyEmptyStr,
b1462dfa
RD
687 const wxString& help = wxPyEmptyStr,
688 bool isCheckable = FALSE, wxMenu* subMenu = NULL);
cf694132 689
b1462dfa
RD
690
691 wxMenu *GetMenu();
2abc0a0f 692 void SetId(int id);
b1462dfa
RD
693 int GetId();
694 bool IsSeparator();
2abc0a0f 695 void SetText(const wxString& str);
b1462dfa 696 wxString GetLabel();
2abc0a0f 697 const wxString& GetText();
2abc0a0f 698 void SetCheckable(bool checkable);
b1462dfa
RD
699 bool IsCheckable();
700 bool IsSubMenu();
2abc0a0f 701 void SetSubMenu(wxMenu *menu);
b1462dfa
RD
702 wxMenu *GetSubMenu();
703 void Enable(bool enable = TRUE);
704 bool IsEnabled();
705 void Check(bool check = TRUE);
706 bool IsChecked();
707 void Toggle();
708 void SetHelp(const wxString& str);
709 const wxString& GetHelp();
710 wxAcceleratorEntry *GetAccel();
711 void SetAccel(wxAcceleratorEntry *accel);
712
1b62f00d
RD
713 static wxString GetLabelFromText(const wxString& text);
714
715 // TODO: Add wxOwnerDrawn methods, also look at other ownerdrawn classes...
716
7bf85405
RD
717};
718
719//---------------------------------------------------------------------------
7bf85405
RD
720
721
694759cf 722