X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/35c2acd4a81a3b41ced9253f744a00e64de2a423..f94a81c084696210418b8709e8ab649a18465fa6:/src/msw/listctrl.cpp diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 578af99fef..b24b99daf0 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -17,11 +17,6 @@ // 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" @@ -62,7 +57,8 @@ #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 // ---------------------------------------------------------------------------- @@ -123,7 +119,7 @@ public: } // 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 @@ -663,7 +659,7 @@ bool wxListCtrl::GetColumn(int col, wxListItem& item) const } // 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); @@ -1119,9 +1115,9 @@ int wxListCtrl::GetSelectedItemCount() const // 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 @@ -1490,7 +1486,7 @@ long wxListCtrl::HitTest(const wxPoint& point, int& flags) // 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") ); @@ -1563,7 +1559,7 @@ long wxListCtrl::InsertItem(long index, const wxString& label, int imageIndex) } // 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); @@ -1656,7 +1652,7 @@ int CALLBACK wxInternalDataCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM l return internalData->user_fn(d1, d2, internalData->data); -}; +} bool wxListCtrl::SortItems(wxListCtrlCompare fn, long data) { @@ -2160,7 +2156,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) } 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 @@ -2169,11 +2165,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) // 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; @@ -2234,7 +2226,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) processed = false; } break; -#endif // HAVE_NMLVFINDITEM || HAVE_NM_FINDITEM +#endif // HAVE_NMLVFINDITEM case LVN_GETDISPINFO: if ( IsVirtual() ) @@ -2589,20 +2581,20 @@ static wxListItemInternalData *wxGetInternalData(HWND hwnd, long itemId) 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) { @@ -2828,7 +2820,8 @@ static void wxConvertToMSWListCol(int WXUNUSED(col), const wxListItem& item, // // 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; }