X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ef8642862450ff846299b8e56d7b0cbce9d5f79d..17cfea01628866d8c0669d54406b37c550995597:/src/msw/listctrl.cpp diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index b24b99daf0..5a8c4e3363 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -362,6 +362,10 @@ bool wxListCtrl::Create(wxWindow *parent, // versions of _some_ messages (notably LVN_GETDISPINFOA) in MSLU build wxSetCCUnicodeFormat(GetHwnd()); + // We must set the default text colour to the system/theme color, otherwise + // GetTextColour will always return black + SetTextColour(GetDefaultAttributes().colFg); + // for comctl32.dll v 4.70+ we want to have some non default extended // styles because it's prettier (and also because wxGTK does it like this) if ( InReportView() && wxApp::GetComCtl32Version() >= 470 ) @@ -1115,9 +1119,9 @@ int wxListCtrl::GetSelectedItemCount() const // Gets the text colour of the listview wxColour wxListCtrl::GetTextColour() const { - // Use GetDefaultAttributes instead of ListView_GetTextColor because - // the latter seems to return black all the time (instead of the theme color) - return GetDefaultAttributes().colFg; + COLORREF ref = ListView_GetTextColor(GetHwnd()); + wxColour col(GetRValue(ref), GetGValue(ref), GetBValue(ref)); + return col; } // Sets the text colour of the listview @@ -1210,7 +1214,7 @@ void wxListCtrl::SetImageList(wxImageList *imageList, int which) m_imageListState = imageList; m_ownsImageListState = false; } - ListView_SetImageList(GetHwnd(), (HIMAGELIST) imageList ? imageList->GetHIMAGELIST() : 0, flags); + (void) ListView_SetImageList(GetHwnd(), (HIMAGELIST) imageList ? imageList->GetHIMAGELIST() : 0, flags); } void wxListCtrl::AssignImageList(wxImageList *imageList, int which) @@ -2762,7 +2766,7 @@ static void wxConvertToMSWListItem(const wxListCtrl *ctrl, // pszText is not const, hence the cast lvItem.pszText = (wxChar *)info.m_text.c_str(); if ( lvItem.pszText ) - lvItem.cchTextMax = info.m_text.Length(); + lvItem.cchTextMax = info.m_text.length(); else lvItem.cchTextMax = 0; } @@ -2831,4 +2835,3 @@ static void wxConvertToMSWListCol(int WXUNUSED(col), const wxListItem& item, } #endif // wxUSE_LISTCTRL -