]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/windows.i
Updates for recent changes to wx, and some other little tweaks and fixes.
[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
RD
35
36%{
37 static wxString wxPyEmptyStr("");
38%}
39
7bf85405
RD
40//---------------------------------------------------------------------------
41
9416aa89 42class wxEvtHandler : public wxObject {
7bf85405 43public:
c368d904
RD
44 wxEvtHandler();
45
cf694132 46 bool ProcessEvent(wxEvent& event);
f6bcfd97 47 void AddPendingEvent(wxEvent& event);
2f90df85
RD
48 //bool SearchEventTable(wxEventTable& table, wxEvent& event);
49
50 bool GetEvtHandlerEnabled();
51 void SetEvtHandlerEnabled(bool enabled);
52
53 wxEvtHandler* GetNextHandler();
54 wxEvtHandler* GetPreviousHandler();
55 void SetNextHandler(wxEvtHandler* handler);
56 void SetPreviousHandler(wxEvtHandler* handler);
57
58
7bf85405
RD
59 %addmethods {
60 void Connect( int id, int lastId, int eventType, PyObject* func) {
61 if (PyCallable_Check(func)) {
62 self->Connect(id, lastId, eventType,
853b255a 63 (wxObjectEventFunction) &wxPyCallback::EventThunker,
7bf85405
RD
64 new wxPyCallback(func));
65 }
25b00b4e
RD
66 else if (func == Py_None) {
67 self->Disconnect(id, lastId, eventType,
68 (wxObjectEventFunction)
69 &wxPyCallback::EventThunker);
70 }
71 else {
72 PyErr_SetString(PyExc_TypeError, "Expected callable object or None.");
73 }
7bf85405 74 }
6999b0d8
RD
75
76 bool Disconnect(int id, int lastId = -1,
77 wxEventType eventType = wxEVT_NULL) {
78 return self->Disconnect(id, lastId, eventType,
79 (wxObjectEventFunction)
80 &wxPyCallback::EventThunker);
81 }
7bf85405 82 }
f6bcfd97 83
0122b7e3
RD
84 %addmethods {
85 void _setOORInfo(PyObject* _self) {
86 self->SetClientObject(new wxPyClientData(_self));
87 }
88 }
7bf85405
RD
89};
90
91
2f90df85
RD
92//----------------------------------------------------------------------
93
94class wxValidator : public wxEvtHandler {
95public:
96 wxValidator();
97 //~wxValidator();
98
0122b7e3
RD
99 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
100
2f90df85
RD
101 wxValidator* Clone();
102 wxWindow* GetWindow();
103 void SetWindow(wxWindow* window);
f6bcfd97 104
9416aa89
RD
105 static bool IsSilent();
106 static void SetBellOnError(int doIt = TRUE);
107
2f90df85
RD
108};
109
2f90df85
RD
110
111//----------------------------------------------------------------------
112%{
113class wxPyValidator : public wxValidator {
114 DECLARE_DYNAMIC_CLASS(wxPyValidator);
115public:
116 wxPyValidator() {
117 }
2f90df85
RD
118
119 ~wxPyValidator() {
120 }
121
19a97bd6 122 wxObject* Clone() const {
694759cf
RD
123 wxPyValidator* ptr = NULL;
124 wxPyValidator* self = (wxPyValidator*)this;
125
4268f798 126 wxPyBeginBlockThreads();
694759cf
RD
127 if (self->m_myInst.findCallback("Clone")) {
128 PyObject* ro;
129 ro = self->m_myInst.callCallbackObj(Py_BuildValue("()"));
f6bcfd97
BP
130 if (ro) {
131 SWIG_GetPtrObj(ro, (void **)&ptr, "_wxPyValidator_p");
132 Py_DECREF(ro);
133 }
694759cf 134 }
4268f798 135 wxPyEndBlockThreads();
19a97bd6 136
694759cf
RD
137 // This is very dangerous!!! But is the only way I could find
138 // to squash a memory leak. Currently it is okay, but if the
139 // validator architecture in wxWindows ever changes, problems
140 // could arise.
141 delete self;
694759cf 142 return ptr;
2f90df85 143 }
2f90df85 144
9416aa89 145
2f90df85
RD
146 DEC_PYCALLBACK_BOOL_WXWIN(Validate);
147 DEC_PYCALLBACK_BOOL_(TransferToWindow);
148 DEC_PYCALLBACK_BOOL_(TransferFromWindow);
149
150 PYPRIVATE;
2f90df85
RD
151};
152
153IMP_PYCALLBACK_BOOL_WXWIN(wxPyValidator, wxValidator, Validate);
154IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferToWindow);
155IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferFromWindow);
156
157IMPLEMENT_DYNAMIC_CLASS(wxPyValidator, wxValidator);
158
159%}
160
161class wxPyValidator : public wxValidator {
162public:
163 wxPyValidator();
2f90df85 164
0122b7e3
RD
165 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=TRUE);
166 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyValidator, 1)"
2f90df85 167
0122b7e3 168 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
2f90df85
RD
169};
170
7bf85405
RD
171//----------------------------------------------------------------------
172
efc5f224 173%apply int * INOUT { int* x, int* y };
7bf85405
RD
174
175class wxWindow : public wxEvtHandler {
176public:
7bf85405 177 wxWindow(wxWindow* parent, const wxWindowID id,
b68dc582
RD
178 const wxPoint& pos = wxDefaultPosition,
179 const wxSize& size = wxDefaultSize,
7bf85405
RD
180 long style = 0,
181 char* name = "panel");
09f3d4e6 182 %name(wxPreWindow)wxWindow();
7bf85405 183
09f3d4e6
RD
184 bool Create(wxWindow* parent, const wxWindowID id,
185 const wxPoint& pos = wxDefaultPosition,
186 const wxSize& size = wxDefaultSize,
187 long style = 0,
188 char* name = "panel");
7bf85405 189
0122b7e3 190 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
17c0e08c 191 %pragma(python) addtomethod = "wxPreWindow:val._setOORInfo(val)"
0122b7e3
RD
192
193
7bf85405 194 void CaptureMouse();
8bf5d46e
RD
195 void Center(int direction = wxBOTH);
196 void Centre(int direction = wxBOTH);
197 void CentreOnParent(int direction = wxBOTH );
198 void CenterOnParent(int direction = wxBOTH );
3ca6a5f0
BP
199 void CentreOnScreen(int direction = wxBOTH );
200 void CenterOnScreen(int direction = wxBOTH );
efc5f224 201
d56cebe7
RD
202 void Clear();
203
efc5f224
RD
204 // (uses apply'ed INOUT typemap, see above)
205 %name(ClientToScreenXY)void ClientToScreen(int* x, int* y);
af309447 206 wxPoint ClientToScreen(const wxPoint& pt);
efc5f224 207
7bf85405
RD
208 bool Close(int force = FALSE);
209 bool Destroy();
210 void DestroyChildren();
10e07c70 211 bool IsBeingDeleted();
853b255a 212#ifdef __WXMSW__
7bf85405 213 void DragAcceptFiles(bool accept);
853b255a 214#endif
7bf85405
RD
215 void Enable(bool enable);
216 //bool FakePopupMenu(wxMenu* menu, int x, int y);
af309447 217 %name(FindWindowById) wxWindow* FindWindow(long id);
714e6a9e 218 %name(FindWindowByName) wxWindow* FindWindow(const wxString& name);
7bf85405
RD
219 void Fit();
220 wxColour GetBackgroundColour();
d426c97e
RD
221
222 //wxList& GetChildren();
223 %addmethods {
224 PyObject* GetChildren() {
225 wxWindowList& list = self->GetChildren();
226 return wxPy_ConvertList(&list, "wxWindow");
227 }
228 }
229
7bf85405
RD
230 int GetCharHeight();
231 int GetCharWidth();
b8b8dda7
RD
232 %name(GetClientSizeTuple) void GetClientSize(int *OUTPUT, int *OUTPUT);
233 wxSize GetClientSize();
7bf85405 234 wxLayoutConstraints * GetConstraints();
3ab72185 235 wxEvtHandler* GetEventHandler();
105e45b9 236
c5943253 237 wxFont GetFont();
7bf85405
RD
238 wxColour GetForegroundColour();
239 wxWindow * GetGrandParent();
2abc0a0f
RD
240 %addmethods {
241 long GetHandle() {
54b96882 242 return wxPyGetWinHandle(self); //(long)self->GetHandle();
2abc0a0f
RD
243 }
244 }
7bf85405 245 int GetId();
853b255a 246 wxString GetLabel();
bb0054cd 247 void SetLabel(const wxString& label);
853b255a 248 wxString GetName();
7bf85405 249 wxWindow * GetParent();
b8b8dda7
RD
250 %name(GetPositionTuple) void GetPosition(int *OUTPUT, int *OUTPUT);
251 wxPoint GetPosition();
252 wxRect GetRect();
7bf85405
RD
253 int GetScrollThumb(int orientation);
254 int GetScrollPos(int orientation);
255 int GetScrollRange(int orientation);
b8b8dda7
RD
256 %name(GetSizeTuple) void GetSize(int *OUTPUT, int *OUTPUT);
257 wxSize GetSize();
af309447
RD
258 void GetTextExtent(const wxString& string, int *OUTPUT, int *OUTPUT);
259 %name(GetFullTextExtent)void GetTextExtent(const wxString& string,
260 int *OUTPUT, int *OUTPUT, int *OUTPUT, int* OUTPUT,
261 const wxFont* font = NULL); //, bool use16 = FALSE)
853b255a 262 wxString GetTitle();
8bf5d46e 263 wxRegion GetUpdateRegion();
7bf85405 264 long GetWindowStyleFlag();
f6bcfd97
BP
265 void SetWindowStyleFlag(long style);
266 void SetWindowStyle(long style);
bb0054cd 267 bool Hide();
7bf85405
RD
268 void InitDialog();
269 bool IsEnabled();
1b55cabf
RD
270 bool IsExposed( int x, int y, int w=0, int h=0 );
271 %name(IsExposedPoint) bool IsExposed( const wxPoint& pt );
272 %name(IsExposedRect) bool IsExposed( const wxRect& rect );
7bf85405
RD
273 bool IsRetained();
274 bool IsShown();
bb0054cd 275 bool IsTopLevel();
7bf85405
RD
276 void Layout();
277 bool LoadFromResource(wxWindow* parent, const wxString& resourceName, const wxResourceTable* resourceTable = NULL);
278 void Lower();
ecc08ead 279 void MakeModal(bool flag=TRUE);
af309447
RD
280 %name(MoveXY)void Move(int x, int y);
281 void Move(const wxPoint& point);
7bf85405 282
3ab72185
RD
283 wxEvtHandler* PopEventHandler(bool deleteHandler = FALSE);
284 void PushEventHandler(wxEvtHandler* handler);
7bf85405 285
c6c593e8
RD
286 // find the given handler in the event handler chain and remove (but
287 // not delete) it from the event handler chain, return TRUE if it was
288 // found and FALSE otherwise (this also results in an assert failure so
289 // this function should only be called when the handler is supposed to
290 // be there)
291 bool RemoveEventHandler(wxEvtHandler *handler);
292
8bf5d46e
RD
293 %name(PopupMenuXY)bool PopupMenu(wxMenu *menu, int x, int y);
294 bool PopupMenu(wxMenu *menu, const wxPoint& pos);
295
7bf85405
RD
296 void Raise();
297 void Refresh(bool eraseBackground = TRUE, const wxRect* rect = NULL);
09f3d4e6
RD
298 void RefreshRect(const wxRect& rect);
299
7bf85405 300 void ReleaseMouse();
b7e72427 301 void RemoveChild(wxWindow* child);
bb0054cd
RD
302 bool Reparent( wxWindow* newParent );
303
efc5f224
RD
304 // (uses apply'ed INOUT typemap, see above)
305 %name(ScreenToClientXY)void ScreenToClient(int *x, int *y);
af309447
RD
306 wxPoint ScreenToClient(const wxPoint& pt);
307
7bf85405
RD
308 void ScrollWindow(int dx, int dy, const wxRect* rect = NULL);
309 void SetAutoLayout(bool autoLayout);
1dec68aa 310 bool GetAutoLayout();
7bf85405
RD
311 void SetBackgroundColour(const wxColour& colour);
312 void SetConstraints(wxLayoutConstraints *constraints);
2f90df85 313 void UnsetConstraints(wxLayoutConstraints *constraints);
7bf85405 314 void SetFocus();
2f90df85 315 bool AcceptsFocus();
7bf85405
RD
316 void SetFont(const wxFont& font);
317 void SetForegroundColour(const wxColour& colour);
318 void SetId(int id);
319 void SetName(const wxString& name);
eb715945 320 void SetScrollbar(int orientation, int position, int thumbSize, int range, int refresh = TRUE);
7bf85405
RD
321 void SetScrollPos(int orientation, int pos, bool refresh = TRUE);
322
7bf85405
RD
323 %name(SetDimensions) void SetSize(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO);
324 %addmethods {
325 void SetSize(const wxSize& size) {
b7e72427 326 self->SetSize(size);
7bf85405
RD
327 }
328
329 void SetPosition(const wxPoint& pos) {
b7e72427 330 self->Move(pos);
7bf85405 331 }
33510773
RD
332
333 void SetRect(const wxRect& rect, int sizeFlags=wxSIZE_AUTO) {
334 self->SetSize(rect, sizeFlags);
335 }
7bf85405
RD
336 }
337
338 void SetSizeHints(int minW=-1, int minH=-1, int maxW=-1, int maxH=-1, int incW=-1, int incH=-1);
af309447
RD
339 %name(SetClientSizeWH)void SetClientSize(int width, int height);
340 void SetClientSize(const wxSize& size);
7bf85405 341 //void SetPalette(wxPalette* palette);
c5943253 342 void SetCursor(const wxCursor& cursor);
3ab72185 343 void SetEventHandler(wxEvtHandler* handler);
83b18bab 344 void SetExtraStyle(long exStyle);
7bf85405 345 void SetTitle(const wxString& title);
7b7ac0ab 346 bool Show(bool show=TRUE);
7bf85405
RD
347 bool TransferDataFromWindow();
348 bool TransferDataToWindow();
349 bool Validate();
350 void WarpPointer(int x, int y);
351
b8b8dda7
RD
352 %name(ConvertDialogPointToPixels) wxPoint ConvertDialogToPixels(const wxPoint& pt);
353 %name(ConvertDialogSizeToPixels) wxSize ConvertDialogToPixels(const wxSize& sz);
354
cf694132
RD
355 %name(DLG_PNT) wxPoint ConvertDialogToPixels(const wxPoint& pt);
356 %name(DLG_SZE) wxSize ConvertDialogToPixels(const wxSize& sz);
357
b8b8dda7
RD
358 %name(ConvertPixelPointToDialog) wxPoint ConvertPixelsToDialog(const wxPoint& pt);
359 %name(ConvertPixelSizeToDialog) wxSize ConvertPixelsToDialog(const wxSize& sz);
360
af309447
RD
361 %name(SetToolTipString)void SetToolTip(const wxString &tip);
362 void SetToolTip(wxToolTip *tooltip);
363 wxToolTip* GetToolTip();
2f90df85
RD
364
365 void SetSizer(wxSizer* sizer);
f6bcfd97
BP
366 wxSizer* GetSizer();
367
2f90df85
RD
368 wxValidator* GetValidator();
369 void SetValidator(const wxValidator& validator);
370
e6056257 371#ifndef __WXMAC__
b1462dfa
RD
372 void SetDropTarget(wxDropTarget* target);
373 wxDropTarget* GetDropTarget();
374 %pragma(python) addtomethod = "SetDropTarget:_args[0].thisown = 0"
e6056257 375#endif
694759cf
RD
376
377 wxSize GetBestSize();
a1df7a95
RD
378
379 void SetCaret(wxCaret *caret);
380 wxCaret *GetCaret();
9416aa89 381 %pragma(python) addtoclass = "# replaces broken shadow method
a1df7a95
RD
382 def GetCaret(self, *_args, **_kwargs):
383 from misc2 import wxCaretPtr
384 val = apply(windowsc.wxWindow_GetCaret,(self,) + _args, _kwargs)
385 if val: val = wxCaretPtr(val)
386 return val
f6bcfd97 387 "
c368d904 388
3a0958b1
RD
389 void Freeze();
390 void Thaw();
09f3d4e6 391 void Update();
3a0958b1 392
4f3449b4
RD
393 wxString GetHelpText();
394 void SetHelpText(const wxString& helpText);
395
c7e7022c
RD
396 bool ScrollLines(int lines);
397 bool ScrollPages(int pages);
398 bool LineUp();
399 bool LineDown();
400 bool PageUp();
401 bool PageDown();
402
09f3d4e6
RD
403 static wxWindow* FindFocus();
404 static int NewControlId();
405 static int NextControlId(int id);
406 static int PrevControlId(int id);
c7e7022c 407
ecc08ead
RD
408 void SetAcceleratorTable(const wxAcceleratorTable& accel);
409 wxAcceleratorTable *GetAcceleratorTable();
78e8819c 410
74bcba0e 411#ifdef __WXMSW__
07c99b26 412 // A way to do the native draw first... Too bad it isn't in wxGTK too.
74bcba0e
RD
413 void OnPaint(wxPaintEvent& event);
414#endif
5a2930ab
RD
415
416 wxButton* GetDefaultItem();
417 void SetDefaultItem(wxButton *btn);
7bf85405
RD
418};
419
efc5f224
RD
420
421
422
b8b8dda7 423%pragma(python) code = "
bb0054cd
RD
424def wxDLG_PNT(win, point_or_x, y=None):
425 if y is None:
426 return win.ConvertDialogPointToPixels(point_or_x)
427 else:
428 return win.ConvertDialogPointToPixels(wxPoint(point_or_x, y))
429
430def wxDLG_SZE(win, size_width, height=None):
431 if height is None:
432 return win.ConvertDialogSizeToPixels(size_width)
433 else:
434 return win.ConvertDialogSizeToPixels(wxSize(size_width, height))
b8b8dda7 435"
7bf85405 436
af309447 437
c368d904 438#ifdef __WXMSW__
af309447
RD
439%inline %{
440wxWindow* wxWindow_FromHWND(unsigned long hWnd) {
441 wxWindow* win = new wxWindow;
442 win->SetHWND(hWnd);
443 win->SubclassWin(hWnd);
444 return win;
445}
446%}
853b255a 447#endif
7bf85405 448
efc5f224 449
7bf85405
RD
450//---------------------------------------------------------------------------
451
452class wxPanel : public wxWindow {
453public:
454 wxPanel(wxWindow* parent,
455 const wxWindowID id,
b68dc582
RD
456 const wxPoint& pos = wxDefaultPosition,
457 const wxSize& size = wxDefaultSize,
7bf85405
RD
458 long style = wxTAB_TRAVERSAL,
459 const char* name = "panel");
09f3d4e6 460 %name(wxPrePanel)wxPanel();
7bf85405 461
09f3d4e6
RD
462 bool Create(wxWindow* parent,
463 const wxWindowID id,
464 const wxPoint& pos = wxDefaultPosition,
465 const wxSize& size = wxDefaultSize,
466 long style = wxTAB_TRAVERSAL,
467 const char* name = "panel");
9c039d08 468
0122b7e3 469 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
7b7ac0ab 470 %pragma(python) addtomethod = "wxPrePanel:val._setOORInfo(val)"
0122b7e3 471
7bf85405 472 void InitDialog();
bb0054cd 473
7bf85405
RD
474};
475
476//---------------------------------------------------------------------------
477
0adbc166
RD
478
479// TODO: Add wrappers for the wxScrollHelper class, make wxScrolledWindow
480// derive from it and wxPanel.
481
482
bb0054cd 483class wxScrolledWindow : public wxPanel {
7bf85405
RD
484public:
485 wxScrolledWindow(wxWindow* parent,
486 const wxWindowID id = -1,
b68dc582
RD
487 const wxPoint& pos = wxDefaultPosition,
488 const wxSize& size = wxDefaultSize,
7bf85405
RD
489 long style = wxHSCROLL | wxVSCROLL,
490 char* name = "scrolledWindow");
09f3d4e6
RD
491 %name(wxPreScrolledWindow)wxScrolledWindow();
492
493 bool Create(wxWindow* parent,
494 const wxWindowID id = -1,
495 const wxPoint& pos = wxDefaultPosition,
496 const wxSize& size = wxDefaultSize,
497 long style = wxHSCROLL | wxVSCROLL,
498 char* name = "scrolledWindow");
9c039d08 499
0122b7e3 500 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
17c0e08c 501 %pragma(python) addtomethod = "wxPreScrolledWindow:val._setOORInfo(val)"
0122b7e3 502
7bf85405 503 void EnableScrolling(bool xScrolling, bool yScrolling);
b7e72427 504 int GetScrollPageSize(int orient);
7bf85405 505 void GetScrollPixelsPerUnit(int* OUTPUT, int* OUTPUT);
b7e72427 506 wxWindow* GetTargetWindow();
7bf85405
RD
507 void GetVirtualSize(int* OUTPUT, int* OUTPUT);
508 bool IsRetained();
509 void PrepareDC(wxDC& dc);
510 void Scroll(int x, int y);
511 void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
512 int noUnitsX, int noUnitsY,
f6bcfd97 513 int xPos = 0, int yPos = 0, int noRefresh=FALSE);
b7e72427 514 void SetScrollPageSize(int orient, int pageSize);
eb715945 515 void SetTargetWindow(wxWindow* window);
4c9993c3 516 void GetViewStart(int* OUTPUT, int* OUTPUT);
0adbc166 517 %pragma(python) addtoclass = "ViewStart = GetViewStart"
9d8bd15f
RD
518
519 void CalcScrolledPosition( int x, int y, int *OUTPUT, int *OUTPUT);
520 void CalcUnscrolledPosition( int x, int y, int *OUTPUT, int *OUTPUT);
521
d1679124
RD
522 void SetScale(double xs, double ys);
523 double GetScaleX();
524 double GetScaleY();
525
526 void AdjustScrollbars();
7bf85405
RD
527};
528
529//----------------------------------------------------------------------
530
531
532class wxMenu : public wxEvtHandler {
533public:
8bf5d46e 534 wxMenu(const wxString& title = wxPyEmptyStr, long style = 0);
7bf85405 535
0122b7e3
RD
536 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
537
7bf85405
RD
538 void Append(int id, const wxString& item,
539 const wxString& helpString = wxPyEmptyStr,
926bb76c 540 int checkable = FALSE);
7bf85405
RD
541 %name(AppendMenu)void Append(int id, const wxString& item, wxMenu *subMenu,
542 const wxString& helpString = wxPyEmptyStr);
af309447
RD
543 %name(AppendItem)void Append(const wxMenuItem* item);
544
7bf85405
RD
545 void AppendSeparator();
546 void Break();
547 void Check(int id, bool flag);
b1462dfa 548 bool IsChecked(int id);
7bf85405 549 void Enable(int id, bool enable);
b1462dfa
RD
550 bool IsEnabled(int id);
551
7bf85405 552 int FindItem(const wxString& itemString);
b1462dfa
RD
553 %name(FindItemById)wxMenuItem* FindItem(int id/*, wxMenu **menu = NULL*/);
554
7bf85405 555 wxString GetTitle();
7bf85405 556 void SetTitle(const wxString& title);
b1462dfa 557
714e6a9e 558 wxString GetLabel(int id);
853b255a 559 void SetLabel(int id, const wxString& label);
b1462dfa
RD
560
561 wxString GetHelpString(int id);
562 void SetHelpString(int id, const wxString& helpString);
8bf5d46e 563 void UpdateUI(wxEvtHandler* source = NULL);
efc5f224 564
b1462dfa
RD
565 bool Delete(int id);
566 %name(DeleteItem)bool Delete(wxMenuItem *item);
567 bool Insert(size_t pos, wxMenuItem *item);
568 wxMenuItem *Remove(int id);
569 %name(RemoveItem) wxMenuItem *Remove(wxMenuItem *item);
570
efc5f224 571 %addmethods {
eb715945 572 void Destroy() { delete self; }
efc5f224 573 }
b1462dfa
RD
574 %name(DestroyId)bool Destroy(int id);
575 %name(DestroyItem)bool Destroy(wxMenuItem *item);
efc5f224 576
b1462dfa
RD
577 size_t GetMenuItemCount();
578 //wxMenuItemList& GetMenuItems();
579 %addmethods {
580 PyObject* GetMenuItems() {
581 wxMenuItemList& list = self->GetMenuItems();
582 return wxPy_ConvertList(&list, "wxMenuItem");
583 }
584 }
7bf85405 585
b1462dfa
RD
586 void SetEventHandler(wxEvtHandler *handler);
587 wxEvtHandler *GetEventHandler();
588
589 void SetInvokingWindow(wxWindow *win);
590 wxWindow *GetInvokingWindow();
591
592 long GetStyle();
593
594 bool IsAttached();
595
596 void SetParent(wxMenu *parent);
597 wxMenu *GetParent();
598};
7bf85405 599
7bf85405
RD
600
601//----------------------------------------------------------------------
602
b1462dfa 603class wxMenuBar : public wxWindow {
7bf85405 604public:
c368d904 605 wxMenuBar(long style = 0);
7bf85405 606
0122b7e3
RD
607 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
608
b1462dfa
RD
609 bool Append(wxMenu *menu, const wxString& title);
610 bool Insert(size_t pos, wxMenu *menu, const wxString& title);
611 size_t GetMenuCount();
612 wxMenu *GetMenu(size_t pos);
613 wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title);
614 wxMenu *Remove(size_t pos);
615 void EnableTop(size_t pos, bool enable);
616 void SetLabelTop(size_t pos, const wxString& label);
617 wxString GetLabelTop(size_t pos);
3a0958b1 618 int FindMenu(const wxString& title);
b1462dfa
RD
619 int FindMenuItem(const wxString& menuString, const wxString& itemString);
620 %name(FindItemById)wxMenuItem* FindItem(int id/*, wxMenu **menu = NULL*/);
7bf85405 621 void Enable(int id, bool enable);
b1462dfa 622 void Check(int id, bool check);
2abc0a0f
RD
623 bool IsChecked(int id);
624 bool IsEnabled(int id);
b1462dfa
RD
625
626 void SetLabel(int id, const wxString &label);
7bf85405 627 wxString GetLabel(int id);
b1462dfa 628
7bf85405 629 void SetHelpString(int id, const wxString& helpString);
b1462dfa 630 wxString GetHelpString(int id);
2abc0a0f 631
7bf85405
RD
632};
633
634
635//----------------------------------------------------------------------
636
9416aa89 637class wxMenuItem : public wxObject {
7bf85405 638public:
4c9993c3 639 wxMenuItem(wxMenu* parentMenu=NULL, int id=wxID_SEPARATOR,
cf694132 640 const wxString& text = wxPyEmptyStr,
b1462dfa
RD
641 const wxString& help = wxPyEmptyStr,
642 bool isCheckable = FALSE, wxMenu* subMenu = NULL);
cf694132 643
b1462dfa
RD
644
645 wxMenu *GetMenu();
2abc0a0f 646 void SetId(int id);
b1462dfa
RD
647 int GetId();
648 bool IsSeparator();
2abc0a0f 649 void SetText(const wxString& str);
b1462dfa 650 wxString GetLabel();
2abc0a0f 651 const wxString& GetText();
2abc0a0f 652 void SetCheckable(bool checkable);
b1462dfa
RD
653 bool IsCheckable();
654 bool IsSubMenu();
2abc0a0f 655 void SetSubMenu(wxMenu *menu);
b1462dfa
RD
656 wxMenu *GetSubMenu();
657 void Enable(bool enable = TRUE);
658 bool IsEnabled();
659 void Check(bool check = TRUE);
660 bool IsChecked();
661 void Toggle();
662 void SetHelp(const wxString& str);
663 const wxString& GetHelp();
664 wxAcceleratorEntry *GetAccel();
665 void SetAccel(wxAcceleratorEntry *accel);
666
1b62f00d
RD
667 static wxString GetLabelFromText(const wxString& text);
668
f3d9dc1d 669 // wxOwnerDrawn methods
4662be59 670#ifdef __WXMSW__
f3d9dc1d 671 void SetFont(const wxFont& font);
c5943253 672 wxFont GetFont();
f3d9dc1d 673 void SetTextColour(const wxColour& colText);
25832b3f 674 wxColour GetTextColour();
f3d9dc1d 675 void SetBackgroundColour(const wxColour& colBack);
25832b3f 676 wxColour GetBackgroundColour();
f3d9dc1d
RD
677 void SetBitmaps(const wxBitmap& bmpChecked,
678 const wxBitmap& bmpUnchecked = wxNullBitmap);
679 void SetBitmap(const wxBitmap& bmpChecked);
c5943253 680 wxBitmap GetBitmap(bool bChecked = TRUE);
f3d9dc1d
RD
681 void SetMarginWidth(int nWidth);
682 int GetMarginWidth();
683 static int GetDefaultMarginWidth();
684 //void SetName(const wxString& strName);
685 //const wxString& GetName();
686 //void SetCheckable(bool checkable);
687 //bool IsCheckable();
688 bool IsOwnerDrawn();
689 void ResetOwnerDrawn();
4662be59 690#endif
7bf85405
RD
691};
692
693//---------------------------------------------------------------------------
7bf85405
RD
694
695
694759cf 696