Ticket #6610: 0001-BMenu-allow-to-top-open-disabled-menus-in-a-menubar..patch

File 0001-BMenu-allow-to-top-open-disabled-menus-in-a-menubar..patch, 1.4 KB (added by jessicah, 11 years ago)
  • src/kits/interface/Menu.cpp

    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  
    25282528    int32 itemCount = CountItems();
    25292529    for (int32 i = 0; i < itemCount; i++) {
    25302530        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)) {
    25322537            return item;
     2538        }
    25332539    }
    25342540
    25352541    return NULL;
    BMenu::_NextItem(BMenuItem* item, bool forward) const  
    26602666
    26612667        // ... and return the first suitable item found.
    26622668        BMenuItem* nextItem = ItemAt(index);
    2663         if (nextItem->IsEnabled())
     2669        if (nextItem->IsEnabled()
     2670            || dynamic_cast<const BMenuBar*>(this) != NULL) {
    26642671            return nextItem;
     2672        }
    26652673    }
    26662674
    26672675    // If no other suitable item was found, return NULL.