lecui 1.0.0-alpha.20
lecui C++ user interface library
|
Tray icon class. More...
#include <tray_icon.h>
Public Member Functions | |
tray_icon (form &fm) | |
Constructor. More... | |
bool | add (int png_resource, const std::string &title, const std::vector< tray_menu_item > &items, const std::string &default_item, std::string &error) |
Add the system tray icon. More... | |
bool | change (int png_resource, const std::string &title, std::string &error) |
Change the tray icon. More... | |
void | remove () |
Remove the tray icon. More... | |
Tray icon class.
Adds a tray icon near the clock on the Windows taskbar. Useful for applications that are designed to start automatically in the background when the user signs into their profile.
liblec::lecui::tray_icon::tray_icon | ( | form & | fm | ) |
Constructor.
fm | A reference to the form to which the tray icon belongs. |
bool liblec::lecui::tray_icon::add | ( | int | png_resource, |
const std::string & | title, | ||
const std::vector< tray_menu_item > & | items, | ||
const std::string & | default_item, | ||
std::string & | error | ||
) |
Add the system tray icon.
png_resource | The PNG icon resource. |
title | The title of the tray icon; displayed when the mouse is hovered over the tray icon. |
items | The menu items displayed when the tray icon is right clicked, as defined in the tray_menu_item type. |
default_item | The label of the item whose action is to be invoked when the system tray icon is clicked (left click). If formatting is used for the actual label this does not have to be formatted as well because only the plain-text is compared. |
error | Error information. |
bool liblec::lecui::tray_icon::change | ( | int | png_resource, |
const std::string & | title, | ||
std::string & | error | ||
) |
Change the tray icon.
png_resource | The new PNG icon resource to use for the icon. |
title | The new title of the tray icon. Can be called any number of times after a tray icon is added through the add method. |
error | Error information. |
void liblec::lecui::tray_icon::remove | ( | ) |
Remove the tray icon.
If this method is never called explicitly it will be called automatically in the destructor. For this reason, the tray_icon object must persist for the lifetime of the app.