From 3872d96df2aecce78ba36233ec5506f227a6d9a0 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 25 Aug 2004 22:22:37 +0000 Subject: [PATCH] give the generic tree and list controls a DoGetBestSize git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28910 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/generic/listctrl.h | 2 ++ include/wx/generic/treectlg.h | 2 ++ src/generic/listctrl.cpp | 8 ++++++++ src/generic/treectlg.cpp | 9 +++++++++ wxPython/contrib/gizmos/wxCode/include/wx/treelistctrl.h | 2 ++ wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp | 6 ++++++ 6 files changed, 29 insertions(+) diff --git a/include/wx/generic/listctrl.h b/include/wx/generic/listctrl.h index cd59781dfa..6efe3d70ac 100644 --- a/include/wx/generic/listctrl.h +++ b/include/wx/generic/listctrl.h @@ -211,6 +211,8 @@ public: virtual bool ShouldInheritColours() const { return false; } virtual void SetFocus(); + virtual wxSize DoGetBestSize() const; + // implementation // -------------- diff --git a/include/wx/generic/treectlg.h b/include/wx/generic/treectlg.h index cd3cc583f3..2d1183ada0 100644 --- a/include/wx/generic/treectlg.h +++ b/include/wx/generic/treectlg.h @@ -391,6 +391,8 @@ public: void OnGetToolTip( wxTreeEvent &event ); void OnInternalIdle( ); + virtual wxSize DoGetBestSize() const; + virtual wxVisualAttributes GetDefaultAttributes() const { return GetClassDefaultAttributes(GetWindowVariant()); diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index ee4d53272e..ac0ab03bb2 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -5351,6 +5351,14 @@ void wxGenericListCtrl::SetFocus() m_mainWin->SetFocus(); } +wxSize wxGenericListCtrl::DoGetBestSize() const +{ + // Something is better than nothing... + // 100x80 is what the MSW version will get from the default + // wxControl::DoGetBestSize + return wxSize(100,80); +} + // ---------------------------------------------------------------------------- // virtual list control support // ---------------------------------------------------------------------------- diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 61cfce6b52..3d35e8dfa0 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -3476,6 +3476,15 @@ void wxGenericTreeCtrl::OnGetToolTip( wxTreeEvent &event ) } +wxSize wxGenericTreeCtrl::DoGetBestSize() const +{ + // something is better than nothing... + // 100x80 is what the MSW version will get from the default + // wxControl::DoGetBestSize + return wxSize(100,80); +} + + // NOTE: If using the wxListBox visual attributes works everywhere then this can // be removed, as well as the #else case below. #define _USE_VISATTR 0 diff --git a/wxPython/contrib/gizmos/wxCode/include/wx/treelistctrl.h b/wxPython/contrib/gizmos/wxCode/include/wx/treelistctrl.h index d92dc7c3b9..3b30c4a380 100644 --- a/wxPython/contrib/gizmos/wxCode/include/wx/treelistctrl.h +++ b/wxPython/contrib/gizmos/wxCode/include/wx/treelistctrl.h @@ -530,6 +530,8 @@ public: wxTreeListMainWindow* GetMainWindow() const { return m_main_win; } + virtual wxSize DoGetBestSize() const; + protected: // header window, responsible for column visualization and manipulation wxTreeListHeaderWindow* m_header_win; diff --git a/wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp b/wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp index 8070a23c18..2fbdd14400 100644 --- a/wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp +++ b/wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp @@ -5005,3 +5005,9 @@ void wxTreeListCtrl::Refresh(bool erase, const wxRect* rect) void wxTreeListCtrl::SetFocus() { m_main_win->SetFocus(); } + +wxSize wxTreeListCtrl::DoGetBestSize() const +{ + // something is better than nothing... + return wxSize(100,80); +} -- 2.45.2