From 4402f6924f14847c1570b22ef06ba54125a9c41c Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Fri, 28 Aug 2015 11:32:10 +0000 Subject: Toaster: hiding toasts git-svn-id: http://svn.miranda-ng.org/main/trunk@15053 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Toaster/src/toast_event_handler.cpp | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'plugins/Toaster/src/toast_event_handler.cpp') diff --git a/plugins/Toaster/src/toast_event_handler.cpp b/plugins/Toaster/src/toast_event_handler.cpp index e2ed29e165..c7f43ad115 100644 --- a/plugins/Toaster/src/toast_event_handler.cpp +++ b/plugins/Toaster/src/toast_event_handler.cpp @@ -1,5 +1,7 @@ #include "stdafx.h" +using namespace ABI::Windows::UI::Notifications; + ToastEventHandler::ToastEventHandler() : _ref(1), _callback(nullptr), _arg(nullptr) { } @@ -30,10 +32,13 @@ IFACEMETHODIMP ToastEventHandler::QueryInterface(_In_ REFIID riid, _COM_Outptr_ *ppv = static_cast(static_cast(this)); else if (IsEqualIID(riid, __uuidof(DesktopToastActivatedEventHandler))) *ppv = static_cast(this); + else if (IsEqualIID(riid, __uuidof(DesktopToastDismissedEventHandler))) + *ppv = static_cast(this); + else if (IsEqualIID(riid, __uuidof(DesktopToastFailedEventHandler))) + *ppv = static_cast(this); else *ppv = nullptr; - if (*ppv) - { + if (*ppv) { reinterpret_cast(*ppv)->AddRef(); return S_OK; } @@ -41,10 +46,24 @@ IFACEMETHODIMP ToastEventHandler::QueryInterface(_In_ REFIID riid, _COM_Outptr_ return E_NOINTERFACE; } -IFACEMETHODIMP ToastEventHandler::Invoke(_In_ ABI::Windows::UI::Notifications::IToastNotification* /* sender */, _In_::IInspectable* /* args */) +IFACEMETHODIMP ToastEventHandler::Invoke(_In_ IToastNotification* /* sender */, _In_ IInspectable* /* args */) { if (_callback != nullptr) _callback(_arg); return S_OK; } + +IFACEMETHODIMP ToastEventHandler::Invoke(_In_ IToastNotification* /* sender */, _In_ IToastDismissedEventArgs* /* e */) +{ + callbackArg *cb = (callbackArg*)_arg; + lstNotifications.remove(cb->notification); + return S_OK; +} + +IFACEMETHODIMP ToastEventHandler::Invoke(_In_ IToastNotification* /* sender */, _In_ IToastFailedEventArgs* /* e */) +{ + callbackArg *cb = (callbackArg*)_arg; + lstNotifications.remove(cb->notification); + return S_OK; +} \ No newline at end of file -- cgit v1.2.3