summaryrefslogtreecommitdiff
path: root/plugins/Toaster/src/toast_notification.h
blob: 4399248848aed7d6b302bff78031987f2eb0d324 (plain)
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
#ifndef _TOAST_NOTIFICATION_H_
#define _TOAST_NOTIFICATION_H_

struct ToastHandlerData;

class ToastNotification
{
private:
	wchar_t* _text;
	wchar_t* _caption;
	wchar_t* _imagePath;

	EventRegistrationToken _ertActivated;
	EventRegistrationToken _ertDismissed;
	EventRegistrationToken _ertFailed;

	Microsoft::WRL::ComPtr<ABI::Windows::UI::Notifications::IToastNotificationManagerStatics> notificationManager;
	Microsoft::WRL::ComPtr<ABI::Windows::UI::Notifications::IToastNotifier> notifier;
	Microsoft::WRL::ComPtr<ABI::Windows::UI::Notifications::IToastNotification> notification;

	HRESULT CreateXml(_Outptr_ ABI::Windows::Data::Xml::Dom::IXmlDocument** xml);
	HRESULT Create(_Outptr_ ABI::Windows::UI::Notifications::IToastNotification** notification);

public:
	ToastNotification(_In_ wchar_t* text, _In_ wchar_t* caption = nullptr, _In_ wchar_t* imagePath = nullptr);
	~ToastNotification();

	HRESULT Initialize();
	HRESULT Show(_In_ ToastHandlerData*);
	HRESULT Hide();
};

#endif //_TOAST_NOTIFICATION_H_