fluent-tray
Fluent Design-based GUI Library for System Tray Applications
|
Class with information on the entire tray. More...
#include <fluent_tray.hpp>
Public Member Functions | |
FluentTray (LONG menu_x_margin=5, LONG menu_y_margin=5, LONG menu_x_pad=10, LONG menu_y_pad=5, unsigned char autofadedborder_from_backcolor=10, int autocolorpick_offset=5, int message_id_offset=25) | |
Create tray object. | |
FluentTray (const FluentTray &)=delete | |
FluentTray & | operator= (const FluentTray &)=delete |
FluentTray (FluentTray &&)=default | |
FluentTray & | operator= (FluentTray &&)=default |
virtual | ~FluentTray () noexcept |
bool | create_tray (const std::string &app_name, const std::string &icon_path="", unsigned char opacity=255, bool round_corner=true) |
Initialize tray and create icon on tray. | |
bool | add_menu (const std::string &label_text="", const std::string &icon_path="", bool toggleable=false, const std::string &checkmark="✓", const std::function< bool(void)> &callback=[] {return true ;}, const std::function< bool(void)> &unchecked_callback=[] {return true ;}) |
Add a menu in order from the top. | |
void | add_separator () |
Add a separator line under the last menu item added. | |
bool | update () |
Get window message and update tray. | |
bool | update_with_loop (std::chrono::milliseconds sleep_time=std::chrono::milliseconds(1)) |
Create a message loop to update the tray. | |
HWND | window_handle () const noexcept |
Refer to the handle of menu window. | |
bool | show_menu_window () |
Show the menu window above the tray icon. | |
bool | hide_menu_window () |
Hide the menu window above the tray icon. | |
bool | show_balloon_tip (const std::string &title, const std::string &message) |
Shows a balloon tip that is placed in the notification area. | |
TrayStatus | status () const noexcept |
Get the current status of tray. | |
void | stop () noexcept |
Exit the tray successfully. | |
std::vector< FluentMenu >::iterator | begin () noexcept |
Returns an iterator to the beginning of menus. | |
std::vector< FluentMenu >::iterator | end () noexcept |
Returns an iterator to the end of menus. | |
std::vector< FluentMenu >::const_iterator | cbegin () const noexcept |
Returns a constant iterator to the beginning of menus. | |
std::vector< FluentMenu >::const_iterator | cend () const noexcept |
Returns a constant iterator to the end of menus. | |
FluentMenu & | front () |
Returns the reference to the beginning of menus. | |
const FluentMenu & | front () const |
Returns the const reference to the beginning of menus. | |
FluentMenu & | back () |
Returns the reference to the last of menus. | |
const FluentMenu & | back () const |
Returns the const reference to the last of menus. | |
std::size_t | count_menus () const noexcept |
Returns the number of menus. | |
bool | set_font (LONG font_size=0, LONG font_weight=0, const std::string &font_name="") |
Set font information to draw menus. | |
bool | set_color (COLORREF text_color=CLR_INVALID, COLORREF back_color=CLR_INVALID, COLORREF border_color=CLR_INVALID) |
Set colors to draw menus. | |
bool | change_icon (const std::string &icon_path) |
Load the image file and change the icon. | |
Class with information on the entire tray.
|
inlineexplicit |
Create tray object.
[in] | menu_x_margin | Horizontal margins outside menus. |
[in] | menu_y_margin | Vertical margins outside menus. |
[in] | menu_x_pad | Horizontal paddings inside menus. |
[in] | menu_y_pad | Vertical paddings inside menus. |
[in] | autofadedborder_from_backcolor | Decay value from the background color to determine the background color of the currently selected menu and the color of the separator line. |
[in] | autocolorpick_offset | Pixel offset to determine the background color. |
[in] | message_id_offset | Unique message identifier. |
|
delete |
|
default |
|
inlinevirtualnoexcept |
|
inline |
Add a menu in order from the top.
[in] | label_text | The UTF-8 encoded string of the button label. |
[in] | icon_path | An icon path to show next to the label. |
[in] | toggleable | Create a switchable menu |
[in] | checkmark | A checkmark string. |
[in] | callback | Function called when a click on the menu or a check is enabled. |
[in] | unchecked_callback | Function called when a check is disabled. |
|
inline |
Add a separator line under the last menu item added.
|
inline |
Returns the reference to the last of menus.
|
inline |
Returns the const reference to the last of menus.
|
inlinenoexcept |
Returns an iterator to the beginning of menus.
|
inlinenoexcept |
Returns a constant iterator to the beginning of menus.
|
inlinenoexcept |
Returns a constant iterator to the end of menus.
|
inline |
Load the image file and change the icon.
|
inlinenoexcept |
Returns the number of menus.
|
inline |
Initialize tray and create icon on tray.
[in] | app_name | The application name to be displayed as tooltip text. |
[in] | icon_path | A UTF-8 encoded path to the icon to be displayed in the system tray. |
[in] | opacity | Menu opacity from 0 to 255. |
[in] | round_corner | Option to round the corners of the menu window (Windows 11 only) |
|
inlinenoexcept |
Returns an iterator to the end of menus.
|
inline |
Returns the reference to the beginning of menus.
|
inline |
Returns the const reference to the beginning of menus.
|
inline |
Hide the menu window above the tray icon.
|
delete |
|
default |
|
inline |
Set colors to draw menus.
[in] | text_color | The color for label text. |
[in] | back_color | The color for background. |
[in] | border_color | The color for border. |
|
inline |
Set font information to draw menus.
[in] | font_size | The height of fonts. |
[in] | font_weight | The value from 0 to 1000 to determine font weight. |
[in] | font_name | The UTF-8 encoded font name for label rendering. |
For font_weight, you can use the constant value specified for lfWeght in LOGFONT. The default value used is FW_MEDIUM(500).
|
inline |
Shows a balloon tip that is placed in the notification area.
[in] | title | The UTF-8 string of title. |
[in] | message | The UTF-8 string of message. |
Titles longer than 48 characters and messages longer than 200 characters will be trimmed.
|
inline |
Show the menu window above the tray icon.
|
inlinenoexcept |
Get the current status of tray.
|
inlinenoexcept |
Exit the tray successfully.
|
inline |
Get window message and update tray.
|
inline |
Create a message loop to update the tray.
[in] | sleep_time |
|
inlinenoexcept |
Refer to the handle of menu window.