wxString GetItemText(long item) const
{
wxListItem info;
+ info.m_mask = wxLIST_MASK_TEXT;
info.m_itemId = item;
GetItem( info );
return info.m_text;
void wxListItemData::GetItem( wxListItem &info ) const
{
- info.m_text = m_text;
- info.m_image = m_image;
- info.m_data = m_data;
+ long mask = info.m_mask;
+ if ( !mask )
+ {
+ // by default, get everything for backwards compatibility
+ mask = -1;
+ }
+
+ if ( mask & wxLIST_MASK_TEXT )
+ info.m_text = m_text;
+ if ( mask & wxLIST_MASK_IMAGE )
+ info.m_image = m_image;
+ if ( mask & wxLIST_MASK_DATA )
+ info.m_data = m_data;
if ( m_attr )
{
wxListLineData *line = GetLine((size_t)id);
line->SetItem( item.m_col, item );
+ // Set item state if user wants
+ if ( item.m_mask & wxLIST_MASK_STATE )
+ SetItemState( item.m_itemId, item.m_state, item.m_state );
+
if (InReportView())
{
// update the Max Width Cache if needed
return;
}
- wxCHECK_RET( litem >= 0 && (size_t)litem < GetItemCount(),
- _T("invalid list ctrl item index in SetItem") );
+ wxCHECK_RET( litem >= 0 && (size_t)litem < GetItemCount(),
+ _T("invalid list ctrl item index in SetItem") );
size_t oldCurrent = m_current;
size_t item = (size_t)litem; // safe because of the check above
wxListLineData *line = GetLine((size_t)item.m_itemId);
line->GetItem( item.m_col, item );
+
+ // Get item state if user wants it
+ if ( item.m_mask & wxLIST_MASK_STATE )
+ item.m_state = GetItemState( item.m_itemId, wxLIST_STATE_SELECTED |
+ wxLIST_STATE_FOCUSED );
}
// ----------------------------------------------------------------------------
wxUIntPtr wxGenericListCtrl::GetItemData( long item ) const
{
wxListItem info;
+ info.m_mask = wxLIST_MASK_DATA;
info.m_itemId = item;
m_mainWin->GetItem( info );
return info.m_data;
return info.GetBackgroundColour();
}
+void wxGenericListCtrl::SetItemFont( long item, const wxFont &f )
+{
+ wxListItem info;
+ info.m_itemId = item;
+ info.SetFont( f );
+ m_mainWin->SetItem( info );
+}
+
+wxFont wxGenericListCtrl::GetItemFont( long item ) const
+{
+ wxListItem info;
+ info.m_itemId = item;
+ m_mainWin->GetItem( info );
+ return info.GetFont();
+}
+
int wxGenericListCtrl::GetSelectedItemCount() const
{
return m_mainWin->GetSelectedItemCount();