X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/86a12675f1ecd20a9d1da1710619bb69462b9065..6946b604e8a01092aa68d1846a24c6350ea6df79:/wxPython/src/windows2.i?ds=sidebyside diff --git a/wxPython/src/windows2.i b/wxPython/src/windows2.i index 9010f87e47..3147ab83f4 100644 --- a/wxPython/src/windows2.i +++ b/wxPython/src/windows2.i @@ -14,14 +14,11 @@ %{ #include "helpers.h" -#ifdef OLD_GRID -#include -#endif #include #include #include #ifdef __WXMSW__ -#include +#include #endif %} @@ -56,16 +53,31 @@ //--------------------------------------------------------------------------- enum { - /* notebook control event types */ + // notebook control event types wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, + + // styles + wxNB_FIXEDWIDTH, + wxNB_TOP, + wxNB_LEFT, + wxNB_RIGHT, + wxNB_BOTTOM, + wxNB_MULTILINE, + + // hittest flags + wxNB_HITTEST_NOWHERE = 1, // not on tab + wxNB_HITTEST_ONICON = 2, // on icon + wxNB_HITTEST_ONLABEL = 4, // on label + wxNB_HITTEST_ONITEM = wxNB_HITTEST_ONICON | wxNB_HITTEST_ONLABEL, + }; class wxNotebookEvent : public wxNotifyEvent { public: wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, - int nSel = -1, int nOldSel = -1); + int sel = -1, int oldSel = -1); int GetSelection(); int GetOldSelection(); @@ -95,45 +107,87 @@ public: %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" %pragma(python) addtomethod = "wxPreNotebook:val._setOORInfo(val)" - int GetPageCount(); - int SetSelection(int nPage); - void AdvanceSelection(bool bForward = TRUE); - int GetSelection(); - bool SetPageText(int nPage, const wxString& strText); - wxString GetPageText(int nPage) const; - void SetImageList(wxImageList* imageList); - void AssignImageList(wxImageList *imageList) ; + // get number of pages in the dialog + int GetPageCount() const; + + // get the panel which represents the given page + wxWindow *GetPage(int page); + + // get the currently selected page + int GetSelection() const; + + // set/get the title of a page + bool SetPageText(int page, const wxString& text); + wxString GetPageText(int page) const; + + // image list stuff: each page may have an image associated with it (all + // images belong to the same image list) + void SetImageList(wxImageList* imageList); + + // as SetImageList() but the notebook will take ownership of the image list + void AssignImageList(wxImageList* imageList); %pragma(python) addtomethod = "AssignImageList:_args[0].thisown = 0" - wxImageList* GetImageList(); - int GetPageImage(int nPage); - bool SetPageImage(int nPage, int nImage); - int GetRowCount(); - - void SetPageSize(const wxSize& size); - void SetPadding(const wxSize& padding); - bool DeletePage(int nPage); - bool RemovePage(int nPage); - bool DeleteAllPages(); - bool AddPage(/*wxNotebookPage*/ wxWindow *pPage, - const wxString& strText, - int bSelect = FALSE, - int imageId = -1); - bool InsertPage(int nPage, - /*wxNotebookPage*/ wxWindow *pPage, - const wxString& strText, - bool bSelect = FALSE, - int imageId = -1); - /*wxNotebookPage*/ wxWindow *GetPage(int nPage); - - %addmethods { - void ResizeChildren() { - wxSizeEvent evt(self->GetClientSize()); - self->GetEventHandler()->ProcessEvent(evt); - } - } + // get pointer (may be NULL) to the associated image list + wxImageList* GetImageList() const; + + // sets/returns item's image index in the current image list + int GetPageImage(int page) const; + bool SetPageImage(int page, int nImage); + + // get the number of rows for a control with wxNB_MULTILINE style (not all + // versions support it - they will always return 1 then) + int GetRowCount() const; + + // set the size (the same for all pages) + void SetPageSize(const wxSize& size); + + // set the padding between tabs (in pixels) + void SetPadding(const wxSize& padding); + // set the size of the tabs for wxNB_FIXEDWIDTH controls + void SetTabSize(const wxSize& sz); + + // calculate the size of the notebook from the size of its page + wxSize CalcSizeFromPage(const wxSize& sizePage) const; + + + // remove one page from the notebook and delete it + bool DeletePage(int page); + + // remove one page from the notebook, without deleting it + bool RemovePage(int page); + + // remove all pages and delete them + bool DeleteAllPages(); + + // adds a new page to the notebook (it will be deleted by the notebook, + // don't delete it yourself) and make it the current one if select + bool AddPage(wxWindow *page, + const wxString& text, + bool telect = FALSE, + int imageId = -1); + + // the same as AddPage(), but adds the page at the specified position + bool InsertPage(int index, + wxWindow *page, + const wxString& text, + bool select = FALSE, + int imageId = -1); + + // set the currently selected page, return the index of the previously + // selected one (or -1 on error) + // + // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events + int SetSelection(int page); + + // hit test, returns which tab is hit and, optionally, where (icon, label) + // (not implemented on all platforms) + int HitTest(const wxPoint& pt, long* OUTPUT); + + // cycle thru the tabs + void AdvanceSelection(bool forward = TRUE); }; @@ -146,16 +200,25 @@ enum { wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, wxEVT_COMMAND_SPLITTER_UNSPLIT, wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, -}; - -enum -{ wxSPLIT_HORIZONTAL, wxSPLIT_VERTICAL, wxSPLIT_DRAG_NONE, wxSPLIT_DRAG_DRAGGING, - wxSPLIT_DRAG_LEFT_DOWN + wxSPLIT_DRAG_LEFT_DOWN, + + wxSP_VERTICAL, + wxSP_HORIZONTAL, + wxSP_ARROW_KEYS, + wxSP_WRAP, + wxSP_NOBORDER, + wxSP_3D, + wxSP_3DSASH, + wxSP_3DBORDER, + wxSP_FULLSASH, + wxSP_BORDER, + wxSP_LIVE_UPDATE, + wxSP_PERMIT_UNSPLIT }; @@ -263,6 +326,7 @@ public: //--------------------------------------------------------------------------- +// TODO: This should be usable on wxGTK now too... #ifdef __WXMSW__ enum { @@ -276,6 +340,13 @@ enum { }; +class wxTaskBarIconEvent : public wxEvent +{ +public: + wxTaskBarIconEvent(wxEventType evtType, wxTaskBarIcon *tbIcon); +}; + + class wxTaskBarIcon : public wxEvtHandler { public: wxTaskBarIcon(); @@ -298,6 +369,33 @@ public: bool IsIconInstalled(); bool IsOK(); }; + + + +%pragma(python) code = " +def EVT_TASKBAR_MOVE(win, func): + win.Connect(-1, -1, wxEVT_TASKBAR_MOVE, func) + +def EVT_TASKBAR_LEFT_DOWN(win, func): + win.Connect(-1, -1, wxEVT_TASKBAR_LEFT_DOWN, func) + +def EVT_TASKBAR_LEFT_UP(win, func): + win.Connect(-1, -1, wxEVT_TASKBAR_LEFT_UP, func) + +def EVT_TASKBAR_RIGHT_DOWN(win, func): + win.Connect(-1, -1, wxEVT_TASKBAR_RIGHT_DOWN, func) + +def EVT_TASKBAR_RIGHT_UP(win, func): + win.Connect(-1, -1, wxEVT_TASKBAR_RIGHT_UP, func) + +def EVT_TASKBAR_LEFT_DCLICK(win, func): + win.Connect(-1, -1, wxEVT_TASKBAR_LEFT_DCLICK, func) + +def EVT_TASKBAR_RIGHT_DCLICK(win, func): + win.Connect(-1, -1, wxEVT_TASKBAR_RIGHT_DCLICK, func) +" + + #endif //--------------------------------------------------------------------------- @@ -305,8 +403,7 @@ public: // wxPyWindow derives from wxWindow and adds support for overriding many of // the virtual methods in Python derived classes. -// Which of these should be done??? -// AddChild +// Which (any?) of these should be done also??? // Destroy // DoCaptureMouse // DoClientToScreen @@ -323,7 +420,6 @@ public: // GetClientAreaOrigin // GetDefaultItem // IsTopLevel -// RemoveChild // SetBackgroundColour // SetDefaultItem // SetFocus @@ -369,6 +465,9 @@ public: DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard); DEC_PYCALLBACK_SIZE_const(GetMaxSize); + DEC_PYCALLBACK_VOID_WXWINBASE(AddChild); + DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild); + PYPRIVATE; }; @@ -395,6 +494,9 @@ IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocus); IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocusFromKeyboard); IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, GetMaxSize); +IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWindow, wxWindow, AddChild); +IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWindow, wxWindow, RemoveChild); + %} // And now the one for SWIG to see @@ -433,6 +535,9 @@ public: bool base_AcceptsFocus() const; bool base_AcceptsFocusFromKeyboard() const; wxSize base_GetMaxSize() const; + + void base_AddChild(wxWindow* child); + void base_RemoveChild(wxWindow* child); } //--------------------------------------------------------------------------- @@ -475,6 +580,9 @@ public: DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard); DEC_PYCALLBACK_SIZE_const(GetMaxSize); + DEC_PYCALLBACK_VOID_WXWINBASE(AddChild); + DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild); + PYPRIVATE; }; @@ -501,6 +609,9 @@ IMP_PYCALLBACK_BOOL_const(wxPyControl, wxControl, AcceptsFocus); IMP_PYCALLBACK_BOOL_const(wxPyControl, wxControl, AcceptsFocusFromKeyboard); IMP_PYCALLBACK_SIZE_const(wxPyControl, wxControl, GetMaxSize); +IMP_PYCALLBACK_VOID_WXWINBASE(wxPyControl, wxControl, AddChild); +IMP_PYCALLBACK_VOID_WXWINBASE(wxPyControl, wxControl, RemoveChild); + %} // And now the one for SWIG to see @@ -540,6 +651,9 @@ public: bool base_AcceptsFocus() const; bool base_AcceptsFocusFromKeyboard() const; wxSize base_GetMaxSize() const; + + void base_AddChild(wxWindow* child); + void base_RemoveChild(wxWindow* child); } //--------------------------------------------------------------------------- @@ -580,6 +694,9 @@ public: DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard); DEC_PYCALLBACK_SIZE_const(GetMaxSize); + DEC_PYCALLBACK_VOID_WXWINBASE(AddChild); + DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild); + PYPRIVATE; }; @@ -606,6 +723,9 @@ IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocus); IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocusFromKeyboard); IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, GetMaxSize); +IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, AddChild); +IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, RemoveChild); + %} // And now the one for SWIG to see @@ -644,7 +764,10 @@ public: bool base_AcceptsFocus() const; bool base_AcceptsFocusFromKeyboard() const; wxSize base_GetMaxSize() const; -} + + void base_AddChild(wxWindow* child); + void base_RemoveChild(wxWindow* child); +}; //---------------------------------------------------------------------------