mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
common: refactor common library pt2 (#8588)
- remove common lib - split settings, remove common-md - move ipc interop/kb_layout to interop - rename core -> settings, settings -> old_settings - os-detect header-only; interop -> PowerToysInterop - split notifications, move single-use headers where they're used - winstore lib - rename com utils - rename Updating and Telemetry projects - rename core -> settings-ui and remove examples folder - rename settings-ui folder + consisent common/version include
This commit is contained in:
67
src/common/notifications/notifications.h
Normal file
67
src/common/notifications/notifications.h
Normal file
@@ -0,0 +1,67 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
#include <variant>
|
||||
#include <optional>
|
||||
|
||||
namespace notifications
|
||||
{
|
||||
constexpr inline const wchar_t TOAST_ACTIVATED_LAUNCH_ARG[] = L"-ToastActivated";
|
||||
constexpr inline const wchar_t UPDATING_PROCESS_TOAST_TAG[] = L"PTUpdateNotifyTag";
|
||||
|
||||
void override_application_id(const std::wstring_view appID);
|
||||
void register_background_toast_handler();
|
||||
void run_desktop_app_activator_loop();
|
||||
|
||||
bool register_application_id(const std::wstring_view appName, const std::wstring_view iconPath);
|
||||
void unregister_application_id();
|
||||
|
||||
struct snooze_duration
|
||||
{
|
||||
std::wstring label;
|
||||
int minutes;
|
||||
};
|
||||
|
||||
struct snooze_button
|
||||
{
|
||||
std::wstring snooze_title;
|
||||
std::vector<snooze_duration> durations;
|
||||
std::wstring snooze_button_title;
|
||||
};
|
||||
|
||||
struct link_button
|
||||
{
|
||||
std::wstring label;
|
||||
std::wstring url;
|
||||
bool context_menu = false;
|
||||
};
|
||||
|
||||
struct background_activated_button
|
||||
{
|
||||
std::wstring label;
|
||||
bool context_menu = false;
|
||||
};
|
||||
|
||||
struct progress_bar_params
|
||||
{
|
||||
std::wstring progress_title;
|
||||
float progress = 0.f;
|
||||
};
|
||||
|
||||
struct toast_params
|
||||
{
|
||||
std::optional<std::wstring_view> tag;
|
||||
bool resend_if_scheduled = true;
|
||||
std::optional<progress_bar_params> progress_bar;
|
||||
};
|
||||
|
||||
using action_t = std::variant<link_button, background_activated_button, snooze_button>;
|
||||
|
||||
void show_toast(std::wstring plaintext_message, std::wstring title, toast_params params = {});
|
||||
void show_toast_with_activations(std::wstring plaintext_message, std::wstring title, std::wstring_view background_handler_id, std::vector<action_t> actions, toast_params params = {});
|
||||
void update_toast_progress_bar(std::wstring_view tag, progress_bar_params params);
|
||||
void update_toast_contents(std::wstring_view tag, std::wstring plaintext_message, std::wstring title);
|
||||
void remove_toasts(std::wstring_view tag);
|
||||
}
|
||||
Reference in New Issue
Block a user