]> git.saurik.com Git - wxWidgets.git/commitdiff
corrected wxTreeCtrl::GetBestSize() for a control with borders
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 25 Nov 2006 14:54:22 +0000 (14:54 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 25 Nov 2006 14:54:22 +0000 (14:54 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43640 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
include/wx/generic/treectlg.h
src/common/treebase.cpp
src/generic/treectlg.cpp

index 5383882f42a70315cef242ba8c53195b0a650bd9..2cb417171d229fba482c57e64b6405e6ec376529 100644 (file)
@@ -97,6 +97,8 @@ All:
 - New option wxFS_READ | wxFS_SEEKABLE for wxFileSystem::OpenFile() to return
   a stream that is seekable.
 - Fixed bug in wxCalendarCtrl::HitTest() when clicking on month change arrows
+- Added wxWindow::GetWindowBorderSize() and corrected wxTreeCtrl::GetBestSize()
+  for a control with borders (Tim Kosse)
 
 wxMSW:
 
index a9a6318ce9a416f8516e083c3afa6d51fa392b78..0a1e8fee1625338c16eedeb742d7b676fd86d54f 100644 (file)
@@ -345,6 +345,8 @@ protected:
 
     void DoDirtyProcessing();
 
+    virtual wxSize DoGetBestSize() const;
+
 private:
     DECLARE_EVENT_TABLE()
     DECLARE_DYNAMIC_CLASS(wxGenericTreeCtrl)
index 4d9c1094e61039d954798d7e18a8cce744940b3e..d4244576a76b7f47855de1f90d353e10bacefb40 100644 (file)
@@ -163,7 +163,12 @@ wxSize wxTreeCtrlBase::DoGetBestSize() const
     if ( !size.x || !size.y )
         size = wxControl::DoGetBestSize();
     else
+    {
+        // Add border size
+        size += GetWindowBorderSize();
+
         CacheBestSize(size);
+    }
 
     return size;
 }
index a20a4fabe201d02a0d6b7ba6de20c42a0ebce284..c1cd97fdfb98e071231e3ee6f9d2a863e526a7e4 100644 (file)
@@ -3647,4 +3647,14 @@ void wxGenericTreeCtrl::DoDirtyProcessing()
     AdjustMyScrollbars();
 }
 
+wxSize wxGenericTreeCtrl::DoGetBestSize() const
+{
+    wxSize size = wxTreeCtrlBase::DoGetBestSize();
+
+    // The generic control seems to have an implicit border
+    size.IncBy(4, 4);
+
+    return size;
+}
+
 #endif // wxUSE_TREECTRL