Change names of XXXIsSet variables in wxSTCListBoxVisualData

Instead name the variables useDefaultXXXColour since it more accurately
describes what purpose the variables are serving.
This commit is contained in:
New Pagodi
2019-04-20 12:38:29 -05:00
parent 9fc8642458
commit 419a053b7d

View File

@@ -2339,25 +2339,26 @@ private:
wxColour m_textColour; wxColour m_textColour;
wxColour m_highlightBgColour; wxColour m_highlightBgColour;
wxColour m_highlightTextColour; wxColour m_highlightTextColour;
bool m_bgColourIsSet; bool m_useDefaultBgColour;
bool m_textColourIsSet; bool m_useDefaultTextColour;
bool m_highlightBgColourIsSet; bool m_useDefaultHighlightBgColour;
bool m_highlightTextColourIsSet; bool m_useDefaultHighlightTextColour;
bool m_hasListCtrlAppearance; bool m_hasListCtrlAppearance;
wxColour m_currentBgColour; wxColour m_currentBgColour;
wxColour m_currentTextColour; wxColour m_currentTextColour;
bool m_currentBgColourIsSet; bool m_UseDefaultCurrentBgColour;
bool m_currentTextColourIsSet; bool m_UseDefaultCurrentTextColour;
}; };
wxSTCListBoxVisualData::wxSTCListBoxVisualData(int d):m_desiredVisibleRows(d), wxSTCListBoxVisualData::wxSTCListBoxVisualData(int d):m_desiredVisibleRows(d),
m_bgColourIsSet(false), m_textColourIsSet(false), m_useDefaultBgColour(true),
m_highlightBgColourIsSet(false), m_useDefaultTextColour(true),
m_highlightTextColourIsSet(false), m_useDefaultHighlightBgColour(true),
m_useDefaultHighlightTextColour(true),
m_hasListCtrlAppearance(false), m_hasListCtrlAppearance(false),
m_currentBgColourIsSet(false), m_UseDefaultCurrentBgColour(true),
m_currentTextColourIsSet(false) m_UseDefaultCurrentTextColour(true)
{ {
ComputeColours(); ComputeColours();
} }
@@ -2437,10 +2438,10 @@ void wxSTCListBoxVisualData::ComputeColours()
// wxSYS_COLOUR_BTNSHADOW seems to be the closest match with most themes. // wxSYS_COLOUR_BTNSHADOW seems to be the closest match with most themes.
m_borderColour = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW ); m_borderColour = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW );
if ( !m_bgColourIsSet ) if ( m_useDefaultBgColour )
m_bgColour = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX); m_bgColour = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX);
if ( !m_textColourIsSet ) if ( m_useDefaultTextColour )
m_textColour = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXTEXT); m_textColour = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXTEXT);
if ( m_hasListCtrlAppearance ) if ( m_hasListCtrlAppearance )
@@ -2448,47 +2449,48 @@ void wxSTCListBoxVisualData::ComputeColours()
// If m_highlightBgColour and/or m_currentBgColour are not // If m_highlightBgColour and/or m_currentBgColour are not
// explicitly set, set them to wxNullColour to indicate that they // explicitly set, set them to wxNullColour to indicate that they
// should be drawn with wxRendererNative. // should be drawn with wxRendererNative.
if ( !m_highlightBgColourIsSet ) if ( m_useDefaultHighlightBgColour )
m_highlightBgColour = wxNullColour; m_highlightBgColour = wxNullColour;
if ( !m_currentBgColourIsSet ) if ( m_UseDefaultCurrentBgColour )
m_currentBgColour = wxNullColour; m_currentBgColour = wxNullColour;
#ifdef __WXMSW__ #ifdef __WXMSW__
if ( !m_highlightTextColourIsSet ) if ( m_useDefaultHighlightTextColour )
m_highlightTextColour = m_highlightTextColour =
wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXTEXT); wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXTEXT);
#else #else
if ( !m_highlightTextColourIsSet ) if ( m_useDefaultHighlightTextColour )
m_highlightTextColour = wxSystemSettings::GetColour( m_highlightTextColour = wxSystemSettings::GetColour(
wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT); wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT);
#endif #endif
if ( !m_currentTextColour.IsOk() ) if ( m_UseDefaultCurrentTextColour )
m_currentTextColour = wxSystemSettings::GetColour( m_currentTextColour = wxSystemSettings::GetColour(
wxSYS_COLOUR_LISTBOXTEXT); wxSYS_COLOUR_LISTBOXTEXT);
} }
else else
{ {
#ifdef __WXOSX_COCOA__ #ifdef __WXOSX_COCOA__
if ( !m_highlightBgColourIsSet ) if ( m_useDefaultHighlightBgColour )
m_highlightBgColour = GetListHighlightColour(); m_highlightBgColour = GetListHighlightColour();
#else #else
if ( !m_highlightBgColourIsSet ) if ( m_useDefaultHighlightBgColour )
m_highlightBgColour = m_highlightBgColour =
wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT); wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT);
#endif #endif
if ( !m_highlightTextColourIsSet ) if ( m_useDefaultHighlightTextColour )
m_highlightTextColour = m_highlightTextColour =
wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT); wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT);
} }
} }
static void SetColourHelper(bool& isSet, wxColour& itemCol, const wxColour& newColour) static void SetColourHelper(bool& isDefault, wxColour& itemColour,
const wxColour& newColour)
{ {
isSet = newColour.IsOk(); isDefault = !newColour.IsOk();
itemCol = newColour; itemColour = newColour;
} }
void wxSTCListBoxVisualData::SetColours(const wxColour& bg, void wxSTCListBoxVisualData::SetColours(const wxColour& bg,
@@ -2496,10 +2498,11 @@ void wxSTCListBoxVisualData::SetColours(const wxColour& bg,
const wxColour& hlbg, const wxColour& hlbg,
const wxColour& hltext) const wxColour& hltext)
{ {
SetColourHelper(m_bgColourIsSet, m_bgColour, bg); SetColourHelper(m_useDefaultBgColour, m_bgColour, bg);
SetColourHelper(m_textColourIsSet, m_textColour, txt); SetColourHelper(m_useDefaultTextColour, m_textColour, txt);
SetColourHelper(m_highlightBgColourIsSet, m_highlightBgColour, hlbg); SetColourHelper(m_useDefaultHighlightBgColour, m_highlightBgColour, hlbg);
SetColourHelper(m_highlightTextColourIsSet, m_highlightTextColour, hltext); SetColourHelper(m_useDefaultHighlightTextColour, m_highlightTextColour,
hltext);
ComputeColours(); ComputeColours();
} }
@@ -2533,8 +2536,9 @@ void wxSTCListBoxVisualData::UseListCtrlStyle(bool useListCtrlStyle,
const wxColour& curText) const wxColour& curText)
{ {
m_hasListCtrlAppearance = useListCtrlStyle; m_hasListCtrlAppearance = useListCtrlStyle;
SetColourHelper(m_currentBgColourIsSet, m_currentBgColour, curBg); SetColourHelper(m_UseDefaultCurrentBgColour, m_currentBgColour, curBg);
SetColourHelper(m_currentTextColourIsSet, m_currentTextColour, curText); SetColourHelper(m_UseDefaultCurrentTextColour, m_currentTextColour,
curText);
ComputeColours(); ComputeColours();
} }