]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/_notebook.i
Don't override methods that are in wxControlWithItems
[wxWidgets.git] / wxPython / src / _notebook.i
index 853ffe03b39148d9212c33e8d7a70eb27ae5afcd..3ab924fe1c3303986194963bf00c9191cfd84cf3 100644 (file)
 
 //---------------------------------------------------------------------------
 
-MAKE_CONST_WXSTRING(NOTEBOOK_NAME);
+MAKE_CONST_WXSTRING(NotebookNameStr);
 
 //---------------------------------------------------------------------------
 %newgroup
 
 // TODO:  Virtualize this class so other book controls can be derived in Python
 
-MustHaveApp(wxBookCtrl);
+MustHaveApp(wxBookCtrlBase);
 
 //  Common base class for wxList/Tree/Notebook
-class wxBookCtrl : public wxControl
+class wxBookCtrlBase : public wxControl
 {
 public:
     // This is an ABC, it can't be constructed...
 
-//     wxBookCtrl(wxWindow *parent,
+//     wxBookCtrlBase(wxWindow *parent,
 //                wxWindowID id,
 //                const wxPoint& pos = wxDefaultPosition,
 //                const wxSize& size = wxDefaultSize,
 //                long style = 0,
 //                const wxString& name = wxPyEmptyString);
-//     %name(PreBookCtrl)wxBookCtrl();
+//     %RenameCtor(PreBookCtrlBase, wxBookCtrlBase());
 //     bool Create(wxWindow *parent,
 //                 wxWindowID id,
 //                 const wxPoint& pos = wxDefaultPosition,
@@ -51,6 +51,9 @@ public:
     // get the panel which represents the given page
     virtual wxWindow *GetPage(size_t n);
 
+    // get the current page or NULL if none
+    wxWindow* GetCurrentPage() const;
+
     // get the currently selected page or wxNOT_FOUND if none
     virtual int GetSelection() const/* = 0*/;
 
@@ -98,14 +101,14 @@ public:
     // adds a new page to the control
     virtual bool AddPage(wxWindow *page,
                          const wxString& text,
-                         bool select = False,
+                         bool select = false,
                          int imageId = -1);
 
     // the same as AddPage(), but adds the page at the specified position
     virtual bool InsertPage(size_t n,
                             wxWindow *page,
                             const wxString& text,
-                            bool select = False,
+                            bool select = false,
                             int imageId = -1)/* = 0*/;
 
     // set the currently selected page, return the index of the previously
@@ -116,7 +119,7 @@ public:
 
 
     // cycle thru the pages
-    void AdvanceSelection(bool forward = True);
+    void AdvanceSelection(bool forward = true);
 
     static wxVisualAttributes
     GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
@@ -124,10 +127,10 @@ public:
 
 
 
-class wxBookCtrlEvent : public wxNotifyEvent
+class wxBookCtrlBaseEvent : public wxNotifyEvent
 {
 public:
-    wxBookCtrlEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
+    wxBookCtrlBaseEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
                     int nSel = -1, int nOldSel = -1);
 
         // the currently selected page (-1 if none)
@@ -151,6 +154,7 @@ enum {
     wxNB_RIGHT,
     wxNB_BOTTOM,
     wxNB_MULTILINE,
+    wxNB_NOPAGETHEME,
 
     // hittest flags
     wxNB_HITTEST_NOWHERE = 1,   // not on tab
@@ -164,25 +168,29 @@ enum {
 
 MustHaveApp(wxNotebook);
 
-class wxNotebook : public wxBookCtrl {
+class wxNotebook : public wxBookCtrlBase {
 public:
     %pythonAppend wxNotebook         "self._setOORInfo(self)"
     %pythonAppend wxNotebook()       ""
+    %typemap(out) wxNotebook*;    // turn off this typemap
 
     wxNotebook(wxWindow *parent,
                wxWindowID id=-1,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
                long style = 0,
-               const wxString& name = wxPyNOTEBOOK_NAME);
-    %name(PreNotebook)wxNotebook();
+               const wxString& name = wxPyNotebookNameStr);
+    %RenameCtor(PreNotebook, wxNotebook());
+
+    // Turn it back on again
+    %typemap(out) wxNotebook* { $result = wxPyMake_wxObject($1, $owner); }
 
     bool Create(wxWindow *parent,
-               wxWindowID id,
+               wxWindowID id=-1,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
                long style = 0,
-               const wxString& name = wxPyNOTEBOOK_NAME);
+               const wxString& name = wxPyNotebookNameStr);
 
 
     // get the number of rows for a control with wxNB_MULTILINE style (not all
@@ -206,18 +214,17 @@ wx.NB_HITTEST flags.", "");
     // implement some base class functions
     virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
 
-#ifdef __WXMSW__
-    // Windows only: attempts to apply the UX theme page background to this page
-  void ApplyThemeBackground(wxWindow* window, const wxColour& colour);
-#endif
-
+    // On platforms that support it, get the theme page background colour,
+    // else invalid colour
+    wxColour GetThemeBackgroundColour() const;
+    
     static wxVisualAttributes
     GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 };
 
 
 
-class wxNotebookEvent : public wxBookCtrlEvent
+class wxNotebookEvent : public wxBookCtrlBaseEvent
 {
 public:
     wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
@@ -243,7 +250,7 @@ public:
 class NotebookPage(wx.Panel):
     """
     There is an old (and apparently unsolvable) bug when placing a
-    window with a nonstandard background colour in a wxNotebook on
+    window with a nonstandard background colour in a wx.Notebook on
     wxGTK, as the notbooks's background colour would always be used
     when the window is refreshed.  The solution is to place a panel in
     the notbook and the coloured window on the panel, sized to cover
@@ -256,8 +263,8 @@ class NotebookPage(wx.Panel):
                  style=wx.TAB_TRAVERSAL, name="panel"):
         wx.Panel.__init__(self, parent, id, pos, size, style, name)
         self.child = None
-        EVT_SIZE(self, self.OnSize)
-        
+        self.Bind(wx.EVT_SIZE, self.OnSize)
+
     def OnSize(self, evt):
         if self.child is None:
             children = self.GetChildren()
@@ -293,7 +300,7 @@ enum
 MustHaveApp(wxListbook);
 
 //  wxListCtrl and wxNotebook combination
-class wxListbook : public wxBookCtrl
+class wxListbook : public wxBookCtrlBase
 {
 public:
     %pythonAppend wxListbook         "self._setOORInfo(self)"
@@ -305,10 +312,10 @@ public:
                const wxSize& size = wxDefaultSize,
                long style = 0,
                const wxString& name = wxPyEmptyString);
-    %name(PreListbook)wxListbook();
+    %RenameCtor(PreListbook, wxListbook());
 
     bool Create(wxWindow *parent,
-                wxWindowID id,
+                wxWindowID id=-1,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
                 long style = 0,
@@ -317,11 +324,12 @@ public:
     // returns True if we have wxLB_TOP or wxLB_BOTTOM style
     bool IsVertical() const;
 
+    wxListView* GetListView();
 };
 
 
 
-class wxListbookEvent : public wxBookCtrlEvent
+class wxListbookEvent : public wxBookCtrlBaseEvent
 {
 public:
     wxListbookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
@@ -338,20 +346,84 @@ public:
 }
 
 
+//---------------------------------------------------------------------------
+
+
+/*
+ * wxChoicebook flags
+ */
+enum {
+    wxCHB_DEFAULT,
+    wxCHB_TOP,
+    wxCHB_BOTTOM,
+    wxCHB_LEFT,
+    wxCHB_RIGHT,
+    wxCHB_ALIGN_MASK
+};
+
+
+MustHaveApp(wxChoicebook);
+
+class wxChoicebook : public wxBookCtrlBase
+{
+public:
+    %pythonAppend wxChoicebook         "self._setOORInfo(self)"
+    %pythonAppend wxChoicebook()       ""
+
+    wxChoicebook(wxWindow *parent,
+                 wxWindowID id,
+                 const wxPoint& pos = wxDefaultPosition,
+                 const wxSize& size = wxDefaultSize,
+                 long style = 0,
+                 const wxString& name = wxPyEmptyString);
+    %RenameCtor(PreChoicebook, wxChoicebook());
+
+    // quasi ctor
+    bool Create(wxWindow *parent,
+                wxWindowID id,
+                const wxPoint& pos = wxDefaultPosition,
+                const wxSize& size = wxDefaultSize,
+                long style = 0,
+                const wxString& name = wxPyEmptyString);
+
+
+    // returns true if we have wxCHB_TOP or wxCHB_BOTTOM style
+    bool IsVertical() const { return HasFlag(wxCHB_BOTTOM | wxCHB_TOP); }
+
+    virtual bool DeleteAllPages();
+};
+
+
+class wxChoicebookEvent : public wxBookCtrlBaseEvent
+{
+public:
+    wxChoicebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
+                      int nSel = -1, int nOldSel = -1);
+};
+
+%constant wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED;
+%constant wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING;
+
+%pythoncode {
+    EVT_CHOICEBOOK_PAGE_CHANGED  = wx.PyEventBinder( wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, 1 )
+    EVT_CHOICEBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, 1 )
+}
+
 //---------------------------------------------------------------------------
 %newgroup;
 
+// WXWIN_COMPATIBILITY_2_4
 
 class wxBookCtrlSizer: public wxSizer
 {
 public:
     %pythonAppend wxBookCtrlSizer "self._setOORInfo(self)"
 
-    wxBookCtrlSizer( wxBookCtrl *nb );
-    
+    wxBookCtrlSizer( wxBookCtrlBase *nb );
+
     void RecalcSizes();
     wxSize CalcMin();
-    wxBookCtrl *GetControl();
+    wxBookCtrlBase *GetControl();
 };
 
 
@@ -360,10 +432,14 @@ public:
     %pythonAppend wxNotebookSizer "self._setOORInfo(self)"
 
     wxNotebookSizer( wxNotebook *nb );
-    
+
     void RecalcSizes();
     wxSize CalcMin();
     wxNotebook *GetNotebook();
 };
 
+%pythoncode { NotebookSizer.__init__ = wx._deprecated(NotebookSizer.__init__, "NotebookSizer is no longer needed.") }
+%pythoncode { BookCtrlSizer.__init__ = wx._deprecated(BookCtrlSizer.__init__, "BookCtrlSizer is no longer needed.") }
+
+
 //---------------------------------------------------------------------------