Improve wxGrid appearance in dark mode under macOS
Use more appropriate colours for the row/column cell headers and don't hardcode black (i.e. at least use white instead in dark mode) for the frozen border. Closes https://github.com/wxWidgets/wxWidgets/pull/2026 See #18941.
This commit is contained in:
committed by
Vadim Zeitlin
parent
f8af2601c2
commit
3c28244806
@@ -295,7 +295,7 @@ void wxGridRowHeaderRendererDefault::DrawBorder(const wxGrid& grid,
|
|||||||
wxDC& dc,
|
wxDC& dc,
|
||||||
wxRect& rect) const
|
wxRect& rect) const
|
||||||
{
|
{
|
||||||
dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW)));
|
dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW)));
|
||||||
dc.DrawLine(rect.GetRight(), rect.GetTop(),
|
dc.DrawLine(rect.GetRight(), rect.GetTop(),
|
||||||
rect.GetRight(), rect.GetBottom());
|
rect.GetRight(), rect.GetBottom());
|
||||||
|
|
||||||
@@ -314,7 +314,7 @@ void wxGridRowHeaderRendererDefault::DrawBorder(const wxGrid& grid,
|
|||||||
ofs = 1;
|
ofs = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
dc.SetPen(*wxWHITE_PEN);
|
dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT)));
|
||||||
dc.DrawLine(rect.GetLeft() + ofs, rect.GetTop(),
|
dc.DrawLine(rect.GetLeft() + ofs, rect.GetTop(),
|
||||||
rect.GetLeft() + ofs, rect.GetBottom());
|
rect.GetLeft() + ofs, rect.GetBottom());
|
||||||
dc.DrawLine(rect.GetLeft() + ofs, rect.GetTop(),
|
dc.DrawLine(rect.GetLeft() + ofs, rect.GetTop(),
|
||||||
@@ -327,7 +327,7 @@ void wxGridColumnHeaderRendererDefault::DrawBorder(const wxGrid& grid,
|
|||||||
wxDC& dc,
|
wxDC& dc,
|
||||||
wxRect& rect) const
|
wxRect& rect) const
|
||||||
{
|
{
|
||||||
dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW)));
|
dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW)));
|
||||||
dc.DrawLine(rect.GetRight(), rect.GetTop(),
|
dc.DrawLine(rect.GetRight(), rect.GetTop(),
|
||||||
rect.GetRight(), rect.GetBottom());
|
rect.GetRight(), rect.GetBottom());
|
||||||
dc.DrawLine(rect.GetLeft(), rect.GetBottom(),
|
dc.DrawLine(rect.GetLeft(), rect.GetBottom(),
|
||||||
@@ -343,7 +343,7 @@ void wxGridColumnHeaderRendererDefault::DrawBorder(const wxGrid& grid,
|
|||||||
ofs = 1;
|
ofs = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
dc.SetPen(*wxWHITE_PEN);
|
dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT)));
|
||||||
dc.DrawLine(rect.GetLeft(), rect.GetTop() + ofs,
|
dc.DrawLine(rect.GetLeft(), rect.GetTop() + ofs,
|
||||||
rect.GetLeft(), rect.GetBottom());
|
rect.GetLeft(), rect.GetBottom());
|
||||||
dc.DrawLine(rect.GetLeft(), rect.GetTop() + ofs,
|
dc.DrawLine(rect.GetLeft(), rect.GetTop() + ofs,
|
||||||
@@ -356,7 +356,7 @@ void wxGridCornerHeaderRendererDefault::DrawBorder(const wxGrid& grid,
|
|||||||
wxDC& dc,
|
wxDC& dc,
|
||||||
wxRect& rect) const
|
wxRect& rect) const
|
||||||
{
|
{
|
||||||
dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW)));
|
dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW)));
|
||||||
dc.DrawLine(rect.GetRight() - 1, rect.GetBottom() - 1,
|
dc.DrawLine(rect.GetRight() - 1, rect.GetBottom() - 1,
|
||||||
rect.GetRight() - 1, rect.GetTop());
|
rect.GetRight() - 1, rect.GetTop());
|
||||||
dc.DrawLine(rect.GetRight() - 1, rect.GetBottom() - 1,
|
dc.DrawLine(rect.GetRight() - 1, rect.GetBottom() - 1,
|
||||||
@@ -375,7 +375,7 @@ void wxGridCornerHeaderRendererDefault::DrawBorder(const wxGrid& grid,
|
|||||||
ofs = 1;
|
ofs = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
dc.SetPen(*wxWHITE_PEN);
|
dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT)));
|
||||||
dc.DrawLine(rect.GetLeft() + 1, rect.GetTop() + ofs,
|
dc.DrawLine(rect.GetLeft() + 1, rect.GetTop() + ofs,
|
||||||
rect.GetRight() - 1, rect.GetTop() + ofs);
|
rect.GetRight() - 1, rect.GetTop() + ofs);
|
||||||
dc.DrawLine(rect.GetLeft() + ofs, rect.GetTop() + ofs,
|
dc.DrawLine(rect.GetLeft() + ofs, rect.GetTop() + ofs,
|
||||||
@@ -2848,10 +2848,14 @@ void wxGrid::Init()
|
|||||||
m_gridLinesEnabled = true;
|
m_gridLinesEnabled = true;
|
||||||
m_gridLinesClipHorz =
|
m_gridLinesClipHorz =
|
||||||
m_gridLinesClipVert = true;
|
m_gridLinesClipVert = true;
|
||||||
m_cellHighlightColour = *wxBLACK;
|
m_cellHighlightColour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
|
||||||
m_cellHighlightPenWidth = 2;
|
m_cellHighlightPenWidth = 2;
|
||||||
m_cellHighlightROPenWidth = 1;
|
m_cellHighlightROPenWidth = 1;
|
||||||
m_gridFrozenBorderColour = *wxBLACK;
|
if ( wxSystemSettings::GetAppearance().IsDark() )
|
||||||
|
m_gridFrozenBorderColour = *wxWHITE;
|
||||||
|
else
|
||||||
|
m_gridFrozenBorderColour = *wxBLACK;
|
||||||
|
|
||||||
m_gridFrozenBorderPenWidth = 2;
|
m_gridFrozenBorderPenWidth = 2;
|
||||||
|
|
||||||
m_canDragColMove = false;
|
m_canDragColMove = false;
|
||||||
|
Reference in New Issue
Block a user