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