Return correct index from wxGenericListCtrl::InsertColumn().
It used to always return 0 in the generic version, return the correct index of the newly inserted column now. Closes #13677. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71971 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -565,6 +565,7 @@ All (GUI):
|
|||||||
- Added wxDataViewListCtrl::GetItemCount() (Kry).
|
- Added wxDataViewListCtrl::GetItemCount() (Kry).
|
||||||
- Added support for Korean Johab and Vietnamese encodings (jank9201).
|
- Added support for Korean Johab and Vietnamese encodings (jank9201).
|
||||||
- Fix off by 1 bug with setting font size in points in wxHTML (gevorg).
|
- Fix off by 1 bug with setting font size in points in wxHTML (gevorg).
|
||||||
|
- Fix return value of wxGenericListCtrl::InsertColumn() (Sebastian Walderich).
|
||||||
|
|
||||||
GTK:
|
GTK:
|
||||||
|
|
||||||
|
@@ -644,7 +644,7 @@ public:
|
|||||||
long FindItem( const wxPoint& pt );
|
long FindItem( const wxPoint& pt );
|
||||||
long HitTest( int x, int y, int &flags ) const;
|
long HitTest( int x, int y, int &flags ) const;
|
||||||
void InsertItem( wxListItem &item );
|
void InsertItem( wxListItem &item );
|
||||||
void InsertColumn( long col, const wxListItem &item );
|
long InsertColumn( long col, const wxListItem &item );
|
||||||
int GetItemWidthWithImage(wxListItem * item);
|
int GetItemWidthWithImage(wxListItem * item);
|
||||||
void SortItems( wxListCtrlCompare fn, wxIntPtr data );
|
void SortItems( wxListCtrlCompare fn, wxIntPtr data );
|
||||||
|
|
||||||
|
@@ -4125,8 +4125,10 @@ void wxListMainWindow::InsertItem( wxListItem &item )
|
|||||||
RefreshLines(id, GetItemCount() - 1);
|
RefreshLines(id, GetItemCount() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListMainWindow::InsertColumn( long col, const wxListItem &item )
|
long wxListMainWindow::InsertColumn( long col, const wxListItem &item )
|
||||||
{
|
{
|
||||||
|
long idx = -1;
|
||||||
|
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
if ( InReportView() )
|
if ( InReportView() )
|
||||||
{
|
{
|
||||||
@@ -4143,9 +4145,11 @@ void wxListMainWindow::InsertColumn( long col, const wxListItem &item )
|
|||||||
node = m_columns.Item( col );
|
node = m_columns.Item( col );
|
||||||
m_columns.Insert( node, column );
|
m_columns.Insert( node, column );
|
||||||
m_aColWidths.Insert( colWidthInfo, col );
|
m_aColWidths.Insert( colWidthInfo, col );
|
||||||
|
idx = col;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
idx = m_aColWidths.GetCount();
|
||||||
m_columns.Append( column );
|
m_columns.Append( column );
|
||||||
m_aColWidths.Add( colWidthInfo );
|
m_aColWidths.Add( colWidthInfo );
|
||||||
}
|
}
|
||||||
@@ -4167,6 +4171,7 @@ void wxListMainWindow::InsertColumn( long col, const wxListItem &item )
|
|||||||
// invalidate it as it has to be recalculated
|
// invalidate it as it has to be recalculated
|
||||||
m_headerWidth = 0;
|
m_headerWidth = 0;
|
||||||
}
|
}
|
||||||
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxListMainWindow::GetItemWidthWithImage(wxListItem * item)
|
int wxListMainWindow::GetItemWidthWithImage(wxListItem * item)
|
||||||
@@ -4947,14 +4952,14 @@ long wxGenericListCtrl::DoInsertColumn( long col, const wxListItem &item )
|
|||||||
{
|
{
|
||||||
wxCHECK_MSG( InReportView(), -1, wxT("can't add column in non report mode") );
|
wxCHECK_MSG( InReportView(), -1, wxT("can't add column in non report mode") );
|
||||||
|
|
||||||
m_mainWin->InsertColumn( col, item );
|
long idx = m_mainWin->InsertColumn( col, item );
|
||||||
|
|
||||||
// NOTE: if wxLC_NO_HEADER was given, then we are in report view mode but
|
// NOTE: if wxLC_NO_HEADER was given, then we are in report view mode but
|
||||||
// still have m_headerWin==NULL
|
// still have m_headerWin==NULL
|
||||||
if (m_headerWin)
|
if (m_headerWin)
|
||||||
m_headerWin->Refresh();
|
m_headerWin->Refresh();
|
||||||
|
|
||||||
return 0;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGenericListCtrl::ScrollList( int dx, int dy )
|
bool wxGenericListCtrl::ScrollList( int dx, int dy )
|
||||||
|
Reference in New Issue
Block a user