From d87ec139445de193b62c6386341854d5ceb2083f Mon Sep 17 00:00:00 2001
From: Jessica Hamilton <jessica.l.hamilton@gmail.com>
Date: Tue, 20 Aug 2013 14:34:47 +1200
Subject: [PATCH] BMenu: allow to top open disabled menus in a menubar. Fixes #6610.
---
src/kits/interface/Menu.cpp | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/kits/interface/Menu.cpp b/src/kits/interface/Menu.cpp
index 7374245..0c901b3
a
|
b
|
BMenu::_HitTestItems(BPoint where, BPoint slop) const
|
2528 | 2528 | int32 itemCount = CountItems(); |
2529 | 2529 | for (int32 i = 0; i < itemCount; i++) { |
2530 | 2530 | BMenuItem* item = ItemAt(i); |
2531 | | if (item->IsEnabled() && item->Frame().Contains(where)) |
| 2531 | |
| 2532 | // if a menu item isn't enabled but is in the menubar, then test |
| 2533 | // it anyway, so that top-opening disabled menu items succeeds |
| 2534 | if (item->Frame().Contains(where) |
| 2535 | && (item->IsEnabled() || dynamic_cast<const BMenuBar*>(this) |
| 2536 | != NULL)) { |
2532 | 2537 | return item; |
| 2538 | } |
2533 | 2539 | } |
2534 | 2540 | |
2535 | 2541 | return NULL; |
… |
… |
BMenu::_NextItem(BMenuItem* item, bool forward) const
|
2660 | 2666 | |
2661 | 2667 | // ... and return the first suitable item found. |
2662 | 2668 | BMenuItem* nextItem = ItemAt(index); |
2663 | | if (nextItem->IsEnabled()) |
| 2669 | if (nextItem->IsEnabled() |
| 2670 | || dynamic_cast<const BMenuBar*>(this) != NULL) { |
2664 | 2671 | return nextItem; |
| 2672 | } |
2665 | 2673 | } |
2666 | 2674 | |
2667 | 2675 | // If no other suitable item was found, return NULL. |