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