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

Method BuildAppearanceFromSubMenu

Xaml/Pages/TrayFlyoutPage.cpp:270–323  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268 }
269
270 txmp::TaskbarAppearance TrayFlyoutPage::BuildAppearanceFromSubMenu(const wuxc::MenuFlyoutSubItem &menu)
271 {
272 std::optional<bool> enabled;
273 for (const auto item : menu.Items())
274 {
275 if (item.Tag().try_as<hstring>() == L"Enabled")
276 {
277 if (const auto toggleButton = item.try_as<wuxc::ToggleMenuFlyoutItem>())
278 {
279 enabled = toggleButton.IsChecked();
280 }
281 }
282 }
283
284 txmp::TaskbarAppearance appearance(nullptr);
285 if (enabled)
286 {
287 txmp::OptionalTaskbarAppearance optAppearance;
288 optAppearance.Enabled(*enabled);
289 appearance = std::move(optAppearance);
290 }
291 else
292 {
293 appearance = { };
294 }
295
296 for (const auto item : menu.Items())
297 {
298 const auto tag = item.Tag();
299 if (const auto radioItem = item.try_as<muxc::RadioMenuFlyoutItem>())
300 {
301 if (radioItem.IsChecked())
302 {
303 if (const auto accent = tag.try_as<txmp::AccentState>())
304 {
305 appearance.Accent(*accent);
306 }
307 }
308 }
309 else if (const auto toggleItem = item.try_as<wuxc::ToggleMenuFlyoutItem>())
310 {
311 if (tag.try_as<hstring>() == L"ShowPeek")
312 {
313 appearance.ShowPeek(toggleItem.IsChecked());
314 }
315 else if (tag.try_as<hstring>() == L"ShowLine")
316 {
317 appearance.ShowLine(toggleItem.IsChecked());
318 }
319 }
320 }
321
322 return appearance;
323 }
324
325 wuxc::MenuFlyoutSubItem TrayFlyoutPage::GetSubMenuForState(txmp::TaskbarState state)
326 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected