Use sensible default column width in generic wxListCtrl too

Set width of the new columns to wxLIST_DEFAULT_COL_WIDTH and not 0 in
the generic version: this is more compatible with the MSW version and
more useful.

Document that omitting list column width in XRC results in columns of
default, rather than null, as previously, width.
This commit is contained in:
Vadim Zeitlin
2021-08-17 23:28:24 +02:00
parent 2727926608
commit 96d36383bd
2 changed files with 4 additions and 3 deletions

View File

@@ -1379,7 +1379,7 @@ following properties (all of them optional):
@row3col{text, @ref overview_xrcformat_type_text, @row3col{text, @ref overview_xrcformat_type_text,
The title of the column. } The title of the column. }
@row3col{width, integer, @row3col{width, integer,
The column width. } The column width. @c wxLIST_DEFAULT_COL_WIDTH is used by default. }
@row3col{image, integer, @row3col{image, integer,
The zero-based index of the image associated with the item in the 'small' image list. } The zero-based index of the image associated with the item in the 'small' image list. }
@endTable @endTable

View File

@@ -313,8 +313,9 @@ void wxListHeaderData::SetItem( const wxListItem &item )
if ( m_mask & wxLIST_MASK_FORMAT ) if ( m_mask & wxLIST_MASK_FORMAT )
m_format = item.m_format; m_format = item.m_format;
if ( m_mask & wxLIST_MASK_WIDTH ) // Always give some initial width to the new columns (it's still possible
SetWidth(item.m_width); // to set the width to 0 explicitly, however).
SetWidth(m_mask & wxLIST_MASK_WIDTH ? item.m_width : wxLIST_DEFAULT_COL_WIDTH);
if ( m_mask & wxLIST_MASK_STATE ) if ( m_mask & wxLIST_MASK_STATE )
SetState(item.m_state); SetState(item.m_state);