From: Julian Smart Date: Sun, 18 Mar 2012 20:35:01 +0000 (+0000) Subject: Added wxPropertyGridManager::SetPageSplitterLeft X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/216b59c66ae90e8576e529e9871f215f3dbf3bfc Added wxPropertyGridManager::SetPageSplitterLeft git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70937 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/propgrid/manager.h b/include/wx/propgrid/manager.h index 39752a1222..77adfd827f 100644 --- a/include/wx/propgrid/manager.h +++ b/include/wx/propgrid/manager.h @@ -574,6 +574,11 @@ public: */ void SetSplitterLeft( bool subProps = false, bool allPages = true ); + /** Moves splitter as left as possible on an individual page, while still allowing all + labels to be shown in full. + */ + void SetPageSplitterLeft(int page, bool subProps = false); + /** Sets splitter position on individual page. diff --git a/interface/wx/propgrid/manager.h b/interface/wx/propgrid/manager.h index 7b5df8516a..0391703b0f 100644 --- a/interface/wx/propgrid/manager.h +++ b/interface/wx/propgrid/manager.h @@ -467,6 +467,11 @@ public: */ void SetSplitterLeft( bool subProps = false, bool allPages = true ); + /** Moves splitter as left as possible on an individual page, while still allowing all + labels to be shown in full. + */ + void SetPageSplitterLeft(int page, bool subProps = false); + /** Sets splitter position on individual page. diff --git a/src/propgrid/manager.cpp b/src/propgrid/manager.cpp index c9252f2172..6a1f9fe6e1 100644 --- a/src/propgrid/manager.cpp +++ b/src/propgrid/manager.cpp @@ -1830,6 +1830,27 @@ void wxPropertyGridManager::SetSplitterLeft( bool subProps, bool allPages ) #endif } +void wxPropertyGridManager::SetPageSplitterLeft(int page, bool subProps) +{ + wxASSERT_MSG( (page < (int) GetPageCount()), + wxT("SetPageSplitterLeft() has no effect until pages have been added") ); + + if (page < (int) GetPageCount()) + { + wxClientDC dc(this); + dc.SetFont(m_pPropGrid->GetFont()); + + int maxW = m_pState->GetColumnFitWidth(dc, m_arrPages[page]->m_properties, 0, subProps ); + maxW += m_pPropGrid->m_marginWidth; + SetPageSplitterPosition( page, maxW ); + +#if wxUSE_HEADERCTRL + if ( m_showHeader ) + m_pHeaderCtrl->OnColumWidthsChanged(); +#endif + } +} + // ----------------------------------------------------------------------- void wxPropertyGridManager::OnPropertyGridSelect( wxPropertyGridEvent& event )