Fix drawing of items with custom background in wxGenericListCtrl.
This was broken by the changes of r64879 which erroneously used wxRendererNative::DrawItemSelectionRect() even for the non-selected items. Now only use DrawItemSelectionRect() for the selected items to make them appear natively while drawing the non-selected items with custom background colour ourselves. Also refactor the code to avoid (the not quite and hence especially pernicious) duplication between wxListLineData::Draw() and DrawInReportMode(): rename SetAttributes() to ApplyAttributes() and draw the item background in this function now instead of doing it in both Draw() and DrawInReportMode(). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65541 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -275,9 +275,10 @@ public:
|
||||
}
|
||||
|
||||
// draw the line on the given DC in icon/list mode
|
||||
void Draw( wxDC *dc );
|
||||
void Draw( wxDC *dc, bool current );
|
||||
|
||||
// the same in report mode
|
||||
// the same in report mode: it needs more parameters as we don't store
|
||||
// everything in the item in report mode
|
||||
void DrawInReportMode( wxDC *dc,
|
||||
const wxRect& rect,
|
||||
const wxRect& rectHL,
|
||||
@@ -291,11 +292,12 @@ private:
|
||||
// get the mode (i.e. style) of the list control
|
||||
inline int GetMode() const;
|
||||
|
||||
// prepare the DC for drawing with these item's attributes, return true if
|
||||
// we need to draw the items background to highlight it, false otherwise
|
||||
bool SetAttributes(wxDC *dc,
|
||||
const wxListItemAttr *attr,
|
||||
bool highlight);
|
||||
// Apply this item attributes to the given DC: set the text font and colour
|
||||
// and also erase the background appropriately.
|
||||
void ApplyAttributes(wxDC *dc,
|
||||
const wxRect& rectHL,
|
||||
bool highlighted,
|
||||
bool current);
|
||||
|
||||
// draw the text on the DC with the correct justification; also add an
|
||||
// ellipsis if the text is too large to fit in the current width
|
||||
|
Reference in New Issue
Block a user