added a helper function to show the popup menu allowing to configure the columns in header control

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57356 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-12-15 11:03:59 +00:00
parent 565382de29
commit e8f25dbbce
4 changed files with 80 additions and 1 deletions

View File

@@ -226,6 +226,29 @@ wxHeaderCtrlBase::DoResizeColumnIndices(wxArrayInt& colIndices, unsigned int cou
wxASSERT_MSG( colIndices.size() == count, "logic error" );
}
// ----------------------------------------------------------------------------
// wxHeaderCtrl extra UI
// ----------------------------------------------------------------------------
int wxHeaderCtrlBase::ShowColumnsMenu(const wxString& title)
{
wxMenu menu;
if ( !title.empty() )
menu.SetTitle(title);
const unsigned count = GetColumnCount();
for ( unsigned n = 0; n < count; n++ )
{
const wxHeaderColumn& col = GetColumn(n);
menu.AppendCheckItem(n, col.GetTitle());
if ( col.IsShown() )
menu.Check(n, true);
}
return GetPopupMenuSelectionFromUser(menu,
ScreenToClient(wxGetMousePosition()));
}
// ============================================================================
// wxHeaderCtrlSimple implementation
// ============================================================================