42 lines
1.3 KiB
Markdown
42 lines
1.3 KiB
Markdown
## Notification API
|
|
|
|
Displaying a desktop notification is done using the `pfd::notify` class. It can be provided a
|
|
title, a message text, and an `icon` for the notification style:
|
|
|
|
```cpp
|
|
pfd::notify::notify(std::string const &title,
|
|
std::string const &text,
|
|
pfd::icon icon = pfd::icon::info);
|
|
|
|
enum class pfd::icon { info, warning, error };
|
|
```
|
|
|
|
## Example
|
|
|
|
Displaying a notification is straightforward. Emoji are supported:
|
|
|
|
```cpp
|
|
pfd::notify("System event", "Something might be on fire 🔥",
|
|
pfd::icon::warning);
|
|
```
|
|
|
|
The `pfd::notify` object needs not be kept around, letting the object clean up itself is enough.
|
|
|
|
## Screenshots
|
|
|
|
Windows 10:
|
|

|
|
|
|
Mac OS X (dark theme):
|
|

|
|
|
|
Mac OS X (light theme):
|
|

|
|
|
|
Linux (GNOME desktop):
|
|

|
|
|
|
Linux (KDE desktop):
|
|

|
|
|