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//! No-op fallback backend for platforms without a real system tray
5//! (Android, WASM, embedded targets, …). All operations succeed and do
6//! nothing visible — the tray icon simply never reaches a host shell.
7
8use super::{Error, Params};
9use crate::graphics::Image;
10use crate::item_tree::ItemWeak;
11use crate::items::MenuEntry;
12use crate::menus::MenuVTable;
13
14pub struct PlatformTray;
15
16impl PlatformTray {
17    pub fn new(
18        _params: Params,
19        _self_weak: ItemWeak,
20        _context: &crate::SlintContext,
21    ) -> Result<Self, Error> {
22        Ok(Self)
23    }
24
25    pub fn rebuild_menu(
26        &self,
27        _menu: vtable::VRef<'_, MenuVTable>,
28        entries_out: &mut alloc::vec::Vec<MenuEntry>,
29    ) {
30        entries_out.clear();
31    }
32
33    pub fn set_visible(&self, _visible: bool) {}
34
35    pub fn set_icon(&self, _icon: &Image) {}
36
37    pub fn set_tooltip(&self, _tooltip: &str) {}
38
39    pub fn set_title(&self, _title: &str) {}
40}