git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35930 
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
 - wxItemContainerImmutable::FindString unified (affects wxRadioBox, wxListBox,
   wxComboBox and wxChoice)
 - wxWindow::Fit() now works correctly for frames and dialogs too
 - wxItemContainerImmutable::FindString unified (affects wxRadioBox, wxListBox,
   wxComboBox and wxChoice)
 - wxWindow::Fit() now works correctly for frames and dialogs too
+- added access to the border size between pages and controller in book
+  based controls (wxBookCtrlBase::Get/SetInternalBorder)
 
     // calculate the size of the control from the size of its page
     virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const = 0;
 
     // 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
     // ----------
 
     // operations
     // ----------
     // helper: get the next page wrapping if we reached the end
     int GetNextPage(bool forward) const;
 
     // 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)) { }
 
     // Always rely on GetBestSize, which will look at all the pages
     virtual void SetInitialBestSize(const wxSize& WXUNUSED(size)) { }
 
     // the array of all pages of this control
     wxArrayPages m_pages;
 
     // the array of all pages of this control
     wxArrayPages m_pages;
 
     // true if we must delete m_imageList
     bool m_ownsImageList;
 
     // 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)
 };
 
     DECLARE_NO_COPY_CLASS(wxBookCtrlBase)
 };
 
 {
     m_imageList = NULL;
     m_ownsImageList = false;
 {
     m_imageList = NULL;
     m_ownsImageList = false;
+
+#if defined(__WXWINCE__)
+    m_internalBorder = 1;
+#else
+    m_internalBorder = 5;
+#endif
     }
     else // notebook is empty, no next page
     {
     }
     else // notebook is empty, no next page
     {
     }
 
     return nPage;
 }
 
 #endif // wxUSE_BOOKCTRL
     }
 
     return nPage;
 }
 
 #endif // wxUSE_BOOKCTRL
 
 #include "wx/imaglist.h"
 #include "wx/settings.h"
 
 #include "wx/imaglist.h"
 #include "wx/settings.h"
 
-// ----------------------------------------------------------------------------
-// constants
-// ----------------------------------------------------------------------------
-
-// margin between the choice and the page
-#if defined(__WXWINCE__)
-const wxCoord MARGIN = 1;
-#else
-const wxCoord MARGIN = 5;
-#endif
-
 // ----------------------------------------------------------------------------
 // various wxWidgets macros
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // various wxWidgets macros
 // ----------------------------------------------------------------------------
             // fall through
 
         case wxCHB_TOP:
             // fall through
 
         case wxCHB_TOP:
-            rectPage.y = sizeChoice.y + MARGIN;
+            rectPage.y = sizeChoice.y + GetInternalBorder();
             // fall through
 
         case wxCHB_BOTTOM:
             // fall through
 
         case wxCHB_BOTTOM:
-            rectPage.height -= sizeChoice.y + MARGIN;
+            rectPage.height -= sizeChoice.y + GetInternalBorder();
-            rectPage.x = sizeChoice.x + MARGIN;
+            rectPage.x = sizeChoice.x + GetInternalBorder();
             // fall through
 
         case wxCHB_RIGHT:
             // fall through
 
         case wxCHB_RIGHT:
-            rectPage.width -= sizeChoice.x + MARGIN;
+            rectPage.width -= sizeChoice.x + GetInternalBorder();
 
 wxSize wxChoicebook::CalcSizeFromPage(const wxSize& sizePage) const
 {
 
 wxSize wxChoicebook::CalcSizeFromPage(const wxSize& sizePage) const
 {
-    // we need to add the size of the choice control and the margin
+    // we need to add the size of the choice control and the border between
     const wxSize sizeChoice = GetChoiceSize();
 
     wxSize size = sizePage;
     if ( IsVertical() )
     {
     const wxSize sizeChoice = GetChoiceSize();
 
     wxSize size = sizePage;
     if ( IsVertical() )
     {
-        size.y += sizeChoice.y + MARGIN;
+        size.y += sizeChoice.y + GetInternalBorder();
     }
     else // left/right aligned
     {
     }
     else // left/right aligned
     {
-        size.x += sizeChoice.x + MARGIN;
+        size.x += sizeChoice.x + GetInternalBorder();
 
     // some page should be selected: either this one or the first one if there
     // is still no selection
 
     // some page should be selected: either this one or the first one if there
     // is still no selection
+    int selNew = wxNOT_FOUND;
     if ( bSelect )
         selNew = n;
     if ( bSelect )
         selNew = n;
-    else if ( m_selection == -1 )
+    else if ( m_selection == wxNOT_FOUND )
         selNew = 0;
 
     if ( selNew != m_selection )
         page->Hide();
 
         selNew = 0;
 
     if ( selNew != m_selection )
         page->Hide();
 
+    if ( selNew != wxNOT_FOUND )
         SetSelection(selNew);
 
     InvalidateBestSize();
         SetSelection(selNew);
 
     InvalidateBestSize();
 
 #include "wx/imaglist.h"
 #include "wx/settings.h"
 
 #include "wx/imaglist.h"
 #include "wx/settings.h"
 
-// ----------------------------------------------------------------------------
-// constants
-// ----------------------------------------------------------------------------
-
-// margin between the list and the page, should be bigger than wxStaticLine
-// size
-const wxCoord MARGIN = 5;
-
 // ----------------------------------------------------------------------------
 // various wxWidgets macros
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // various wxWidgets macros
 // ----------------------------------------------------------------------------
             // fall through
 
         case wxLB_TOP:
             // fall through
 
         case wxLB_TOP:
-            rectPage.y = sizeList.y + MARGIN;
+            rectPage.y = sizeList.y + GetInternalBorder();
             // fall through
 
         case wxLB_BOTTOM:
             // fall through
 
         case wxLB_BOTTOM:
-            rectPage.height -= sizeList.y + MARGIN;
+            rectPage.height -= sizeList.y + GetInternalBorder();
-            rectPage.x = sizeList.x + MARGIN;
+            rectPage.x = sizeList.x + GetInternalBorder();
             // fall through
 
         case wxLB_RIGHT:
             // fall through
 
         case wxLB_RIGHT:
-            rectPage.width -= sizeList.x + MARGIN;
+            rectPage.width -= sizeList.x + GetInternalBorder();
         {
             case wxLB_TOP:
                 rectLine.y = sizeNew.y + 1;
         {
             case wxLB_TOP:
                 rectLine.y = sizeNew.y + 1;
-                rectLine.height = MARGIN - 2;
+                rectLine.height = GetInternalBorder() - 2;
-                rectLine.height = MARGIN - 2;
+                rectLine.height = GetInternalBorder() - 2;
                 rectLine.y = sizeClient.y - sizeNew.y - rectLine.height;
                 break;
 
             case wxLB_LEFT:
                 rectLine.x = sizeNew.x + 1;
                 rectLine.y = sizeClient.y - sizeNew.y - rectLine.height;
                 break;
 
             case wxLB_LEFT:
                 rectLine.x = sizeNew.x + 1;
-                rectLine.width = MARGIN - 2;
+                rectLine.width = GetInternalBorder() - 2;
-                rectLine.width = MARGIN - 2;
+                rectLine.width = GetInternalBorder() - 2;
                 rectLine.x = sizeClient.x - sizeNew.x - rectLine.width;
                 break;
         }
                 rectLine.x = sizeClient.x - sizeNew.x - rectLine.width;
                 break;
         }
 
 wxSize wxListbook::CalcSizeFromPage(const wxSize& sizePage) const
 {
 
 wxSize wxListbook::CalcSizeFromPage(const wxSize& sizePage) const
 {
-    // we need to add the size of the list control and the margin
+    // we need to add the size of the list control and the border between
     const wxSize sizeList = GetListSize();
 
     wxSize size = sizePage;
     if ( IsVertical() )
     {
     const wxSize sizeList = GetListSize();
 
     wxSize size = sizePage;
     if ( IsVertical() )
     {
-        size.y += sizeList.y + MARGIN;
+        size.y += sizeList.y + GetInternalBorder();
     }
     else // left/right aligned
     {
     }
     else // left/right aligned
     {
-        size.x += sizeList.x + MARGIN;
+        size.x += sizeList.x + GetInternalBorder();
 }
 
 #endif // wxUSE_LISTBOOK
 }
 
 #endif // wxUSE_LISTBOOK