// headers
// ----------------------------------------------------------------------------
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
- #pragma implementation "listctrl.h"
- #pragma implementation "listctrlbase.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#if defined(__VISUALC__) || defined(__BORLANDC__) || defined(NMLVFINDITEM)
#define HAVE_NMLVFINDITEM 1
#elif defined(__DMC__) || defined(NM_FINDITEM)
- #define HAVE_NM_FINDITEM 1
+ #define HAVE_NMLVFINDITEM 1
+ #define NMLVFINDITEM NM_FINDITEM
#endif
// ----------------------------------------------------------------------------
}
// init with conversion
- void Init(LV_ITEM_OTHER& item)
+ void Init(const LV_ITEM_OTHER& item)
{
// avoid unnecessary dynamic memory allocation, jjust make m_pItem
// point to our own m_item
}
// Sets information about this column
-bool wxListCtrl::SetColumn(int col, wxListItem& item)
+bool wxListCtrl::SetColumn(int col, const wxListItem& item)
{
LV_COLUMN lvCol;
wxConvertToMSWListCol(col, item, lvCol);
// Gets the text colour of the listview
wxColour wxListCtrl::GetTextColour() const
{
- COLORREF ref = ListView_GetTextColor(GetHwnd());
- wxColour col(GetRValue(ref), GetGValue(ref), GetBValue(ref));
- return col;
+ // Use GetDefaultAttributes instead of ListView_GetTextColor because
+ // the latter seems to return black all the time (instead of the theme color)
+ return GetDefaultAttributes().colFg;
}
// Sets the text colour of the listview
// Inserts an item, returning the index of the new item if successful,
// -1 otherwise.
-long wxListCtrl::InsertItem(wxListItem& info)
+long wxListCtrl::InsertItem(const wxListItem& info)
{
wxASSERT_MSG( !IsVirtual(), _T("can't be used with virtual controls") );
}
// For list view mode (only), inserts a column.
-long wxListCtrl::InsertColumn(long col, wxListItem& item)
+long wxListCtrl::InsertColumn(long col, const wxListItem& item)
{
LV_COLUMN lvCol;
wxConvertToMSWListCol(col, item, lvCol);
return internalData->user_fn(d1, d2, internalData->data);
-};
+}
bool wxListCtrl::SortItems(wxListCtrlCompare fn, long data)
{
}
break;
-#if HAVE_NMLVFINDITEM || HAVE_NM_FINDITEM
+#ifdef HAVE_NMLVFINDITEM
case LVN_ODFINDITEM:
// this message is only used with the virtual list control but
// even there we don't want to always use it: in a control with
// application waiting while it performs linear search
if ( IsVirtual() && GetItemCount() <= 1000 )
{
-#if HAVE_NMLVFINDITEM
NMLVFINDITEM* pFindInfo = (NMLVFINDITEM*)lParam;
-#else
- NM_FINDITEM* pFindInfo = (NM_FINDITEM*)lParam;
-#endif
// no match by default
*result = -1;
processed = false;
}
break;
-#endif // HAVE_NMLVFINDITEM || HAVE_NM_FINDITEM
+#endif // HAVE_NMLVFINDITEM
case LVN_GETDISPINFO:
if ( IsVirtual() )
return NULL;
return (wxListItemInternalData *) it.lParam;
-};
+}
static
wxListItemInternalData *wxGetInternalData(const wxListCtrl *ctl, long itemId)
{
return wxGetInternalData(GetHwndOf(ctl), itemId);
-};
+}
static wxListItemAttr *wxGetInternalDataAttr(wxListCtrl *ctl, long itemId)
{
wxListItemInternalData *data = wxGetInternalData(ctl, itemId);
return data ? data->attr : NULL;
-};
+}
static void wxDeleteInternalData(wxListCtrl* ctl, long itemId)
{
//
// we don't use LVCFMT_COL_HAS_IMAGES because it doesn't seem to
// make any difference in my tests -- but maybe we should?
- lvCol.fmt |= LVCFMT_BITMAP_ON_RIGHT | LVCFMT_IMAGE;
+ if ( item.m_image != -1 )
+ lvCol.fmt |= LVCFMT_BITMAP_ON_RIGHT | LVCFMT_IMAGE;
lvCol.iImage = item.m_image;
}