lecui 1.0.0-alpha.20
lecui C++ user interface library
Public Member Functions | List of all members
liblec::lecui::tray_icon Class Reference

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ tray_icon()

liblec::lecui::tray_icon::tray_icon ( form fm)

Constructor.

Parameters
fmA reference to the form to which the tray icon belongs.

Member Function Documentation

◆ add()

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.

Parameters
png_resourceThe PNG icon resource.
titleThe title of the tray icon; displayed when the mouse is hovered over the tray icon.
itemsThe menu items displayed when the tray icon is right clicked, as defined in the tray_menu_item type.
default_itemThe 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.
errorError information.
Returns
Returns true if the icon is added successfully, else false.

◆ change()

bool liblec::lecui::tray_icon::change ( int  png_resource,
const std::string &  title,
std::string &  error 
)

Change the tray icon.

Parameters
png_resourceThe new PNG icon resource to use for the icon.
titleThe new title of the tray icon. Can be called any number of times after a tray icon is added through the add method.
errorError information.
Returns
Returns true if the icon is changed successfully, else false.

◆ remove()

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.


The documentation for this class was generated from the following file: