Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/items/predefined.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ impl PredefinedMenuItem {
///
/// ## Platform-specific:
///
/// - **Windows / Linux:** Unsupported.
/// - **Linux:** Unsupported.
pub fn undo(text: Option<&str>) -> PredefinedMenuItem {
PredefinedMenuItem::new(PredefinedMenuItemType::Undo, text)
}
/// Redo menu item
///
/// ## Platform-specific:
///
/// - **Windows / Linux:** Unsupported.
/// - **Linux:** Unsupported.
pub fn redo(text: Option<&str>) -> PredefinedMenuItem {
PredefinedMenuItem::new(PredefinedMenuItemType::Redo, text)
}
Expand Down
6 changes: 6 additions & 0 deletions src/platform_impl/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,8 @@ unsafe fn menu_selected(hwnd: windows_sys::Win32::Foundation::HWND, item: &mut M
PredefinedMenuItemType::SelectAll => {
execute_edit_command(EditCommand::SelectAll)
}
PredefinedMenuItemType::Undo => execute_edit_command(EditCommand::Undo),
PredefinedMenuItemType::Redo => execute_edit_command(EditCommand::Redo),
PredefinedMenuItemType::Separator => {}
PredefinedMenuItemType::Minimize => {
ShowWindow(hwnd, SW_MINIMIZE);
Expand Down Expand Up @@ -1253,6 +1255,8 @@ enum EditCommand {
Cut,
Paste,
SelectAll,
Undo,
Redo,
}

fn execute_edit_command(command: EditCommand) {
Expand All @@ -1261,6 +1265,8 @@ fn execute_edit_command(command: EditCommand) {
EditCommand::Cut => 0x58, // x
EditCommand::Paste => 0x56, // v
EditCommand::SelectAll => 0x41, // a
EditCommand::Undo => 0x5A, // z
EditCommand::Redo => 0x59, // y
};

unsafe {
Expand Down
Loading