-
Notifications
You must be signed in to change notification settings - Fork 661
/
InfoBar.h
65 lines (49 loc) · 2.39 KB
/
InfoBar.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
#pragma once
#include "pch.h"
#include "common.h"
#include "InfoBar.g.h"
#include "InfoBar.properties.h"
class InfoBar :
public ReferenceTracker<InfoBar, winrt::implementation::InfoBarT>,
public InfoBarProperties
{
public:
InfoBar();
~InfoBar() {}
// IFrameworkElement
void OnApplyTemplate();
// UIElement
winrt::AutomationPeer OnCreateAutomationPeer();
// Property change handlers
void OnIsOpenPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
void OnSeverityPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
void OnIconSourcePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
void OnIsIconVisiblePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
void OnIsClosablePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
void OnTitlePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
void OnActionButtonPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
void OnMessagePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
private:
void OnCloseButtonClick(winrt::IInspectable const& sender, winrt::RoutedEventArgs const& args);
void RaiseClosingEvent();
void RaiseClosedEvent();
void UpdateVisibility(bool notify = true, bool force = false);
void UpdateSeverity();
void UpdateIcon();
void UpdateIconVisibility();
void UpdateCloseButton();
void UpdateForeground();
void UpdateContentPosition();
const winrt::hstring GetCloseButtonResourceName(winrt::InfoBarSeverity severity);
const winrt::hstring GetSeverityLevelResourceName(winrt::InfoBarSeverity severity);
const winrt::hstring GetIconSeverityLevelResourceName(winrt::InfoBarSeverity severity);
void OnForegroundChanged(const winrt::DependencyObject& sender, const winrt::DependencyProperty& args);
winrt::InfoBarCloseReason m_lastCloseReason{ winrt::InfoBarCloseReason::Programmatic };
winrt::Button::Click_revoker m_closeButtonClickRevoker{};
tracker_ref<winrt::FrameworkElement> m_standardIconTextBlock{ this };
bool m_applyTemplateCalled{ false };
bool m_notifyOpen{ false };
bool m_isVisible{ false };
};