DWORD dwStyleNew = ConvertToMSWStyle(dummy, m_windowStyle);
dwStyleNew |= m_baseStyle;
- // Get the current window style.
+ // Get the current window style.
DWORD dwStyleOld = ::GetWindowLong(GetHwnd(), GWL_STYLE);
- // Only set the window style if the view bits have changed.
+ // Only set the window style if the view bits have changed.
if ( dwStyleOld != dwStyleNew )
{
::SetWindowLong(GetHwnd(), GWL_STYLE, dwStyleNew);
LV_ITEM item;
wxConvertToMSWListItem(this, info, item);
item.cchTextMax = 0;
- return (ListView_SetItem(GetHwnd(), &item) != 0);
+ bool ok = ListView_SetItem(GetHwnd(), &item) != 0;
+ if ( ok && (info.m_mask & wxLIST_MASK_IMAGE) )
+ {
+ // make the change visible
+ ListView_Update(GetHwnd(), item.iItem);
+ }
+
+ return ok;
}
long wxListCtrl::SetItem(long index, int col, const wxString& label, int imageId)
// Sets the text colour of the listview
void wxListCtrl::SetTextColour(const wxColour& col)
{
- ListView_SetTextColor(GetHwnd(), PALETTERGB(col.Red(), col.Blue(), col.Green()));
+ ListView_SetTextColor(GetHwnd(), PALETTERGB(col.Red(), col.Green(), col.Blue()));
}
// Gets the index of the topmost visible item when in
event.m_col = hdr->iSubItem;
break;
}
+
case LVN_DELETEALLITEMS:
- {
- eventType = wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS;
- // NM_LISTVIEW* hdr = (NM_LISTVIEW*)lParam;
- event.m_itemIndex = -1;
- break;
- }
+ // what's the sense of generating a wxWin event for this when
+ // it's absolutely not portable?
+#if 0
+ eventType = wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS;
+ event.m_itemIndex = -1;
+#endif // 0
+
+ // return TRUE to suppress all additional LVN_DELETEITEM
+ // notifications - this makes deleting all items from a list ctrl
+ // much faster
+ *result = TRUE;
+ return TRUE;
+
case LVN_DELETEITEM:
{
eventType = wxEVT_COMMAND_LIST_DELETE_ITEM;