]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/bookctrl.cpp
add extra space for top border when wxDIALOG_UNIT_COMPATIBILITY == 1 too
[wxWidgets.git] / src / common / bookctrl.cpp
index 25d28d865d3f801e77b287858818734693319586..a9082315a9f93c3bbda2541debfd60468785dcc3 100644 (file)
@@ -1,6 +1,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 // Name:        common/bookctrl.cpp
-// Purpose:     wxBookCtrl implementation
+// Purpose:     wxBookCtrlBase implementation
 // Author:      Vadim Zeitlin
 // Modified by:
 // Created:     19.08.03
 // constructors and destructors
 // ----------------------------------------------------------------------------
 
-wxBookCtrl::wxBookCtrl()
-{
-    Init();
-}
-
-wxBookCtrl::wxBookCtrl(wxWindow *parent,
-                       wxWindowID id,
-                       const wxPoint& pos,
-                       const wxSize& size,
-                       long style,
-                       const wxString& name)
-{
-    Init();
-
-    (void)Create(parent, id, pos, size, style, name);
-}
-
-void wxBookCtrl::Init()
+void wxBookCtrlBase::Init()
 {
     m_imageList = NULL;
     m_ownsImageList = false;
 }
 
 bool
-wxBookCtrl::Create(wxWindow *parent,
+wxBookCtrlBase::Create(wxWindow *parent,
                        wxWindowID id,
                        const wxPoint& pos,
                        const wxSize& size,
@@ -85,7 +68,7 @@ wxBookCtrl::Create(wxWindow *parent,
                      );
 }
 
-wxBookCtrl::~wxBookCtrl()
+wxBookCtrlBase::~wxBookCtrlBase()
 {
     if ( m_ownsImageList )
     {
@@ -98,7 +81,7 @@ wxBookCtrl::~wxBookCtrl()
 // image list
 // ----------------------------------------------------------------------------
 
-void wxBookCtrl::SetImageList(wxImageList *imageList)
+void wxBookCtrlBase::SetImageList(wxImageList *imageList)
 {
     if ( m_ownsImageList )
     {
@@ -111,7 +94,7 @@ void wxBookCtrl::SetImageList(wxImageList *imageList)
     m_imageList = imageList;
 }
 
-void wxBookCtrl::AssignImageList(wxImageList* imageList)
+void wxBookCtrlBase::AssignImageList(wxImageList* imageList)
 {
     SetImageList(imageList);
 
@@ -122,12 +105,12 @@ void wxBookCtrl::AssignImageList(wxImageList* imageList)
 // geometry
 // ----------------------------------------------------------------------------
 
-void wxBookCtrl::SetPageSize(const wxSize& size)
+void wxBookCtrlBase::SetPageSize(const wxSize& size)
 {
     SetClientSize(CalcSizeFromPage(size));
 }
 
-wxSize wxBookCtrl::DoGetBestSize() const
+wxSize wxBookCtrlBase::DoGetBestSize() const
 {
     wxSize bestSize;
 
@@ -147,7 +130,9 @@ wxSize wxBookCtrl::DoGetBestSize() const
 
     // convert display area to window area, adding the size neccessary for the
     // tabs
-    return CalcSizeFromPage(bestSize);
+    wxSize best = CalcSizeFromPage(bestSize);
+    CacheBestSize(best);
+    return best;
 }
 
 // ----------------------------------------------------------------------------
@@ -155,22 +140,23 @@ wxSize wxBookCtrl::DoGetBestSize() const
 // ----------------------------------------------------------------------------
 
 bool
-wxBookCtrl::InsertPage(size_t nPage,
-                       wxWindow *page,
-                       const wxString& WXUNUSED(text),
-                       bool WXUNUSED(bSelect),
-                       int WXUNUSED(imageId))
+wxBookCtrlBase::InsertPage(size_t nPage,
+                           wxWindow *page,
+                           const wxString& WXUNUSED(text),
+                           bool WXUNUSED(bSelect),
+                           int WXUNUSED(imageId))
 {
-    wxCHECK_MSG( page, false, _T("NULL page in wxBookCtrl::InsertPage()") );
+    wxCHECK_MSG( page, false, _T("NULL page in wxBookCtrlBase::InsertPage()") );
     wxCHECK_MSG( nPage <= m_pages.size(), false,
-                 _T("invalid page index in wxBookCtrl::InsertPage()") );
+                 _T("invalid page index in wxBookCtrlBase::InsertPage()") );
 
     m_pages.Insert(page, nPage);
+    InvalidateBestSize();
 
     return true;
 }
 
-bool wxBookCtrl::DeletePage(size_t nPage)
+bool wxBookCtrlBase::DeletePage(size_t nPage)
 {
     wxWindow *page = DoRemovePage(nPage);
     if ( !page )
@@ -181,18 +167,19 @@ bool wxBookCtrl::DeletePage(size_t nPage)
     return true;
 }
 
-wxWindow *wxBookCtrl::DoRemovePage(size_t nPage)
+wxWindow *wxBookCtrlBase::DoRemovePage(size_t nPage)
 {
     wxCHECK_MSG( nPage < m_pages.size(), NULL,
-                 _T("invalid page index in wxBookCtrl::DoRemovePage()") );
+                 _T("invalid page index in wxBookCtrlBase::DoRemovePage()") );
 
     wxWindow *pageRemoved = m_pages[nPage];
     m_pages.RemoveAt(nPage);
+    InvalidateBestSize();
 
     return pageRemoved;
 }
 
-int wxBookCtrl::GetNextPage(bool forward) const
+int wxBookCtrlBase::GetNextPage(bool forward) const
 {
     int nPage;