Adding the capability to distinguish menus from menu items.
git-svn-id: svn://10.0.0.236/trunk@40816 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -207,7 +207,8 @@ nsMenuBarFrame::GetNextMenuItem(nsIFrame* aStart, nsIFrame** aResult)
|
||||
// See if it's a menu item.
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
current->GetTag(*getter_AddRefs(tag));
|
||||
if (tag.get() == nsXULAtoms::xpmenu) {
|
||||
if (tag.get() == nsXULAtoms::xpmenu ||
|
||||
tag.get() == nsXULAtoms::xpmenuitem) {
|
||||
*aResult = currFrame;
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -224,7 +225,8 @@ nsMenuBarFrame::GetNextMenuItem(nsIFrame* aStart, nsIFrame** aResult)
|
||||
// See if it's a menu item.
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
current->GetTag(*getter_AddRefs(tag));
|
||||
if (tag.get() == nsXULAtoms::xpmenu) {
|
||||
if (tag.get() == nsXULAtoms::xpmenu ||
|
||||
tag.get() == nsXULAtoms::xpmenuitem) {
|
||||
*aResult = currFrame;
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -255,7 +257,8 @@ nsMenuBarFrame::GetPreviousMenuItem(nsIFrame* aStart, nsIFrame** aResult)
|
||||
// See if it's a menu item.
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
current->GetTag(*getter_AddRefs(tag));
|
||||
if (tag.get() == nsXULAtoms::xpmenu) {
|
||||
if (tag.get() == nsXULAtoms::xpmenu ||
|
||||
tag.get() == nsXULAtoms::xpmenuitem) {
|
||||
*aResult = currFrame;
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -272,7 +275,8 @@ nsMenuBarFrame::GetPreviousMenuItem(nsIFrame* aStart, nsIFrame** aResult)
|
||||
// See if it's a menu item.
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
current->GetTag(*getter_AddRefs(tag));
|
||||
if (tag.get() == nsXULAtoms::xpmenu) {
|
||||
if (tag.get() == nsXULAtoms::xpmenu ||
|
||||
tag.get() == nsXULAtoms::xpmenuitem) {
|
||||
*aResult = currFrame;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
// Wrapper for creating a new menu popup container
|
||||
//
|
||||
nsresult
|
||||
NS_NewMenuFrame(nsIFrame** aNewFrame)
|
||||
NS_NewMenuFrame(nsIFrame** aNewFrame, PRInt32 aFlags)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
@@ -48,6 +48,8 @@ NS_NewMenuFrame(nsIFrame** aNewFrame)
|
||||
if ( !it )
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
*aNewFrame = it;
|
||||
if (aFlags)
|
||||
it->SetIsMenu(PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -76,7 +78,7 @@ NS_IMETHODIMP nsMenuFrame::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
// nsMenuFrame cntr
|
||||
//
|
||||
nsMenuFrame::nsMenuFrame()
|
||||
:mMenuOpen(PR_FALSE),mMenuParent(nsnull)
|
||||
:mMenuOpen(PR_FALSE), mIsMenu(PR_FALSE), mMenuParent(nsnull)
|
||||
{
|
||||
|
||||
} // cntr
|
||||
@@ -234,6 +236,9 @@ nsMenuFrame::SelectMenu(PRBool aActivateFlag)
|
||||
void
|
||||
nsMenuFrame::OpenMenu(PRBool aActivateFlag)
|
||||
{
|
||||
if (!mIsMenu)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIContent> child;
|
||||
GetMenuChildrenElement(getter_AddRefs(child));
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "nsFrameList.h"
|
||||
#include "nsIMenuParent.h"
|
||||
|
||||
nsresult NS_NewMenuFrame(nsIFrame** aResult) ;
|
||||
nsresult NS_NewMenuFrame(nsIFrame** aResult, PRInt32 aFlags) ;
|
||||
|
||||
class nsMenuBarFrame;
|
||||
class nsMenuPopupFrame;
|
||||
@@ -86,12 +86,14 @@ public:
|
||||
void SelectFirstItem();
|
||||
|
||||
PRBool IsOpen() { return mMenuOpen; };
|
||||
void SetIsMenu(PRBool aIsMenu) { mIsMenu = aIsMenu; };
|
||||
|
||||
protected:
|
||||
void GetMenuChildrenElement(nsIContent** aResult);
|
||||
|
||||
protected:
|
||||
nsFrameList mPopupFrames;
|
||||
PRBool mIsMenu; // Whether or not we can even have children or not.
|
||||
PRBool mMenuOpen;
|
||||
nsIMenuParent* mMenuParent; // Our parent menu.
|
||||
}; // class nsMenuFrame
|
||||
|
||||
@@ -235,7 +235,8 @@ nsMenuPopupFrame::GetNextMenuItem(nsIFrame* aStart, nsIFrame** aResult)
|
||||
// See if it's a menu item.
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
current->GetTag(*getter_AddRefs(tag));
|
||||
if (tag.get() == nsXULAtoms::xpmenu) {
|
||||
if (tag.get() == nsXULAtoms::xpmenu ||
|
||||
tag.get() == nsXULAtoms::xpmenuitem) {
|
||||
*aResult = currFrame;
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -252,7 +253,8 @@ nsMenuPopupFrame::GetNextMenuItem(nsIFrame* aStart, nsIFrame** aResult)
|
||||
// See if it's a menu item.
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
current->GetTag(*getter_AddRefs(tag));
|
||||
if (tag.get() == nsXULAtoms::xpmenu) {
|
||||
if (tag.get() == nsXULAtoms::xpmenu ||
|
||||
tag.get() == nsXULAtoms::xpmenuitem) {
|
||||
*aResult = currFrame;
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -283,7 +285,8 @@ nsMenuPopupFrame::GetPreviousMenuItem(nsIFrame* aStart, nsIFrame** aResult)
|
||||
// See if it's a menu item.
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
current->GetTag(*getter_AddRefs(tag));
|
||||
if (tag.get() == nsXULAtoms::xpmenu) {
|
||||
if (tag.get() == nsXULAtoms::xpmenu ||
|
||||
tag.get() == nsXULAtoms::xpmenuitem) {
|
||||
*aResult = currFrame;
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -300,7 +303,8 @@ nsMenuPopupFrame::GetPreviousMenuItem(nsIFrame* aStart, nsIFrame** aResult)
|
||||
// See if it's a menu item.
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
current->GetTag(*getter_AddRefs(tag));
|
||||
if (tag.get() == nsXULAtoms::xpmenu) {
|
||||
if (tag.get() == nsXULAtoms::xpmenu ||
|
||||
tag.get() == nsXULAtoms::xpmenuitem) {
|
||||
*aResult = currFrame;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user