diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2016-01-11 18:17:49 +0200 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2016-01-11 23:30:53 +0000 |
commit | cbd483211e1ac9d9e724b5ba3e3e38a0c5abe55c (patch) | |
tree | 876db22c86fee55bb07b766b6c4803d295877e86 /vcl/inc/osx | |
parent | 2244b1e3863a6837dbc867c51940e52b6525de43 (diff) |
tdf#96875 Make OS X native context menus compatible
... with how framework::MenuBarManager works, following my
work of converting context menus to use it instead of
SfxPopupMenuManager (see tdf#93837).
MenuBarManager sets menu item properties/select handler
when the menu activates - in MenuBarManager::Activate, but
it was never called for submenus. The solution is to adapt
the menuNeedsUpdate delegate to call Menu::Activate.
This makes submenu items work, but doesn't update their
visual state (e.g. title). The reason is that
AquaSalMenu::ShowNativePopupMenu is creating a copy of the
NSMenu, so AquaSalMenu::SetItemText is modifying the wrong
NSMenu instance.
Another problem is that AquaSalMenu::ShowNativePopupMenu
tries to removes (via removeUnusedItemsRunner function)
all disabled items, but the correct state is set by
MenuBarManager only when the menu activates. So we must
handle disabled items only after MenuBarManager::Activate
did its job.
Turns out that we can just hide items in NSMenu instead
of removing them, so no need to clone the NSMenu anymore.
Change-Id: If0785b7f9d5f0ad98ced23585379039a51dc13bf
Reviewed-on: https://gerrit.libreoffice.org/21374
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Tested-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'vcl/inc/osx')
-rw-r--r-- | vcl/inc/osx/salnsmenu.h | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/vcl/inc/osx/salnsmenu.h b/vcl/inc/osx/salnsmenu.h index 47c410b6a35e..f815c14c006d 100644 --- a/vcl/inc/osx/salnsmenu.h +++ b/vcl/inc/osx/salnsmenu.h @@ -33,10 +33,6 @@ class AquaSalMenuItem; @interface SalNSMenu : NSMenu { - /* Caution: SalNSMenu instances occasionally are binary copied - in AquaSalMenu::ShowNativePopupMenu. If any members are added, - please take this into account ! - */ AquaSalMenu* mpMenu; } -(id)initWithMenu: (AquaSalMenu*)pMenu; @@ -46,10 +42,6 @@ class AquaSalMenuItem; @interface SalNSMenuItem : NSMenuItem { - /* Caution: SalNSMenuItem instances occasionally are binary copied - in AquaSalMenu::ShowNativePopupMenu. If any members are added, - please take this into account ! - */ AquaSalMenuItem* mpMenuItem; } -(id)initWithMenuItem: (AquaSalMenuItem*)pMenuItem; |