NS_IMETHODIMP nsPopupBoxObject::GetTriggerNode(nsIDOMNode** aTriggerNode) { *aTriggerNode = nsnull; nsMenuPopupFrame *menuPopupFrame = GetMenuPopupFrame(); while (menuPopupFrame) { nsIContent* triggerContent = menuPopupFrame->GetTriggerContent(); if (triggerContent) { CallQueryInterface(triggerContent, aTriggerNode); break; } // check up the menu hierarchy until a popup with a trigger node is found nsMenuFrame* menuFrame = menuPopupFrame->GetParentMenu(); if (!menuFrame) break; nsMenuParent* parentPopup = menuFrame->GetMenuParent(); if (!parentPopup || !parentPopup->IsMenu()) break; menuPopupFrame = static_cast<nsMenuPopupFrame *>(parentPopup); } return NS_OK; }
NS_IMETHODIMP nsPopupBoxObject::GetPopupState(nsAString& aState) { // set this here in case there's no frame for the popup aState.AssignLiteral("closed"); nsMenuPopupFrame *menuPopupFrame = GetMenuPopupFrame(); if (menuPopupFrame) { switch (menuPopupFrame->PopupState()) { case ePopupShowing: case ePopupOpen: aState.AssignLiteral("showing"); break; case ePopupOpenAndVisible: aState.AssignLiteral("open"); break; case ePopupHiding: case ePopupInvisible: aState.AssignLiteral("hiding"); break; case ePopupClosed: break; default: NS_NOTREACHED("Bad popup state"); break; } } return NS_OK; }
NS_IMETHODIMP nsPopupBoxObject::SetConsumeRollupEvent(PRUint32 aConsume) { nsMenuPopupFrame *menuPopupFrame = GetMenuPopupFrame(); if (menuPopupFrame) { menuPopupFrame->SetConsumeRollupEvent(aConsume); } return NS_OK; }
NS_IMETHODIMP nsPopupBoxObject::SetAutoPosition(PRBool aShouldAutoPosition) { nsMenuPopupFrame *menuPopupFrame = GetMenuPopupFrame(); if (menuPopupFrame) { menuPopupFrame->SetAutoPosition(aShouldAutoPosition); } return NS_OK; }
NS_IMETHODIMP nsPopupBoxObject::MoveTo(PRInt32 aLeft, PRInt32 aTop) { nsMenuPopupFrame *menuPopupFrame = GetMenuPopupFrame(); if (menuPopupFrame) { menuPopupFrame->MoveTo(aLeft, aTop); } return NS_OK; }
NS_IMETHODIMP nsPopupBoxObject::EnableRollup(PRBool aShouldRollup) { nsMenuPopupFrame* menuPopupFrame = GetMenuPopupFrame(); if (!menuPopupFrame) return NS_OK; menuPopupFrame->EnableRollup(aShouldRollup); return NS_OK; }
NS_IMETHODIMP nsPopupBoxObject::GetAutoPosition(PRBool* aShouldAutoPosition) { nsMenuPopupFrame* menuPopupFrame = GetMenuPopupFrame(); if (!menuPopupFrame) return NS_OK; menuPopupFrame->GetAutoPosition(aShouldAutoPosition); return NS_OK; }
NS_IMETHODIMP nsPopupBoxObject::EnableKeyboardNavigator(PRBool aEnableKeyboardNavigator) { nsMenuPopupFrame* menuPopupFrame = GetMenuPopupFrame(); if (!menuPopupFrame) return NS_OK; if (aEnableKeyboardNavigator) menuPopupFrame->InstallKeyboardNavigator(); else menuPopupFrame->RemoveKeyboardNavigator(); return NS_OK; }
NS_IMETHODIMP nsPopupBoxObject::GetPopupState(nsAString& aState) { aState.AssignLiteral("closed"); nsMenuPopupFrame *menuPopupFrame = GetMenuPopupFrame(); if (menuPopupFrame) { switch (menuPopupFrame->PopupState()) { case ePopupShowing: case ePopupOpen: aState.AssignLiteral("showing"); break; case ePopupOpenAndVisible: aState.AssignLiteral("open"); break; case ePopupHiding: case ePopupInvisible: aState.AssignLiteral("hiding"); break; } } return NS_OK; }