Molybden API
Loading...
Searching...
No Matches
tray.hpp
1// Copyright (c) 2000-2023 TeamDev Ltd. 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#include "molybden/ui/bitmap.hpp"
13
14namespace molybden {
15
16class App;
17class CustomMenu;
18
26class Tray : public TrayEvents {
27 public:
36 static std::shared_ptr<Tray> create(std::shared_ptr<App> app);
37
41 virtual std::shared_ptr<App> app() = 0;
42
92 virtual void setImage(const std::string& file_path) = 0;
93
99 virtual void setMenu(std::shared_ptr<CustomMenu> menu) = 0;
100
106 virtual void setTitle(const std::string& title) = 0;
107
111 virtual std::string title() const = 0;
112
119 virtual void setTooltip(const std::string& text) = 0;
120
124 virtual std::string tooltip() const = 0;
125
132 virtual void destroy() = 0;
133
137 virtual bool isDestroyed() const = 0;
138};
139
140} // namespace molybden
141
142#endif // MOLYBDEN_TRAY_HPP
A class that contains all tray events.
Definition tray_events.hpp:27
A system tray item.
Definition tray.hpp:26
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 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.