Implemented ListCtrl::SetColumnWidth() wxLIST_AUTOSIZE

Fixed typo in configure
  Added docs for wxINTXX_SWAP_XX macros


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2763 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1999-06-11 17:27:57 +00:00
parent f7770f09be
commit 0180dad680
6 changed files with 134 additions and 39 deletions

View File

@@ -1695,7 +1695,44 @@ void wxListMainWindow::SetColumnWidth( int col, int width )
m_dirty = TRUE;
wxNode *node = m_columns.Nth( col );
wxNode *node = (wxNode*) NULL;
if (width == wxLIST_AUTOSIZE_USEHEADER) width = 80;
if (width == wxLIST_AUTOSIZE)
{
wxClientDC dc(this);
dc.SetFont( GetFont() );
int max = 10;
node = m_lines.First();
while (node)
{
wxListLineData *line = (wxListLineData*)node->Data();
wxNode *n = line->m_items.Nth( col );
if (n)
{
wxListItemData *item = (wxListItemData*)n->Data();
int current = 0, ix = 0, iy = 0;
long lx = 0, ly = 0;
if (item->HasImage())
{
GetImageSize( item->GetImage(), ix, iy );
current = ix + 5;
}
if (item->HasText())
{
wxString str;
item->GetText( str );
dc.GetTextExtent( str, &lx, &ly );
current += lx;
}
if (current > max) max = current;
}
node = node->Next();
}
width = max+10;
}
node = m_columns.Nth( col );
if (node)
{
wxListHeaderData *column = (wxListHeaderData*)node->Data();