MCPcopy Create free account
hub / github.com/TranslucentTB/TranslucentTB / CloneResourceDictionary

Method CloneResourceDictionary

Xaml/StyleResources.cpp:52–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50 }
51
52 wux::ResourceDictionary StyleResources::CloneResourceDictionary(const wux::ResourceDictionary &resource, const wux::ResourceDictionary &destination)
53 {
54 if (!resource)
55 {
56 return nullptr;
57 }
58
59 if (const auto source = resource.Source())
60 {
61 destination.Source(source);
62 }
63 else
64 {
65 if (const auto themeDicts = resource.ThemeDictionaries())
66 {
67 for (const auto theme : themeDicts)
68 {
69 if (const auto themeResource = theme.Value().try_as<wux::ResourceDictionary>())
70 {
71 wux::ResourceDictionary themeDict;
72 CloneResourceDictionary(themeResource, themeDict);
73 destination.ThemeDictionaries().Insert(theme.Key(), themeDict);
74 }
75 else
76 {
77 destination.ThemeDictionaries().Insert(theme.Key(), theme.Value());
78 }
79 }
80 }
81
82 if (const auto mergeDicts = resource.MergedDictionaries())
83 {
84 for (const auto mergedResource : mergeDicts)
85 {
86 wux::ResourceDictionary mergedDict;
87 CloneResourceDictionary(mergedResource, mergedDict);
88 destination.MergedDictionaries().Append(mergedDict);
89 }
90 }
91
92 for (const auto item : resource)
93 {
94 destination.Insert(item.Key(), item.Value());
95 }
96 }
97
98 return destination;
99 }
100}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected