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

Class VisualTreeWatcher

ExplorerTAP/visualtreewatcher.hpp:12–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10#include "taskbarappearanceservice.hpp"
11
12struct VisualTreeWatcher : winrt::implements<VisualTreeWatcher, IVisualTreeServiceCallback2, winrt::non_agile>
13{
14public:
15 VisualTreeWatcher(winrt::com_ptr<IUnknown> site, wil::unique_event_nothrow&& readyEvent);
16
17 VisualTreeWatcher(const VisualTreeWatcher&) = delete;
18 VisualTreeWatcher& operator=(const VisualTreeWatcher&) = delete;
19
20 VisualTreeWatcher(VisualTreeWatcher&&) = delete;
21 VisualTreeWatcher& operator=(VisualTreeWatcher&&) = delete;
22
23private:
24 HRESULT STDMETHODCALLTYPE OnVisualTreeChange(ParentChildRelation relation, VisualElement element, VisualMutationType mutationType) override;
25 HRESULT STDMETHODCALLTYPE OnElementStateChanged(InstanceHandle element, VisualElementState elementState, LPCWSTR context) noexcept override;
26
27 wux::FrameworkElement FindParent(std::wstring_view name, wux::FrameworkElement element);
28
29 template<typename T>
30 T FromHandle(InstanceHandle handle)
31 {
32 wf::IInspectable obj;
33 winrt::check_hresult(m_XamlDiagnostics->GetIInspectableFromHandle(handle, reinterpret_cast<::IInspectable**>(winrt::put_abi(obj))));
34
35 return obj.as<T>();
36 }
37
38 winrt::com_ptr<IXamlDiagnostics> m_XamlDiagnostics;
39 winrt::com_ptr<TaskbarAppearanceService> m_AppearanceService;
40 std::unordered_set<InstanceHandle> m_NonMatchingXamlSources;
41 wil::unique_event_nothrow m_ReadyEvent; // keep a hold of the event so it stays set
42};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected