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
123 virtual void setTitle(const std::string& title) = 0;
124
130 virtual std::string title() const = 0;
131
138 virtual void setTooltip(const std::string& text) = 0;
139
143 virtual std::string tooltip() const = 0;
144
151 virtual void destroy() = 0;
152
156 virtual bool isDestroyed() const = 0;
157};
158
159} // namespace molybden
160
161#endif // MOLYBDEN_TRAY_HPP
A class that contains all tray events.
Definition tray_events.hpp:27
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 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.