I'm out of jokes
This commit is contained in:
parent
d2c2df31ca
commit
3fc6b82ac0
3
.gitignore
vendored
3
.gitignore
vendored
@ -26,4 +26,5 @@ CMakeCache.txt
|
||||
imgui.ini
|
||||
/out
|
||||
CMakePresets.json
|
||||
CMakeUserPresets.json
|
||||
CMakeUserPresets.json
|
||||
CMakeSettings.json
|
@ -2,6 +2,32 @@
|
||||
|
||||
#include <solanaceae/message3/components.hpp>
|
||||
|
||||
#include <wintoastlib.h>
|
||||
|
||||
#include <locale>
|
||||
#include <codecvt>
|
||||
|
||||
class OurHandler : public WinToastLib::IWinToastHandler {
|
||||
public:
|
||||
virtual ~OurHandler(void) {
|
||||
}
|
||||
|
||||
protected: // wintoast
|
||||
void toastActivated(void) const override {
|
||||
std::cout << "action called\n";
|
||||
}
|
||||
|
||||
void toastActivated(int actionIndex) const override {
|
||||
std::cout << "action called\n";
|
||||
}
|
||||
|
||||
void toastDismissed(WinToastDismissalReason state) const override {
|
||||
}
|
||||
|
||||
void toastFailed(void) const override {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
MessageN10n::MessageN10n(RegistryMessageModel& rmm) : _rmm(rmm) {
|
||||
// Register WinToast App User Model
|
||||
@ -23,37 +49,24 @@ MessageN10n::~MessageN10n(void) {
|
||||
bool MessageN10n::onEvent(const Message::Events::MessageConstruct& e) {
|
||||
std::cout << "message constructed called\n";
|
||||
|
||||
/*
|
||||
if (!e.e.all_of<Message::Components::MessageText>()) {
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
auto templ = WinToastLib::WinToastTemplate(WinToastLib::WinToastTemplate::Text02);
|
||||
templ.setTextField(L"title", WinToastLib::WinToastTemplate::FirstLine);
|
||||
templ.setTextField(L"subtitle", WinToastLib::WinToastTemplate::SecondLine);
|
||||
templ.setTextField(
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>>{}.from_bytes(
|
||||
e.e.get<Message::Components::MessageText>().text
|
||||
),
|
||||
WinToastLib::WinToastTemplate::SecondLine
|
||||
);
|
||||
|
||||
WinToastLib::WinToast::WinToastError error;
|
||||
const auto toast_id = WinToastLib::WinToast::instance()->showToast(templ, this, &error);
|
||||
const auto toast_id = WinToastLib::WinToast::instance()->showToast(templ, new OurHandler, &error);
|
||||
if (toast_id < 0) {
|
||||
std::wcout << L"Error: Could not launch your toast notification! " << error << std::endl;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void MessageN10n::toastActivated(void) const {
|
||||
// action
|
||||
std::cout << "action called\n";
|
||||
}
|
||||
|
||||
void MessageN10n::toastActivated(int actionIndex) const {
|
||||
// action
|
||||
std::cout << "action called\n";
|
||||
}
|
||||
|
||||
void MessageN10n::toastDismissed(WinToastDismissalReason) const {
|
||||
}
|
||||
|
||||
void MessageN10n::toastFailed(void) const {
|
||||
}
|
@ -2,9 +2,7 @@
|
||||
|
||||
#include <solanaceae/message3/registry_message_model.hpp>
|
||||
|
||||
#include <wintoastlib.h>
|
||||
|
||||
class MessageN10n : public RegistryMessageModelEventI, public WinToastLib::IWinToastHandler {
|
||||
class MessageN10n : public RegistryMessageModelEventI {//, public WinToastLib::IWinToastHandler {
|
||||
RegistryMessageModel& _rmm;
|
||||
|
||||
public:
|
||||
@ -14,9 +12,11 @@ class MessageN10n : public RegistryMessageModelEventI, public WinToastLib::IWinT
|
||||
protected: // rmm
|
||||
bool onEvent(const Message::Events::MessageConstruct& e) override;
|
||||
|
||||
/*
|
||||
protected: // wintoast
|
||||
void toastActivated(void) const override;
|
||||
void toastActivated(int actionIndex) const override;
|
||||
void toastDismissed(WinToastDismissalReason state) const override;
|
||||
void toastFailed(void) const override;
|
||||
*/
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user