timer
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "ApplicationData.h"
|
||||
#include "Util.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
#include <shellapi.h>
|
||||
#include <commctrl.h>
|
||||
@@ -53,6 +54,17 @@ void initShell(DrawData& drawData)
|
||||
std::cout << "Failed to hook tray icon events: " << std::hex << GetLastError() << std::endl;
|
||||
}
|
||||
|
||||
// Setup Toasts
|
||||
if (!WinToast::isCompatible()) {
|
||||
OutputDebugString(L"Error, your system in not supported!\n");
|
||||
}
|
||||
WinToast::instance()->setAppName(L"AudioThingy");
|
||||
const auto aumi = WinToast::configureAUMI(L"asuro", L"audiothingy");
|
||||
WinToast::instance()->setAppUserModelId(aumi);
|
||||
if (!WinToast::instance()->initialize()) {
|
||||
OutputDebugString(L"Error, could not initialize the lib!\n");
|
||||
}
|
||||
|
||||
// Set window minimize behavior
|
||||
glfwSetWindowIconifyCallback(drawData.window, [](GLFWwindow* window, int isIconified) {
|
||||
if (isIconified && gAppData->settings.docked)
|
||||
@@ -70,6 +82,18 @@ void initShell(DrawData& drawData)
|
||||
});
|
||||
}
|
||||
|
||||
void showToastNotification(TimerToastHandler* handler, const wchar_t* title, const wchar_t* text)
|
||||
{
|
||||
WinToastTemplate templ = WinToastTemplate(WinToastTemplate::ImageAndText02);
|
||||
templ.setImagePath(L"E:\\Code\\AsuroImgui\\x64\\Debug\\kaiju.ico");
|
||||
templ.setTextField(title, WinToastTemplate::FirstLine);
|
||||
templ.setTextField(text, WinToastTemplate::SecondLine);
|
||||
templ.addAction(L"Stop");
|
||||
if (!WinToast::instance()->showToast(templ, handler)) {
|
||||
OutputDebugString(L"Error: Could not launch your toast notification!\n");
|
||||
}
|
||||
}
|
||||
|
||||
void cleanupShell(DrawData& drawData)
|
||||
{
|
||||
// Remove tray icon
|
||||
@@ -100,3 +124,21 @@ LRESULT CALLBACK trayIconEventHandler(int code, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
return CallNextHookEx(NULL, code, wParam, lParam);
|
||||
}
|
||||
|
||||
void TimerToastHandler::toastActivated() const
|
||||
{
|
||||
glfwShowWindow(gDrawData->window);
|
||||
glfwRestoreWindow(gDrawData->window);
|
||||
}
|
||||
|
||||
void TimerToastHandler::toastActivated(int actionIndex) const
|
||||
{
|
||||
}
|
||||
|
||||
void TimerToastHandler::toastFailed() const
|
||||
{
|
||||
}
|
||||
|
||||
void TimerToastHandler::toastDismissed(WinToastDismissalReason state) const
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user