Making sure the left and right arrow navigation only fires when the menu bar

is active.
This commit is contained in:
hyatt%netscape.com 1999-07-19 09:36:24 +00:00
Родитель 53c8309019
Коммит 013af7626e
3 изменённых файлов: 16 добавлений и 2 удалений

Просмотреть файл

@ -149,7 +149,7 @@ nsMenuBarListener::MouseMove(nsIDOMEvent* aMouseEvent)
if (tag && (tag.get() == nsXULAtoms::xpmenu)) {
// We found a menu.
mMenuBarFrame->SetCurrentMenuItem(current);
break;
return NS_OK;
}
// Get our parent.
@ -253,7 +253,8 @@ nsMenuBarListener::KeyDown(nsIDOMEvent* aKeyEvent)
theChar == NS_VK_DOWN) {
// The arrow keys were pressed. User is moving around within
// the menus.
mMenuBarFrame->KeyboardNavigation(theChar);
if (mMenuBarFrame->IsActive())
mMenuBarFrame->KeyboardNavigation(theChar);
}
if (mMenuBarFrame->IsActive())

Просмотреть файл

@ -112,3 +112,12 @@ nsMenuFrame::DeleteFrame(nsIPresContext& aPresContext)
mPopupFrames.DeleteFrames(aPresContext);
return nsAreaFrame::DeleteFrame(aPresContext);
}
// Called to prevent events from going to anything inside the menu.
NS_IMETHODIMP
nsMenuFrame::GetFrameForPoint(const nsPoint& aPoint,
nsIFrame** aFrame)
{
*aFrame = this; // Capture all events so that we can perform selection
return NS_OK;
}

Просмотреть файл

@ -50,6 +50,10 @@ public:
nsIAtom** aListName) const;
NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext);
// Overridden to prevent events from ever going to children of the menu.
NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint,
nsIFrame** aFrame);
protected:
nsFrameList mPopupFrames;
}; // class nsMenuFrame