diff --git a/layout/xul/base/src/nsMenuBarFrame.cpp b/layout/xul/base/src/nsMenuBarFrame.cpp index 39751ebb94ea..8229b91d5f5d 100644 --- a/layout/xul/base/src/nsMenuBarFrame.cpp +++ b/layout/xul/base/src/nsMenuBarFrame.cpp @@ -56,3 +56,16 @@ nsMenuBarFrame::nsMenuBarFrame() } // cntr +NS_IMETHODIMP +nsMenuBarFrame::Init(nsIPresContext& aPresContext, + nsIContent* aContent, + nsIFrame* aParent, + nsIStyleContext* aContext, + nsIFrame* aPrevInFlow) +{ + nsresult rv = nsBoxFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow); + + // Create the menu bar listener. + mMenuBarListener = new nsMenuBarListener(this); + return rv; +} diff --git a/layout/xul/base/src/nsMenuBarFrame.h b/layout/xul/base/src/nsMenuBarFrame.h index 05bf19b5eab2..1c6af4141141 100644 --- a/layout/xul/base/src/nsMenuBarFrame.h +++ b/layout/xul/base/src/nsMenuBarFrame.h @@ -29,7 +29,7 @@ #include "nsToolbarFrame.h" -class nsMenuBarListener; +#include "nsMenuBarListener.h" nsresult NS_NewMenuBarFrame(nsIFrame** aResult) ; @@ -38,6 +38,12 @@ class nsMenuBarFrame : public nsToolbarFrame public: nsMenuBarFrame(); + NS_IMETHOD Init(nsIPresContext& aPresContext, + nsIContent* aContent, + nsIFrame* aParent, + nsIStyleContext* aContext, + nsIFrame* aPrevInFlow); + protected: nsMenuBarListener* mMenuBarListener; }; // class nsMenuBarFrame diff --git a/layout/xul/base/src/nsMenuBarListener.cpp b/layout/xul/base/src/nsMenuBarListener.cpp index bd1860ad0f64..36810385cf4e 100644 --- a/layout/xul/base/src/nsMenuBarListener.cpp +++ b/layout/xul/base/src/nsMenuBarListener.cpp @@ -49,9 +49,10 @@ NS_IMPL_RELEASE(nsMenuBarListener) //////////////////////////////////////////////////////////////////////// -nsMenuBarListener::nsMenuBarListener() +nsMenuBarListener::nsMenuBarListener(nsMenuBarFrame* aMenuBar) { NS_INIT_REFCNT(); + mMenuBarFrame = aMenuBar; } //////////////////////////////////////////////////////////////////////// @@ -134,6 +135,12 @@ nsMenuBarListener::MouseMove(nsIDOMEvent* aMouseEvent) return NS_OK; // means I am NOT consuming event } +//////////////////////////////////////////////////////////////////////// +nsresult +nsMenuBarListener::DragMove(nsIDOMEvent* aMouseEvent) +{ + return NS_OK; // means I am NOT consuming event +} //////////////////////////////////////////////////////////////////////// nsresult @@ -193,7 +200,7 @@ nsMenuBarListener::KeyDown(nsIDOMEvent* aMouseEvent) //////////////////////////////////////////////////////////////////////// nsresult -nsMenuBarListener::KeyPressed(nsIDOMEvent* aMouseEvent) +nsMenuBarListener::KeyPress(nsIDOMEvent* aMouseEvent) { return NS_OK; // means I am NOT consuming event } diff --git a/layout/xul/base/src/nsMenuBarListener.h b/layout/xul/base/src/nsMenuBarListener.h index a5c834862316..eb569f8b0499 100644 --- a/layout/xul/base/src/nsMenuBarListener.h +++ b/layout/xul/base/src/nsMenuBarListener.h @@ -35,13 +35,14 @@ class nsMenuBarListener : public nsIDOMKeyListener, public nsIDOMMouseListener, public: /** default constructor */ - nsMenuBarListener(); + nsMenuBarListener(nsMenuBarFrame* aMenuBar); /** default destructor */ virtual ~nsMenuBarListener(); virtual nsresult HandleEvent(nsIDOMEvent* aEvent); virtual nsresult MouseMove(nsIDOMEvent* aMouseEvent); + virtual nsresult DragMove(nsIDOMEvent* aMouseEvent); virtual nsresult MouseDown(nsIDOMEvent* aMouseEvent); virtual nsresult MouseUp(nsIDOMEvent* aMouseEvent); virtual nsresult MouseClick(nsIDOMEvent* aMouseEvent); @@ -50,11 +51,12 @@ public: virtual nsresult MouseOut(nsIDOMEvent* aMouseEvent); virtual nsresult KeyUp(nsIDOMEvent* aMouseEvent); virtual nsresult KeyDown(nsIDOMEvent* aMouseEvent); - virtual nsresult KeyPressed(nsIDOMEvent* aMouseEvent); + virtual nsresult KeyPress(nsIDOMEvent* aMouseEvent); NS_DECL_ISUPPORTS protected: + nsMenuBarFrame* mMenuBarFrame; };