Skip to main content

i_slint_core/items/system_tray/
dummy.rs

1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
3
4//! Fallback backend for builds without a real system tray (the `system-tray`
5//! feature is off, or Android, WASM, embedded targets, …). Handle creation
6//! fails with [`Error::Unsupported`], which the tray item reports through
7//! `debug_log`; the application keeps running without an icon.
8
9use super::{Error, Params};
10use crate::graphics::Image;
11use crate::item_tree::ItemWeak;
12use crate::items::MenuEntry;
13use crate::menus::MenuVTable;
14
15pub struct PlatformTray;
16
17impl PlatformTray {
18    pub fn new(
19        _params: Params,
20        _self_weak: ItemWeak,
21        _context: &crate::SlintContext,
22    ) -> Result<Self, Error> {
23        Err(Error::Unsupported)
24    }
25
26    pub fn rebuild_menu(
27        &self,
28        _menu: vtable::VRef<'_, MenuVTable>,
29        entries_out: &mut alloc::vec::Vec<MenuEntry>,
30    ) {
31        entries_out.clear();
32    }
33
34    pub fn set_visible(&self, _visible: bool) {}
35
36    pub fn set_icon(&self, _icon: &Image) {}
37
38    pub fn set_tooltip(&self, _tooltip: &str) {}
39
40    pub fn set_title(&self, _title: &str) {}
41}