1 /////////////////////////////////////////////////////////////////////////////
 
   3 // Purpose:     SWIG definitions of various window classes
 
   9 // Copyright:   (c) 1998 by Total Control Software
 
  10 // Licence:     wxWindows license
 
  11 /////////////////////////////////////////////////////////////////////////////
 
  18 #include <wx/menuitem.h>
 
  19 #include <wx/tooltip.h>
 
  22 //----------------------------------------------------------------------
 
  25 %include my_typemaps.i
 
  27 // Import some definitions of other classes, etc.
 
  33 %pragma(python) code = "import wx"
 
  36 //----------------------------------------------------------------------
 
  39     // Put some wx default wxChar* values into wxStrings.
 
  40     DECLARE_DEF_STRING(PanelNameStr);
 
  41     static const wxString wxPyEmptyString(wxT(""));
 
  44 //---------------------------------------------------------------------------
 
  46 class wxEvtHandler : public wxObject {
 
  50     bool ProcessEvent(wxEvent& event);
 
  51     void AddPendingEvent(wxEvent& event);
 
  52     //bool SearchEventTable(wxEventTable& table, wxEvent& event);
 
  54     bool GetEvtHandlerEnabled();
 
  55     void SetEvtHandlerEnabled(bool enabled);
 
  57     wxEvtHandler* GetNextHandler();
 
  58     wxEvtHandler* GetPreviousHandler();
 
  59     void SetNextHandler(wxEvtHandler* handler);
 
  60     void SetPreviousHandler(wxEvtHandler* handler);
 
  64         void Connect( int id, int lastId, int eventType, PyObject* func) {
 
  65             if (PyCallable_Check(func)) {
 
  66                 self->Connect(id, lastId, eventType,
 
  67                           (wxObjectEventFunction) &wxPyCallback::EventThunker,
 
  68                           new wxPyCallback(func));
 
  70             else if (func == Py_None) {
 
  71                 self->Disconnect(id, lastId, eventType,
 
  72                                  (wxObjectEventFunction)
 
  73                                  &wxPyCallback::EventThunker);
 
  76                 PyErr_SetString(PyExc_TypeError, "Expected callable object or None.");
 
  80         bool Disconnect(int id, int lastId = -1,
 
  81                         wxEventType eventType = wxEVT_NULL) {
 
  82             return self->Disconnect(id, lastId, eventType,
 
  83                                    (wxObjectEventFunction)
 
  84                                     &wxPyCallback::EventThunker);
 
  89         void _setOORInfo(PyObject* _self) {
 
  90             self->SetClientObject(new wxPyOORClientData(_self));
 
  96 //----------------------------------------------------------------------
 
  98 class wxValidator : public wxEvtHandler {
 
 103     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 105     wxValidator* Clone();
 
 106     wxWindow* GetWindow();
 
 107     void SetWindow(wxWindow* window);
 
 109     static bool IsSilent();
 
 110     static void SetBellOnError(int doIt = TRUE);
 
 115 //----------------------------------------------------------------------
 
 117 class wxPyValidator : public wxValidator {
 
 118     DECLARE_DYNAMIC_CLASS(wxPyValidator);
 
 126     wxObject* Clone() const {
 
 127         wxPyValidator* ptr = NULL;
 
 128         wxPyValidator* self = (wxPyValidator*)this;
 
 130         wxPyBeginBlockThreads();
 
 131         if (self->m_myInst.findCallback("Clone")) {
 
 133             ro = self->m_myInst.callCallbackObj(Py_BuildValue("()"));
 
 135                 SWIG_GetPtrObj(ro, (void **)&ptr, "_wxPyValidator_p");
 
 139         wxPyEndBlockThreads();
 
 141         // This is very dangerous!!! But is the only way I could find
 
 142         // to squash a memory leak.  Currently it is okay, but if the
 
 143         // validator architecture in wxWindows ever changes, problems
 
 150     DEC_PYCALLBACK_BOOL_WXWIN(Validate);
 
 151     DEC_PYCALLBACK_BOOL_(TransferToWindow);
 
 152     DEC_PYCALLBACK_BOOL_(TransferFromWindow);
 
 157 IMP_PYCALLBACK_BOOL_WXWIN(wxPyValidator, wxValidator, Validate);
 
 158 IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferToWindow);
 
 159 IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferFromWindow);
 
 161 IMPLEMENT_DYNAMIC_CLASS(wxPyValidator, wxValidator);
 
 165 class wxPyValidator : public wxValidator {
 
 169     void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=TRUE);
 
 170     %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyValidator, 1)"
 
 172     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 175 //----------------------------------------------------------------------
 
 177 %apply int * INOUT { int* x, int* y };
 
 179 class wxWindow : public wxEvtHandler {
 
 181     wxWindow(wxWindow* parent, const wxWindowID id,
 
 182              const wxPoint& pos = wxDefaultPosition,
 
 183              const wxSize& size = wxDefaultSize,
 
 185              const wxString& name = wxPyPanelNameStr);
 
 186     %name(wxPreWindow)wxWindow();
 
 188     bool Create(wxWindow* parent, const wxWindowID id,
 
 189                 const wxPoint& pos = wxDefaultPosition,
 
 190                 const wxSize& size = wxDefaultSize,
 
 192                 const wxString& name = wxPyPanelNameStr);
 
 194     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 195     %pragma(python) addtomethod = "wxPreWindow:val._setOORInfo(val)"
 
 198     void Center(int direction = wxBOTH);
 
 199     void Centre(int direction = wxBOTH);
 
 200     void CentreOnParent(int direction = wxBOTH );
 
 201     void CenterOnParent(int direction = wxBOTH );
 
 202     void CentreOnScreen(int direction = wxBOTH );
 
 203     void CenterOnScreen(int direction = wxBOTH );
 
 207     // (uses apply'ed INOUT typemap, see above)
 
 208     %name(ClientToScreenXY)void ClientToScreen(int* x, int* y);
 
 209     wxPoint ClientToScreen(const wxPoint& pt);
 
 211     bool Close(int force = FALSE);
 
 213     void DestroyChildren();
 
 214     bool IsBeingDeleted();
 
 216     void DragAcceptFiles(bool accept);
 
 218     void Enable(bool enable);
 
 220     // Find child window by ID or name
 
 221     %name(FindWindowById) wxWindow* FindWindow(long id);
 
 222     %name(FindWindowByName) wxWindow* FindWindow(const wxString& name);
 
 225     wxColour GetBackgroundColour();
 
 226     wxBorder GetBorder() const;
 
 228     //wxList& GetChildren();
 
 230         PyObject* GetChildren() {
 
 231             wxWindowList& list = self->GetChildren();
 
 232             return wxPy_ConvertList(&list, "wxWindow");
 
 238     %name(GetClientSizeTuple) void GetClientSize(int *OUTPUT, int *OUTPUT);
 
 239     wxSize GetClientSize();
 
 241     // get the origin of the client area of the window relative to the
 
 242     // window top left corner (the client area may be shifted because of
 
 243     // the borders, scrollbars, other decorations...)
 
 244     wxPoint GetClientAreaOrigin() const;
 
 246     // get the client rectangle in window (i.e. client) coordinates
 
 247     wxRect GetClientRect() const;
 
 249     wxLayoutConstraints * GetConstraints();
 
 250     wxEvtHandler* GetEventHandler();
 
 253     wxColour GetForegroundColour();
 
 254     wxWindow * GetGrandParent();
 
 257             return wxPyGetWinHandle(self); //(long)self->GetHandle();
 
 262     void SetLabel(const wxString& label);
 
 264     wxWindow * GetParent();
 
 265     %name(GetPositionTuple) void GetPosition(int *OUTPUT, int *OUTPUT);
 
 266     wxPoint GetPosition();
 
 268     int GetScrollThumb(int orientation);
 
 269     int GetScrollPos(int orientation);
 
 270     int GetScrollRange(int orientation);
 
 271     %name(GetSizeTuple) void GetSize(int *OUTPUT, int *OUTPUT);
 
 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)
 
 278     wxRegion GetUpdateRegion();
 
 279     long GetWindowStyleFlag();
 
 280     void SetWindowStyleFlag(long style);
 
 281     void SetWindowStyle(long style);
 
 282     bool HasScrollbar(int orient) const;
 
 284     wxHitTest HitTest(const wxPoint& pt);
 
 287     bool IsExposed( int x, int y, int w=0, int h=0 );
 
 288     %name(IsExposedPoint) bool IsExposed( const wxPoint& pt );
 
 289     %name(IsExposedRect)  bool IsExposed( const wxRect& rect );
 
 294     bool LoadFromResource(wxWindow* parent, const wxString& resourceName, const wxResourceTable* resourceTable = NULL);
 
 296     void MakeModal(bool flag=TRUE);
 
 297     %name(MoveXY)void Move(int x, int y, int flags = wxSIZE_USE_EXISTING);
 
 298     void Move(const wxPoint& point, int flags = wxSIZE_USE_EXISTING);
 
 300     wxEvtHandler* PopEventHandler(bool deleteHandler = FALSE);
 
 301     void PushEventHandler(wxEvtHandler* handler);
 
 303         // find the given handler in the event handler chain and remove (but
 
 304         // not delete) it from the event handler chain, return TRUE if it was
 
 305         // found and FALSE otherwise (this also results in an assert failure so
 
 306         // this function should only be called when the handler is supposed to
 
 308     bool RemoveEventHandler(wxEvtHandler *handler);
 
 310     %name(PopupMenuXY)bool PopupMenu(wxMenu *menu, int x, int y);
 
 311     bool PopupMenu(wxMenu *menu, const wxPoint& pos);
 
 314     void Refresh(bool eraseBackground = TRUE, const wxRect* rect = NULL);
 
 315     void RefreshRect(const wxRect& rect);
 
 317     void AddChild(wxWindow* child);
 
 318     void RemoveChild(wxWindow* child);
 
 319     bool Reparent( wxWindow* newParent );
 
 321     // (uses apply'ed INOUT typemap, see above)
 
 322     %name(ScreenToClientXY)void ScreenToClient(int *x, int *y);
 
 323     wxPoint ScreenToClient(const wxPoint& pt);
 
 325     void ScrollWindow(int dx, int dy, const wxRect* rect = NULL);
 
 326     void SetAutoLayout(bool autoLayout);
 
 327     bool GetAutoLayout();
 
 328     void SetBackgroundColour(const wxColour& colour);
 
 329     void SetConstraints(wxLayoutConstraints *constraints);
 
 330     void UnsetConstraints(wxLayoutConstraints *constraints);
 
 332     void SetFocusFromKbd();
 
 334     void SetFont(const wxFont& font);
 
 335     void SetForegroundColour(const wxColour& colour);
 
 337     void SetName(const wxString& name);
 
 338     void SetScrollbar(int orientation, int position, int thumbSize, int range, int refresh = TRUE);
 
 339     void SetScrollPos(int orientation, int pos, bool refresh = TRUE);
 
 341     %name(SetDimensions) void SetSize(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO);
 
 343         void SetSize(const wxSize& size) {
 
 347         void SetPosition(const wxPoint& pos, int flags = wxSIZE_USE_EXISTING) {
 
 348             self->Move(pos, flags);
 
 351         void SetRect(const wxRect& rect, int sizeFlags=wxSIZE_AUTO) {
 
 352             self->SetSize(rect, sizeFlags);
 
 356     void SetSizeHints(int minW,    int minH,
 
 357                       int maxW=-1, int maxH=-1,
 
 358                       int incW=-1, int incH=-1);
 
 359     void SetVirtualSizeHints( int minW, int minH,
 
 360                               int maxW = -1, int maxH = -1 );
 
 362     void SetVirtualSize( const wxSize &size );
 
 363     %name(SetVirtualSizeWH)void SetVirtualSize( int x, int y );
 
 365     wxSize GetVirtualSize() const;
 
 366     %name(GetVirtualSizeTuple)void GetVirtualSize( int *OUTPUT, int *OUTPUT ) const;
 
 368     %name(SetClientSizeWH)void SetClientSize(int width, int height);
 
 369     void SetClientSize(const wxSize& size);
 
 370     //void SetPalette(wxPalette* palette);
 
 371     bool SetCursor(const wxCursor& cursor);
 
 372     wxCursor& GetCursor();
 
 373     void SetEventHandler(wxEvtHandler* handler);
 
 374     void SetExtraStyle(long exStyle);
 
 375     void SetTitle(const wxString& title);
 
 376     bool Show(bool show=TRUE);
 
 377     bool TransferDataFromWindow();
 
 378     bool TransferDataToWindow();
 
 379     void UpdateWindowUI();
 
 382     %name(ConvertDialogPointToPixels) wxPoint ConvertDialogToPixels(const wxPoint& pt);
 
 383     %name(ConvertDialogSizeToPixels)  wxSize  ConvertDialogToPixels(const wxSize& sz);
 
 385     %name(DLG_PNT) wxPoint ConvertDialogToPixels(const wxPoint& pt);
 
 386     %name(DLG_SZE) wxSize  ConvertDialogToPixels(const wxSize& sz);
 
 388     %name(ConvertPixelPointToDialog) wxPoint ConvertPixelsToDialog(const wxPoint& pt);
 
 389     %name(ConvertPixelSizeToDialog)  wxSize  ConvertPixelsToDialog(const wxSize& sz);
 
 391     %name(SetToolTipString)void SetToolTip(const wxString &tip);
 
 392     void SetToolTip(wxToolTip *tooltip);
 
 393     wxToolTip* GetToolTip();
 
 395     void SetSizer(wxSizer* sizer, bool deleteOld=TRUE);
 
 396     void SetSizerAndFit(wxSizer *sizer, bool deleteOld=TRUE);
 
 399         // Track if this window is a member of a sizer
 
 400     void SetContainingSizer(wxSizer* sizer);
 
 401     wxSizer *GetContainingSizer() const;
 
 403     wxValidator* GetValidator();
 
 404     void SetValidator(const wxValidator& validator);
 
 406     void SetDropTarget(wxDropTarget* target);
 
 407     wxDropTarget* GetDropTarget();
 
 408     %pragma(python) addtomethod = "SetDropTarget:_args[0].thisown = 0"
 
 410     wxSize GetBestSize();
 
 413     void SetCaret(wxCaret *caret);
 
 415     %pragma(python) addtoclass = "# replaces broken shadow method
 
 416     def GetCaret(self, *_args, **_kwargs):
 
 417         from misc2 import wxCaretPtr
 
 418         val = apply(windowsc.wxWindow_GetCaret,(self,) + _args, _kwargs)
 
 419         if val: val = wxCaretPtr(val)
 
 427     wxString GetHelpText();
 
 428     void SetHelpText(const wxString& helpText);
 
 429     void SetHelpTextForId(const wxString& text);
 
 431     bool ScrollLines(int lines);
 
 432     bool ScrollPages(int pages);
 
 438     static wxWindow* FindFocus();
 
 439     static int NewControlId();
 
 440     static int NextControlId(int id);
 
 441     static int PrevControlId(int id);
 
 443     void SetAcceleratorTable(const wxAcceleratorTable& accel);
 
 444     wxAcceleratorTable *GetAcceleratorTable();
 
 447     // A way to do the native draw first...  Too bad it isn't in wxGTK too.
 
 448     void OnPaint(wxPaintEvent& event);
 
 451     wxWindow* GetDefaultItem();
 
 452     wxWindow* SetDefaultItem(wxWindow *btn);
 
 453     void SetTmpDefaultItem(wxWindow *win);
 
 455     // move the mouse to the specified position
 
 456     void WarpPointer(int x, int y);
 
 458     // start or end mouse capture, these functions maintain the stack of
 
 459     // windows having captured the mouse and after calling ReleaseMouse()
 
 460     // the mouse is not released but returns to the window which had had
 
 461     // captured it previously (if any)
 
 465     // get the window which currently captures the mouse or NULL
 
 466     static wxWindow *GetCapture();
 
 468     // does this window have the capture?
 
 469     bool HasCapture() const;
 
 475 %pragma(python) code = "
 
 476 def wxDLG_PNT(win, point_or_x, y=None):
 
 478         return win.ConvertDialogPointToPixels(point_or_x)
 
 480         return win.ConvertDialogPointToPixels(wxPoint(point_or_x, y))
 
 482 def wxDLG_SZE(win, size_width, height=None):
 
 484         return win.ConvertDialogSizeToPixels(size_width)
 
 486         return win.ConvertDialogSizeToPixels(wxSize(size_width, height))
 
 492 wxWindow* wxWindow_FromHWND(unsigned long hWnd) {
 
 493     wxWindow* win = new wxWindow;
 
 495     win->SubclassWin(hWnd);
 
 502 // Unfortunatly the names of these new static methods clash with the
 
 503 // names wxPython has been using forever for the overloaded
 
 504 // wxWindow::FindWindow, so instead of swigging them as statics create
 
 505 // standalone functions for them.
 
 507 wxWindow* wxFindWindowById( long id, const wxWindow *parent = NULL ) {
 
 508     return wxWindow::FindWindowById(id, parent);
 
 511 wxWindow* wxFindWindowByName( const wxString& name,
 
 512                               const wxWindow *parent = NULL ) {
 
 513      return wxWindow::FindWindowByName(name, parent);
 
 516 wxWindow* wxFindWindowByLabel( const wxString& label,
 
 517                                const wxWindow *parent = NULL ) {
 
 518     return wxWindow::FindWindowByLabel(label, parent);
 
 523 //---------------------------------------------------------------------------
 
 525 class wxPanel : public wxWindow {
 
 527     wxPanel(wxWindow* parent,
 
 529             const wxPoint& pos = wxDefaultPosition,
 
 530             const wxSize& size = wxDefaultSize,
 
 531             long style = wxTAB_TRAVERSAL,
 
 532             const wxString& name = wxPyPanelNameStr);
 
 533     %name(wxPrePanel)wxPanel();
 
 535     bool Create(wxWindow* parent,
 
 537                 const wxPoint& pos = wxDefaultPosition,
 
 538                 const wxSize& size = wxDefaultSize,
 
 539                 long style = wxTAB_TRAVERSAL,
 
 540                 const wxString& name = wxPyPanelNameStr);
 
 542     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 543     %pragma(python) addtomethod = "wxPrePanel:val._setOORInfo(val)"
 
 549 //---------------------------------------------------------------------------
 
 552 // TODO: Add wrappers for the wxScrollHelper class, make wxScrolledWindow
 
 553 //       derive from it and wxPanel.
 
 556 class wxScrolledWindow : public wxPanel {
 
 558     wxScrolledWindow(wxWindow* parent,
 
 559                      const wxWindowID id = -1,
 
 560                      const wxPoint& pos = wxDefaultPosition,
 
 561                      const wxSize& size = wxDefaultSize,
 
 562                      long style = wxHSCROLL | wxVSCROLL,
 
 563                      const wxString& name = wxPyPanelNameStr);
 
 564     %name(wxPreScrolledWindow)wxScrolledWindow();
 
 566     bool Create(wxWindow* parent,
 
 567                 const wxWindowID id = -1,
 
 568                 const wxPoint& pos = wxDefaultPosition,
 
 569                 const wxSize& size = wxDefaultSize,
 
 570                 long style = wxHSCROLL | wxVSCROLL,
 
 571                 const wxString& name = wxPyPanelNameStr);
 
 573     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 574     %pragma(python) addtomethod = "wxPreScrolledWindow:val._setOORInfo(val)"
 
 576     void EnableScrolling(bool xScrolling, bool yScrolling);
 
 577     int GetScrollPageSize(int orient);
 
 578     void GetScrollPixelsPerUnit(int* OUTPUT, int* OUTPUT);
 
 579     wxWindow* GetTargetWindow();
 
 581     void PrepareDC(wxDC& dc);
 
 582     void Scroll(int x, int y);
 
 583     void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
 
 584                        int noUnitsX, int noUnitsY,
 
 585                        int xPos = 0, int yPos = 0, int noRefresh=FALSE);
 
 586     void SetScrollPageSize(int orient, int pageSize);
 
 587     void SetTargetWindow(wxWindow* window);
 
 588     void GetViewStart(int* OUTPUT, int* OUTPUT);
 
 589     %pragma(python) addtoclass = "ViewStart = GetViewStart"
 
 591     %name(CalcScrolledPosition1)wxPoint CalcScrolledPosition(const wxPoint& pt);
 
 592     %name(CalcScrolledPosition2)void CalcScrolledPosition( int x, int y, int *OUTPUT, int *OUTPUT);
 
 594     %name(CalcUnscrolledPosition1)wxPoint CalcUnscrolledPosition(const wxPoint& pt);
 
 595     %name(CalcUnscrolledPosition2)void CalcUnscrolledPosition( int x, int y, int *OUTPUT, int *OUTPUT);
 
 597     %pragma(python) addtoclass = "
 
 598     def CalcScrolledPosition(self, *args):
 
 600             return apply(self.CalcScrolledPosition1, args)
 
 602             return apply(self.CalcScrolledPosition2, args)
 
 604             raise TypeError, 'Invalid parameters: only (x,y) or (point) allowed'
 
 606     def CalcUnscrolledPosition(self, *args):
 
 608             return apply(self.CalcUnscrolledPosition1, args)
 
 610             return apply(self.CalcUnscrolledPosition2, args)
 
 612             raise TypeError, 'Invalid parameters: only (x,y) or (point) allowed'
 
 615     void SetScale(double xs, double ys);
 
 619     void AdjustScrollbars();
 
 623     // Set the x, y scrolling increments.
 
 624     void SetScrollRate( int xstep, int ystep );
 
 628 //----------------------------------------------------------------------
 
 631 class wxMenu : public wxEvtHandler {
 
 633     wxMenu(const wxString& title = wxPyEmptyString, long style = 0);
 
 635     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 637     void Append(int id, const wxString& item,
 
 638                 const wxString& helpString = wxPyEmptyString,
 
 639                 wxItemKind kind = wxITEM_NORMAL);
 
 640     %name(AppendMenu)void Append(int id, const wxString& item, wxMenu *subMenu,
 
 641                                  const wxString& helpString = wxPyEmptyString);
 
 642     %name(AppendItem)void Append(const wxMenuItem* item);
 
 643     void AppendCheckItem(int id,
 
 644                          const wxString& text,
 
 645                          const wxString& help = wxPyEmptyString);
 
 646     void AppendRadioItem(int id,
 
 647                          const wxString& text,
 
 648                          const wxString& help = wxPyEmptyString);
 
 649     void AppendSeparator();
 
 652     void Insert(size_t pos,
 
 654                 const wxString& text,
 
 655                 const wxString& help = wxPyEmptyString,
 
 656                 wxItemKind kind = wxITEM_NORMAL);
 
 657     void InsertSeparator(size_t pos);
 
 658     void InsertCheckItem(size_t pos,
 
 660                          const wxString& text,
 
 661                          const wxString& help = wxPyEmptyString);
 
 662     void InsertRadioItem(size_t pos,
 
 664                          const wxString& text,
 
 665                          const wxString& help = wxPyEmptyString);
 
 666     %name(InsertMenu)void Insert(size_t pos,
 
 668                                  const wxString& text,
 
 670                                  const wxString& help = wxPyEmptyString);
 
 671     %name(InsertItem)bool Insert(size_t pos, wxMenuItem *item);
 
 675                  const wxString& text,
 
 676                  const wxString& help = wxPyEmptyString,
 
 677                  wxItemKind kind = wxITEM_NORMAL);
 
 678     void PrependSeparator();
 
 679     void PrependCheckItem(int id,
 
 680                           const wxString& text,
 
 681                           const wxString& help = wxPyEmptyString);
 
 682     void PrependRadioItem(int id,
 
 683                           const wxString& text,
 
 684                           const wxString& help = wxPyEmptyString);
 
 685     %name(PrependMenu)void Prepend(int id,
 
 686                                    const wxString& text,
 
 688                                    const wxString& help = wxPyEmptyString);
 
 689     %name(PrependItem)void Prepend(wxMenuItem *item);
 
 693     void Check(int id, bool flag);
 
 694     bool IsChecked(int id);
 
 695     void Enable(int id, bool enable);
 
 696     bool IsEnabled(int id);
 
 698     int FindItem(const wxString& itemString);
 
 699     %name(FindItemById)wxMenuItem* FindItem(int id/*, wxMenu **menu = NULL*/);
 
 702     void SetTitle(const wxString& title);
 
 704     wxString GetLabel(int id);
 
 705     void SetLabel(int id, const wxString& label);
 
 707     wxString GetHelpString(int id);
 
 708     void SetHelpString(int id, const wxString& helpString);
 
 709     void UpdateUI(wxEvtHandler* source = NULL);
 
 712     %name(DeleteItem)bool Delete(wxMenuItem *item);
 
 713     wxMenuItem *Remove(int id);
 
 714     %name(RemoveItem) wxMenuItem *Remove(wxMenuItem *item);
 
 720         void Destroy() { delete self; }
 
 722     %name(DestroyId)bool Destroy(int id);
 
 723     %name(DestroyItem)bool Destroy(wxMenuItem *item);
 
 725     size_t GetMenuItemCount();
 
 726     //wxMenuItemList& GetMenuItems();
 
 728         PyObject* GetMenuItems() {
 
 729             wxMenuItemList& list = self->GetMenuItems();
 
 730             return wxPy_ConvertList(&list, "wxMenuItem");
 
 734     void SetEventHandler(wxEvtHandler *handler);
 
 735     wxEvtHandler *GetEventHandler();
 
 737     void SetInvokingWindow(wxWindow *win);
 
 738     wxWindow *GetInvokingWindow();
 
 744     void SetParent(wxMenu *parent);
 
 749 //----------------------------------------------------------------------
 
 751 class wxMenuBar : public wxWindow {
 
 753     wxMenuBar(long style = 0);
 
 755     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 757     bool Append(wxMenu *menu, const wxString& title);
 
 758     bool Insert(size_t pos, wxMenu *menu, const wxString& title);
 
 759     size_t GetMenuCount();
 
 760     wxMenu *GetMenu(size_t pos);
 
 761     wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title);
 
 762     wxMenu *Remove(size_t pos);
 
 763     void EnableTop(size_t pos, bool enable);
 
 764     void SetLabelTop(size_t pos, const wxString& label);
 
 765     wxString GetLabelTop(size_t pos);
 
 766     int FindMenu(const wxString& title);
 
 767     int FindMenuItem(const wxString& menuString, const wxString& itemString);
 
 768     %name(FindItemById)wxMenuItem* FindItem(int id/*, wxMenu **menu = NULL*/);
 
 769     void Enable(int id, bool enable);
 
 770     void Check(int id, bool check);
 
 771     bool IsChecked(int id);
 
 772     bool IsEnabled(int id);
 
 774     void SetLabel(int id, const wxString &label);
 
 775     wxString GetLabel(int id);
 
 777     void SetHelpString(int id, const wxString& helpString);
 
 778     wxString GetHelpString(int id);
 
 783 //----------------------------------------------------------------------
 
 785 class wxMenuItem : public wxObject {
 
 787     wxMenuItem(wxMenu* parentMenu=NULL, int id=wxID_SEPARATOR,
 
 788                const wxString& text = wxPyEmptyString,
 
 789                const wxString& help = wxPyEmptyString,
 
 790                wxItemKind kind = wxITEM_NORMAL,
 
 791                wxMenu* subMenu = NULL);
 
 798     void SetText(const wxString& str);
 
 800     const wxString& GetText();
 
 801     wxItemKind GetKind();
 
 802     void SetCheckable(bool checkable);
 
 805     void SetSubMenu(wxMenu *menu);
 
 806     wxMenu *GetSubMenu();
 
 807     void Enable(bool enable = TRUE);
 
 809     void Check(bool check = TRUE);
 
 812     void SetHelp(const wxString& str);
 
 813     const wxString& GetHelp();
 
 814     wxAcceleratorEntry *GetAccel();
 
 815     void SetAccel(wxAcceleratorEntry *accel);
 
 817     static wxString GetLabelFromText(const wxString& text);
 
 818 //    static wxAcceleratorEntry *GetAccelFromString(const wxString& label);
 
 820     // wxOwnerDrawn methods
 
 822     void SetFont(const wxFont& font);
 
 824     void SetTextColour(const wxColour& colText);
 
 825     wxColour GetTextColour();
 
 826     void SetBackgroundColour(const wxColour& colBack);
 
 827     wxColour GetBackgroundColour();
 
 828     void SetBitmaps(const wxBitmap& bmpChecked,
 
 829                     const wxBitmap& bmpUnchecked = wxNullBitmap);
 
 830     //void SetBitmap(const wxBitmap& bmpChecked);
 
 831     //wxBitmap GetBitmap(bool bChecked = TRUE);
 
 832     void SetMarginWidth(int nWidth);
 
 833     int GetMarginWidth();
 
 834     static int GetDefaultMarginWidth();
 
 836     void ResetOwnerDrawn();
 
 839     void SetBitmap(const wxBitmap& bitmap);
 
 840     const wxBitmap& GetBitmap();
 
 844 //---------------------------------------------------------------------------