changeset 2603:592f3003f853

iOS: Switch to using UIKeyCommand for menu items so we can use they keyboard accelerators if there is a hardware keyboard. Also add "..." to submenus.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 12 Jul 2021 21:51:12 +0000
parents cc5013e626f7
children 4671ac4ad3c6
files ios/dw.m
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ios/dw.m	Sun Jul 11 21:41:44 2021 +0000
+++ b/ios/dw.m	Mon Jul 12 21:51:12 2021 +0000
@@ -656,7 +656,7 @@
 @end
 
 API_AVAILABLE(ios(13.0))
-@interface DWMenuItem : UICommand
+@interface DWMenuItem : UIKeyCommand
 {
     BOOL check, enabled;
     unsigned long tag;
@@ -1572,7 +1572,10 @@
         }
     }
     if(title)
-        menu = [UIMenu menuWithTitle:title children:menuchildren];
+    {
+        menu = [UIMenu menuWithTitle:title image:[UIImage systemImageNamed:@"ellipsis"] identifier:nil
+                             options:0  children:menuchildren];
+    }
     else
     {
         if(@available(iOS 14.0, *))
@@ -7619,6 +7622,8 @@
 
         item = [[DWMenuItem commandWithTitle:nstr image:nil
                                       action:@selector(menuHandler:)
+                                       input:[NSString stringWithUTF8String:accel]
+                               modifierFlags:UIKeyModifierCommand
                                 propertyList:nil] autorelease];
         /* Don't set the tag if the ID is 0 or -1 */
         if(itemid != DW_MENU_AUTO && itemid != DW_MENU_POPUP)