Mercurial > dwindows
changeset 2601:3201f9e9067b
iOS: Actually implement disabled menu items using UIMenuElementAttributesDisabled.
I added setEnabled method to the DWMenuItem class, but it previously just
stored the value and didn't actually disable or enable the items.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 11 Jul 2021 21:08:36 +0000 |
parents | 0bb974e70435 |
children | cc5013e626f7 |
files | ios/dw.m |
diffstat | 1 files changed, 3 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ios/dw.m Sun Jul 11 08:49:26 2021 +0000 +++ b/ios/dw.m Sun Jul 11 21:08:36 2021 +0000 @@ -1524,7 +1524,7 @@ /* Subclass for a menu item type */ @implementation DWMenuItem -(void)setCheck:(BOOL)input { check = input; } --(void)setEnabled:(BOOL)input { enabled = input; } +-(void)setEnabled:(BOOL)input { enabled = input; [self setAttributes:(enabled ? 0 : UIMenuElementAttributesDisabled)]; } -(void)setSubmenu:(DWMenu *)input { submenu = input; } -(void)setMenu:(DWMenu *)input { menu = input; } -(void)setTag:(unsigned long)input { tag = input; } @@ -7620,7 +7620,8 @@ item = [[DWMenuItem commandWithTitle:nstr image:nil action:@selector(menuHandler:) propertyList:nil] autorelease]; - [item setTag:itemid]; + if(itemid != DW_MENU_AUTO && itemid != DW_MENU_POPUP) + [item setTag:itemid]; [menu addItem:item]; if(check) @@ -7710,7 +7711,6 @@ { [menuitem setState:UIMenuElementStateOff]; } -#if 0 /* TODO: Disabled items not supported on iOS */ if(state & DW_MIS_ENABLED) { [menuitem setEnabled:YES]; @@ -7719,7 +7719,6 @@ { [menuitem setEnabled:NO]; } -#endif } } @@ -8197,7 +8196,6 @@ else if(style & DW_MIS_UNCHECKED) [menuitem setState:UIMenuElementStateOff]; } -#if 0 /* Disabled menu items not available on iOS currently */ if(mask & (DW_MIS_ENABLED | DW_MIS_DISABLED)) { if(style & DW_MIS_ENABLED) @@ -8205,7 +8203,6 @@ else if(style & DW_MIS_DISABLED) [menuitem setEnabled:NO]; } -#endif } DW_FUNCTION_RETURN_NOTHING; }