diff options
author | Neil <nyamatongwe@gmail.com> | 2021-05-10 14:33:37 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-05-10 14:33:37 +1000 |
commit | 50f70a8bb42fc982350731da104b042ae75b1df2 (patch) | |
tree | acf6c9406d410af6a408faec403542da158f51b2 /src/ViewStyle.cxx | |
parent | 843ce05440fcd4ba7d19f8b612ab526c88296ad0 (diff) | |
download | scintilla-mirror-50f70a8bb42fc982350731da104b042ae75b1df2.tar.gz |
Add elementBaseColours to hold default or system derived colours.
Editor::UpdateBaseElements can be overridden by platform layers to set base
colours although they should also do this when they detect changes in system
settings.
Diffstat (limited to 'src/ViewStyle.cxx')
-rw-r--r-- | src/ViewStyle.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index 58af810b8..16701983e 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -523,6 +523,12 @@ std::optional<ColourAlpha> ViewStyle::ElementColour(int element) const { return search->second; } } + ElementMap::const_iterator searchBase = elementBaseColours.find(element); + if (searchBase != elementBaseColours.end()) { + if (searchBase->second.has_value()) { + return searchBase->second; + } + } return {}; } @@ -530,6 +536,32 @@ bool ViewStyle::ElementAllowsTranslucent(int element) const { return elementAllowsTranslucent.count(element) > 0; } +void ViewStyle::ResetElement(int element) { + elementColours.erase(element); +} + +bool ViewStyle::ElementIsSet(int element) const { + ElementMap::const_iterator search = elementColours.find(element); + if (search != elementColours.end()) { + return search->second.has_value(); + } + return false; +} + +bool ViewStyle::SetElementBase(int element, ColourAlpha colour) { + bool different = false; + ElementMap::const_iterator search = elementBaseColours.find(element); + if (search == elementBaseColours.end()) { + different = true; + } else { + if (search->second.has_value() && !(*search->second == colour)) { + different = true; + } + } + elementBaseColours[element] = colour; + return different; +} + bool ViewStyle::SetWrapState(int wrapState_) noexcept { WrapMode wrapStateWanted; switch (wrapState_) { |