2017-03-15 12:56:06 +00:00
|
|
|
#include "notification_presenter_win7.h"
|
|
|
|
#include "win32_notification.h"
|
|
|
|
|
|
|
|
namespace brightray {
|
|
|
|
|
2017-04-03 08:38:21 +00:00
|
|
|
brightray::Notification* NotificationPresenterWin7::CreateNotificationObject(
|
|
|
|
NotificationDelegate* delegate)
|
2017-03-15 12:56:06 +00:00
|
|
|
{
|
|
|
|
return new Win32Notification(delegate, this);
|
|
|
|
}
|
|
|
|
|
2017-04-03 08:38:21 +00:00
|
|
|
Win32Notification* NotificationPresenterWin7::GetNotificationObjectByRef(
|
|
|
|
const DesktopNotificationController::Notification& ref)
|
2017-03-15 12:56:06 +00:00
|
|
|
{
|
|
|
|
for(auto n : this->notifications())
|
|
|
|
{
|
|
|
|
auto w32n = static_cast<Win32Notification*>(n);
|
|
|
|
if(w32n->GetRef() == ref)
|
|
|
|
return w32n;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2017-04-03 08:38:21 +00:00
|
|
|
Win32Notification* NotificationPresenterWin7::GetNotificationObjectByTag(
|
|
|
|
const std::string& tag)
|
2017-03-15 12:56:06 +00:00
|
|
|
{
|
|
|
|
for(auto n : this->notifications())
|
|
|
|
{
|
|
|
|
auto w32n = static_cast<Win32Notification*>(n);
|
|
|
|
if(w32n->GetTag() == tag)
|
|
|
|
return w32n;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2017-04-03 08:38:21 +00:00
|
|
|
void NotificationPresenterWin7::OnNotificationClicked(
|
|
|
|
Notification& notification)
|
2017-03-15 12:56:06 +00:00
|
|
|
{
|
|
|
|
auto n = GetNotificationObjectByRef(notification);
|
|
|
|
if(n) n->NotificationClicked();
|
|
|
|
}
|
|
|
|
|
2017-04-03 08:38:21 +00:00
|
|
|
void NotificationPresenterWin7::OnNotificationDismissed(
|
|
|
|
Notification& notification)
|
2017-03-15 12:56:06 +00:00
|
|
|
{
|
|
|
|
auto n = GetNotificationObjectByRef(notification);
|
|
|
|
if(n) n->NotificationDismissed();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|