void wxListLineData::SetAttributes(wxDC *dc,
const wxListItemAttr *attr,
const wxColour& colText,
- const wxFont& font)
+ const wxFont& font,
+ bool hilight)
{
- if ( attr && attr->HasTextColour() )
+ // don't use foregroud colour for drawing highlighted items - this might
+ // make them completely invisible (and there is no way to do bit
+ // arithmetics on wxColour, unfortunately)
+ if ( !hilight && attr && attr->HasTextColour() )
{
dc->SetTextForeground(attr->GetTextColour());
}
// customize the subitems (in report mode) too.
wxListItemData *item = (wxListItemData*)m_items.First()->Data();
wxListItemAttr *attr = item->GetAttributes();
- SetAttributes(dc, attr, colText, font);
+ SetAttributes(dc, attr, colText, font, hilight);
bool hasBgCol = attr && attr->HasBackgroundColour();
if ( paintBG || hasBgCol )
void wxListLineData::Hilight( bool on )
{
if (on == m_hilighted) return;
+ m_hilighted = on;
if (on)
m_owner->SelectLine( this );
else
m_owner->DeselectLine( this );
- m_hilighted = on;
}
void wxListLineData::ReverseHilight( void )
int cw = item.m_width-2;
#if wxUSE_GENERIC_LIST_EXTENSIONS
if ((i+1 == numColumns) || ( dc.LogicalToDeviceX(x+item.m_width) > w-5))
- cw = dc.DeviceToLogicalX(w)-x-1;
+ cw = dc.DeviceToLogicalX(w)-x-1;
#else
- if ((i+1 == numColumns) || (x+item.m_width > w-5)) cw = w-x-1;
+ if ((i+1 == numColumns) || (x+item.m_width > w-5))
+ cw = w-x-1;
#endif
dc.SetPen( *wxWHITE_PEN );
le.SetEventObject( GetParent() );
le.m_itemIndex = GetIndexOfLine( line );
line->GetItem( 0, le.m_item );
-// GetParent()->GetEventHandler()->ProcessEvent( le );
- GetParent()->GetEventHandler()->AddPendingEvent( le );
+ GetParent()->GetEventHandler()->ProcessEvent( le );
+// GetParent()->GetEventHandler()->AddPendingEvent( le );
}
void wxListMainWindow::FocusLine( wxListLineData *WXUNUSED(line) )
m_attr = NULL;
}
+void wxListItem::Clear()
+{
+ m_mask = 0;
+ m_itemId = 0;
+ m_col = 0;
+ m_state = 0;
+ m_stateMask = 0;
+ m_image = 0;
+ m_data = 0;
+ m_format = wxLIST_FORMAT_CENTRE;
+ m_width = 0;
+ m_text = wxEmptyString;
+
+ if (m_attr) delete m_attr;
+ m_attr = NULL;
+}
+
+void wxListItem::ClearAttributes()
+{
+ if (m_attr) delete m_attr;
+ m_attr = NULL;
+}
+
// -------------------------------------------------------------------------------------
// wxListEvent
// -------------------------------------------------------------------------------------