Skip to content

Commit

Permalink
Add dummy menu for the web platform (#7)
Browse files Browse the repository at this point in the history
* Add dummy menu for the web platform

* Bump web-time version
  • Loading branch information
timsueberkrueb authored Aug 8, 2024
1 parent 08a3dfc commit c8d3b8f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ atomic-waker = "1"
js-sys = "0.3.64"
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
web-time = "0.2"
web-time = "1"

[target.'cfg(target_family = "wasm")'.dev-dependencies]
console_log = "1"
Expand Down
18 changes: 18 additions & 0 deletions src/platform_impl/web/menu.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/// Dummy menu: there is no generic menu for web applications
pub struct Menu;

impl Menu {
pub fn new() -> Menu {
Menu
}

pub fn new_for_popup() -> Menu {
Menu
}

pub fn add_dropdown(&mut self, _menu: Menu, _text: &str, _enabled: bool) {}

pub fn add_item(&mut self, _id: u32, _text: &str, _selected: Option<bool>, _enabled: bool) {}

pub fn add_separator(&mut self) {}
}
2 changes: 2 additions & 0 deletions src/platform_impl/web/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ mod device;
mod error;
mod event_loop;
mod keyboard;
mod menu;
mod monitor;
mod window;

Expand All @@ -33,6 +34,7 @@ pub use self::error::OsError;
pub(crate) use self::event_loop::{
EventLoop, EventLoopProxy, EventLoopWindowTarget, PlatformSpecificEventLoopAttributes,
};
pub(crate) use self::menu::Menu;
pub use self::monitor::{MonitorHandle, VideoMode};
pub use self::window::{PlatformSpecificWindowBuilderAttributes, Window, WindowId};

Expand Down

0 comments on commit c8d3b8f

Please sign in to comment.