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