Add wxPropertyGridPageState::GetColumnFullWidth().

This method allows to get the full width needed by wxPropertyGrid and is
useful for determining the space to allocate for it, e.g. when creating a
popup showing the property grid, as shown by the changes to the sample.

Closes #15368.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74628 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-08-06 13:05:42 +00:00
parent 9869c26285
commit 33d953e748
5 changed files with 204 additions and 1 deletions

View File

@@ -802,6 +802,27 @@ int wxPropertyGridPageState::GetColumnFitWidth(wxClientDC& dc,
return maxW;
}
int wxPropertyGridPageState::GetColumnFullWidth( wxClientDC &dc, wxPGProperty *p, unsigned int col )
{
if ( p->IsCategory() )
return 0;
const wxPGCell* cell = NULL;
wxString text;
p->GetDisplayInfo(col, -1, 0, &text, &cell);
int w = dc.GetTextExtent(text).x;
if ( col == 0 )
w += (int)p->m_depth * m_pPropGrid->m_subgroup_extramargin;
// account for the bitmap
if ( col == 1 )
w += p->GetImageOffset(m_pPropGrid->GetImageRect(p, -1).GetWidth());
w += (wxPG_XBEFORETEXT*2);
return w;
}
int wxPropertyGridPageState::DoGetSplitterPosition( int splitterColumn ) const
{
int n = GetGrid()->m_marginWidth;