Revert last change, which made it impossible to set a custom text color and then query the color. Instead, set the correct system/theme color when the control is created and use the original GetTextColour method.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35800 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -362,6 +362,10 @@ bool wxListCtrl::Create(wxWindow *parent,
|
|||||||
// versions of _some_ messages (notably LVN_GETDISPINFOA) in MSLU build
|
// versions of _some_ messages (notably LVN_GETDISPINFOA) in MSLU build
|
||||||
wxSetCCUnicodeFormat(GetHwnd());
|
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
|
// 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)
|
// styles because it's prettier (and also because wxGTK does it like this)
|
||||||
if ( InReportView() && wxApp::GetComCtl32Version() >= 470 )
|
if ( InReportView() && wxApp::GetComCtl32Version() >= 470 )
|
||||||
@@ -1115,9 +1119,9 @@ int wxListCtrl::GetSelectedItemCount() const
|
|||||||
// Gets the text colour of the listview
|
// Gets the text colour of the listview
|
||||||
wxColour wxListCtrl::GetTextColour() const
|
wxColour wxListCtrl::GetTextColour() const
|
||||||
{
|
{
|
||||||
// Use GetDefaultAttributes instead of ListView_GetTextColor because
|
COLORREF ref = ListView_GetTextColor(GetHwnd());
|
||||||
// the latter seems to return black all the time (instead of the theme color)
|
wxColour col(GetRValue(ref), GetGValue(ref), GetBValue(ref));
|
||||||
return GetDefaultAttributes().colFg;
|
return col;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets the text colour of the listview
|
// Sets the text colour of the listview
|
||||||
|
Reference in New Issue
Block a user