Skip to content

Commit

Permalink
Update doc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Ngo Iok Ui committed May 6, 2021
1 parent 34c5833 commit 3915f2b
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 56 deletions.
45 changes: 20 additions & 25 deletions src/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ pub struct CustomMenu {
pub keyboard_accelerators: Option<&'static str>,
}

/// A menu item, binded to a pre-defined action or `Custom` emit an event.
/// A menu item, bound to a pre-defined action or `Custom` emit an event. Unsupported variant will
/// be no-op on such platform.
#[derive(Debug, Clone, Copy)]
pub enum MenuItem {
/// A custom menu emit an event inside the EventLoop.
Expand All @@ -36,143 +37,137 @@ pub enum MenuItem {
///
/// ## Platform-specific
///
/// - **Windows / Linux / Android / iOS:** Unsupported (noop).
/// - **Windows / Android / iOS:** Unsupported
///
About(&'static str),

/// A standard "hide the app" menu item.
///
/// ## Platform-specific
///
/// - **Windows / Linux / Android / iOS:** Unsupported (noop).
/// - **Windows / Android / iOS:** Unsupported
///
Hide,

/// A standard "Services" menu item.
/// TODO Move to platform trait
///
/// ## Platform-specific
///
/// - **Windows / Linux / Android / iOS:** Unsupported (noop).
/// - **Windows / Linux / Android / iOS:** Unsupported
///
Services,

/// A "hide all other windows" menu item.
/// TODO Move to platform trait
///
/// ## Platform-specific
///
/// - **Windows / Linux / Android / iOS:** Unsupported (noop).
/// - **Windows / Linux / Android / iOS:** Unsupported
///
HideOthers,

/// A menu item to show all the windows for this app.
/// TODO Move to platform trait
///
/// ## Platform-specific
///
/// - **Windows / Linux / Android / iOS:** Unsupported (noop).
/// - **Windows / Linux / Android / iOS:** Unsupported
///
ShowAll,

/// Close the current window.
///
/// ## Platform-specific
///
/// - **Windows / Linux / Android / iOS:** Unsupported (noop).
/// - **Windows / Android / iOS:** Unsupported
///
CloseWindow,

/// A "quit this app" menu icon.
///
/// ## Platform-specific
///
/// - **Windows / Linux / Android / iOS:** Unsupported (noop).
/// - **Windows / Android / iOS:** Unsupported
///
Quit,

/// A menu item for enabling copying (often text) from responders.
///
/// ## Platform-specific
///
/// - **Windows / Linux / Android / iOS:** Unsupported (noop).
/// - **Windows / Android / iOS:** Unsupported
///
Copy,

/// A menu item for enabling cutting (often text) from responders.
///
/// ## Platform-specific
///
/// - **Windows / Linux / Android / iOS:** Unsupported (noop).
/// - **Windows / Android / iOS:** Unsupported
///
Cut,

/// An "undo" menu item; particularly useful for supporting the cut/copy/paste/undo lifecycle
/// of events.
/// TODO Move to platform trait
///
/// ## Platform-specific
///
/// - **Windows / Linux / Android / iOS:** Unsupported (noop).
/// - **Windows / Linux / Android / iOS:** Unsupported
///
Undo,

/// An "redo" menu item; particularly useful for supporting the cut/copy/paste/undo lifecycle
/// of events.
/// TODO Move to platform trait
///
/// ## Platform-specific
///
/// - **Windows / Linux / Android / iOS:** Unsupported (noop).
/// - **Windows / Linux / Android / iOS:** Unsupported
///
Redo,

/// A menu item for selecting all (often text) from responders.
///
/// ## Platform-specific
///
/// - **Windows / Linux / Android / iOS:** Unsupported (noop).
/// - **Windows / Android / iOS:** Unsupported
///
SelectAll,

/// A menu item for pasting (often text) into responders.
///
/// ## Platform-specific
///
/// - **Windows / Linux / Android / iOS:** Unsupported (noop).
/// - **Windows / Android / iOS:** Unsupported
///
Paste,

/// A standard "enter full screen" item.
///
/// ## Platform-specific
///
/// - **Windows / Linux / Android / iOS:** Unsupported (noop).
/// - **Windows / Linux / Android / iOS:** Unsupported
///
EnterFullScreen,

/// An item for minimizing the window with the standard system controls.
///
/// ## Platform-specific
///
/// - **Windows / Linux / Android / iOS:** Unsupported (noop).
/// - **Windows / Android / iOS:** Unsupported
///
Minimize,

/// An item for instructing the app to zoom
/// TODO Move to platform trait
///
/// ## Platform-specific
///
/// - **Windows / Linux / Android / iOS:** Unsupported (noop).
/// - **Windows / Linux / Android / iOS:** Unsupported
///
Zoom,

/// Represents a Separator
///
/// ## Platform-specific
///
/// - **Windows / Linux / Android / iOS:** Unsupported (noop).
/// - **Windows / Android / iOS:** Unsupported
///
Separator,
}
Expand All @@ -192,7 +187,7 @@ impl MenuItem {
///
/// ## Platform-specific
///
/// - **Windows / Linux / Android / iOS:** Unsupported (noop).
/// - **Windows / Android / iOS:** Unsupported
///
pub fn with_accelerators(mut self, keyboard_accelerators: &'static str) -> Self {
if let MenuItem::Custom(ref mut custom_menu) = self {
Expand Down
6 changes: 0 additions & 6 deletions src/platform_impl/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,12 +495,6 @@ impl Window {

pub fn set_title(&self, _title: &str) {}

/// Set menu
///
/// ## Platform-specific
///
/// - **Windows / Linux / Android / iOS:** Unsupported (noop).
///
pub fn set_menu(&self, _menu: Option<Vec<Menu>>) {}

pub fn set_visible(&self, _visibility: bool) {}
Expand Down
6 changes: 0 additions & 6 deletions src/platform_impl/ios/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ impl Inner {
debug!("`Window::set_title` is ignored on iOS")
}

/// Set menu
///
/// ## Platform-specific
///
/// - **Windows / Linux / Android / iOS:** Unsupported (noop).
///
pub fn set_menu(&self, _menu: Option<Vec<Menu>>) {
debug!("`Window::set_menu` is ignored on iOS")
}
Expand Down
7 changes: 1 addition & 6 deletions src/platform_impl/linux/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,12 +410,7 @@ impl Window {
}
}

/// Set menu
///
/// ## Platform-specific
///
/// - **Windows / Linux / Android / iOS:** Unsupported (noop).
///
// TODO
pub fn set_menu(&self, _menu: Option<Vec<Menu>>) {
debug!("`Window::set_menu` is ignored on linux")
}
Expand Down
6 changes: 0 additions & 6 deletions src/platform_impl/macos/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,12 +440,6 @@ impl UnownedWindow {
}
}

/// Set menu
///
/// ## Platform-specific
///
/// - **Windows / Linux / Android / iOS:** Unsupported (noop).
///
pub fn set_menu(&self, menu: Option<Vec<Menu>>) {
unsafe {
util::set_menu_async(*self.ns_window, menu);
Expand Down
8 changes: 1 addition & 7 deletions src/platform_impl/windows/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,7 @@ impl Window {
}
}

/// Set menu
///
/// ## Platform-specific
///
/// - **Windows / Linux / Android / iOS:** Unsupported (noop).
///
// todo(lemarier): allow menu update
// TODO (lemarier): allow menu update
pub fn set_menu(&self, _new_menu: Option<Vec<Menu>>) {}

#[inline]
Expand Down

0 comments on commit 3915f2b

Please sign in to comment.