diff options
author | B. Stack <bgstack15@gmail.com> | 2021-05-10 08:05:45 -0400 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2021-05-10 08:05:45 -0400 |
commit | 0d0f8635218a2893fcd00385019089253474f634 (patch) | |
tree | 9261c60b81eb28e068f0f2f44fd8e60214462b2a /wx+/choice_enum.h | |
parent | Merge branch '11.9' into 'master' (diff) | |
download | FreeFileSync-0d0f8635218a2893fcd00385019089253474f634.tar.gz FreeFileSync-0d0f8635218a2893fcd00385019089253474f634.tar.bz2 FreeFileSync-0d0f8635218a2893fcd00385019089253474f634.zip |
add upstream 11.10
Diffstat (limited to 'wx+/choice_enum.h')
-rw-r--r-- | wx+/choice_enum.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/wx+/choice_enum.h b/wx+/choice_enum.h index a590861a..a25bf104 100644 --- a/wx+/choice_enum.h +++ b/wx+/choice_enum.h @@ -48,7 +48,7 @@ struct EnumDescrList using DescrList = std::vector<std::pair<Enum, std::pair<wxString, wxString>>>; DescrList descrList; - std::unordered_map<const wxChoice*, std::vector<wxString>> itemsSetLast; + std::unordered_map<const wxChoice*, std::vector<wxString>> labelsSetLast; }; template <class Enum> void setEnumVal(const EnumDescrList<Enum>& mapping, wxChoice& ctrl, Enum value); template <class Enum> Enum getEnumVal(const EnumDescrList<Enum>& mapping, const wxChoice& ctrl); @@ -71,16 +71,16 @@ template <class Enum> void updateTooltipEnumVal(const EnumDescrList<Enum>& mappi template <class Enum> void setEnumVal(EnumDescrList<Enum>& mapping, wxChoice& ctrl, Enum value) { - auto& itemsSetLast = mapping.itemsSetLast[&ctrl]; + auto& labelsSetLast = mapping.labelsSetLast[&ctrl]; - std::vector<wxString> items; - for (auto it = mapping.descrList.begin(); it != mapping.descrList.end(); ++it) - items.push_back(it->second.first); + std::vector<wxString> labels; + for (const auto& [val, texts] : mapping.descrList) + labels.push_back(texts.first); - if (items != itemsSetLast) + if (labels != labelsSetLast) { - ctrl.Set(items); //expensive as fuck! => only call when absolutely needed! - itemsSetLast = std::move(items); + ctrl.Set(labels); //expensive as fuck! => only call when absolutely needed! + labelsSetLast = std::move(labels); } //----------------------------------------------------------------- |