]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/bookctrl.h
Introduced invalidation of ranges for later optimization code
[wxWidgets.git] / include / wx / bookctrl.h
index 82f956d58e49106283073f5e049091a8f63f2a09..dcfb8ae81be1de0a72cb4d374dc78f6e21061b20 100644 (file)
 #ifndef _WX_BOOKCTRL_H_
 #define _WX_BOOKCTRL_H_
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-    #pragma interface "bookctrl.h"
-#endif
-
 // ----------------------------------------------------------------------------
 // headers
 // ----------------------------------------------------------------------------
@@ -77,14 +73,14 @@ public:
     virtual size_t GetPageCount() const { return m_pages.size(); }
 
     // get the panel which represents the given page
-    virtual wxWindow *GetPage(size_t n) { return m_pages[n]; }
+    wxWindow *GetPage(size_t n) { return m_pages[n]; }
+    wxWindow *GetPage(size_t n) const { return m_pages[n]; }
 
     // get the current page or NULL if none
     wxWindow *GetCurrentPage() const
     {
-        int n = GetSelection();
-        return n == wxNOT_FOUND ? NULL
-                                : wx_const_cast(wxBookCtrlBase *, this)->GetPage(n);
+        const int n = GetSelection();
+        return n == wxNOT_FOUND ? NULL : GetPage(n);
     }
 
     // get the currently selected page or wxNOT_FOUND if none
@@ -122,6 +118,15 @@ public:
     // calculate the size of the control from the size of its page
     virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const = 0;
 
+    // get/set size of area between book control area and page area
+    inline unsigned int GetInternalBorder() const
+    {
+        return m_internalBorder;
+    }
+    void SetInternalBorder(unsigned int internalBorder)
+    {
+        m_internalBorder = internalBorder;
+    }
 
     // operations
     // ----------
@@ -180,6 +185,13 @@ public:
     }
 
 protected:
+    // Should we accept NULL page pointers in Add/InsertPage()?
+    //
+    // Default is no but derived classes may override it if they can treat NULL
+    // pages in some sensible way (e.g. wxTreebook overrides this to allow
+    // having nodes without any associated page)
+    virtual bool AllowNullPage() const { return false; }
+
     // remove the page and return a pointer to it
     virtual wxWindow *DoRemovePage(size_t page) = 0;
 
@@ -189,9 +201,6 @@ protected:
     // helper: get the next page wrapping if we reached the end
     int GetNextPage(bool forward) const;
 
-    // common part of all ctors
-    void Init();
-
     // Always rely on GetBestSize, which will look at all the pages
     virtual void SetInitialBestSize(const wxSize& WXUNUSED(size)) { }
 
@@ -204,6 +213,13 @@ protected:
     // true if we must delete m_imageList
     bool m_ownsImageList;
 
+private:
+
+    // common part of all ctors
+    void Init();
+
+    // internal border
+    unsigned int m_internalBorder;
 
     DECLARE_NO_COPY_CLASS(wxBookCtrlBase)
 };