Improve column auto-sizing code in generic wxListCtrl.

Take the width of the header itself into account when setting width to
wxLIST_AUTOSIZE.

Also refactor the code to reuse the code used in wxLIST_AUTOSIZE_USEHEADER
case in SetColumnWidth() when inserting or updating the column width to this
value.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70285 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-01-07 15:09:54 +00:00
parent 0fb731b8bf
commit 3d167c0022
2 changed files with 37 additions and 36 deletions

View File

@@ -575,7 +575,6 @@ public:
void DrawImage( int index, wxDC *dc, int x, int y );
void GetImageSize( int index, int &width, int &height ) const;
int GetTextLength( const wxString &s ) const;
void SetImageList( wxImageList *imageList, int which );
void SetItemSpacing( int spacing, bool isSmall = false );
@@ -793,6 +792,10 @@ private:
// delete all items but don't refresh: called from dtor
void DoDeleteAllItems();
// Compute the minimal width needed to fully display the column header.
int ComputeMinHeaderWidth(const wxListHeaderData* header) const;
// the height of one line using the current font
wxCoord m_lineHeight;