Skip to content

Commit c8d3b8f

Browse files
authoredAug 8, 2024··
Add dummy menu for the web platform (#7)
* Add dummy menu for the web platform * Bump web-time version
1 parent 08a3dfc commit c8d3b8f

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed
 

‎Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ atomic-waker = "1"
212212
js-sys = "0.3.64"
213213
wasm-bindgen = "0.2"
214214
wasm-bindgen-futures = "0.4"
215-
web-time = "0.2"
215+
web-time = "1"
216216

217217
[target.'cfg(target_family = "wasm")'.dev-dependencies]
218218
console_log = "1"

‎src/platform_impl/web/menu.rs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/// Dummy menu: there is no generic menu for web applications
2+
pub struct Menu;
3+
4+
impl Menu {
5+
pub fn new() -> Menu {
6+
Menu
7+
}
8+
9+
pub fn new_for_popup() -> Menu {
10+
Menu
11+
}
12+
13+
pub fn add_dropdown(&mut self, _menu: Menu, _text: &str, _enabled: bool) {}
14+
15+
pub fn add_item(&mut self, _id: u32, _text: &str, _selected: Option<bool>, _enabled: bool) {}
16+
17+
pub fn add_separator(&mut self) {}
18+
}

‎src/platform_impl/web/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ mod device;
2222
mod error;
2323
mod event_loop;
2424
mod keyboard;
25+
mod menu;
2526
mod monitor;
2627
mod window;
2728

@@ -33,6 +34,7 @@ pub use self::error::OsError;
3334
pub(crate) use self::event_loop::{
3435
EventLoop, EventLoopProxy, EventLoopWindowTarget, PlatformSpecificEventLoopAttributes,
3536
};
37+
pub(crate) use self::menu::Menu;
3638
pub use self::monitor::{MonitorHandle, VideoMode};
3739
pub use self::window::{PlatformSpecificWindowBuilderAttributes, Window, WindowId};
3840

0 commit comments

Comments
 (0)
Please sign in to comment.