Molybden API
Loading...
Searching...
No Matches
tray.hpp
1// Copyright (c) 2000-2024 TeamDev. All rights reserved.
2// TeamDev PROPRIETARY and CONFIDENTIAL.
3// Use is subject to license terms.
4
5#ifndef MOLYBDEN_TRAY_HPP
6#define MOLYBDEN_TRAY_HPP
7
8#include <memory>
9#include <string>
10
11#include "molybden/tray/tray_events.hpp"
12
13namespace molybden {
14
15class App;
16class CustomMenu;
17
28class Tray : public TrayEvents {
29 public:
39 static std::shared_ptr<Tray> create(std::shared_ptr<App> app);
40
44 virtual std::shared_ptr<App> app() = 0;
45
96 virtual void setImage(const std::string& file_path) = 0;
97
112 virtual void setMenu(std::shared_ptr<CustomMenu> menu) = 0;
113
122 virtual void openMenu(std::shared_ptr<CustomMenu> menu) = 0;
123
133 virtual void setTitle(const std::string& title) = 0;
134
140 virtual std::string title() const = 0;
141
148 virtual void setTooltip(const std::string& text) = 0;
149
153 virtual std::string tooltip() const = 0;
154
161 virtual void destroy() = 0;
162
166 virtual bool isDestroyed() const = 0;
167};
168
169} // namespace molybden
170
171#endif // MOLYBDEN_TRAY_HPP
A class that contains all tray events.
Definition tray_events.hpp:39
A system tray item.
Definition tray.hpp:28
static std::shared_ptr< Tray > create(std::shared_ptr< App > app)
Creates a new tray item for the given application and displays it in the system tray on macOS or noti...
virtual void setTitle(const std::string &title)=0
Sets the tray title.
virtual std::shared_ptr< App > app()=0
Returns the application instance for this tray.
virtual bool isDestroyed() const =0
Indicates whether the tray item is destroyed.
virtual void setImage(const std::string &file_path)=0
Sets the tray image from the given absolute image file path.
virtual void openMenu(std::shared_ptr< CustomMenu > menu)=0
Opens the pull-down menu of the tray item.
virtual std::string tooltip() const =0
Returns the tray tooltip text.
virtual void setTooltip(const std::string &text)=0
Sets the tray tooltip text.
virtual void destroy()=0
Destroys the tray.
virtual std::string title() const =0
Returns the tray title.
virtual void setMenu(std::shared_ptr< CustomMenu > menu)=0
Sets the pull-down menu displayed when the user clicks the tray icon.