mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-22 03:43:58 +00:00
missed some changes in the carbon files.
This commit is contained in:
parent
6310109ecc
commit
5c8b1edcaf
@ -23,6 +23,7 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIMenu.h"
|
||||
#include "nsIMenuItem.h"
|
||||
#include "nsIContent.h"
|
||||
@ -234,7 +235,8 @@ nsMenuBarX::MenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget* aParentWin
|
||||
void * menubarNode, void * aWebShell )
|
||||
{
|
||||
mWebShellWeakRef = getter_AddRefs(NS_GetWeakReference(NS_STATIC_CAST(nsIWebShell*, aWebShell)));
|
||||
mDOMNode = NS_STATIC_CAST(nsIDOMNode*, menubarNode); // strong ref
|
||||
nsIDOMNode* aDOMNode = NS_STATIC_CAST(nsIDOMNode*, menubarNode);
|
||||
mMenuBarContent = do_QueryInterface(aDOMNode); // strong ref
|
||||
|
||||
Create(aParentWindow);
|
||||
|
||||
@ -275,7 +277,9 @@ nsMenuBarX::MenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget* aParentWin
|
||||
if ( menuIDstring == NS_LITERAL_STRING("menu_Help") ) {
|
||||
nsMenuEvent event;
|
||||
MenuHandle handle = nsnull;
|
||||
#if !TARGET_CARBON
|
||||
::HMGetHelpMenuHandle(&handle);
|
||||
#endif
|
||||
event.mCommand = (unsigned int) handle;
|
||||
nsCOMPtr<nsIMenuListener> listener(do_QueryInterface(pnsMenu));
|
||||
listener->MenuSelected(event);
|
||||
@ -343,7 +347,7 @@ NS_METHOD nsMenuBarX::AddMenu(nsIMenu * aMenu)
|
||||
aMenu->GetMenuContent(getter_AddRefs(menu));
|
||||
nsAutoString menuHidden;
|
||||
menu->GetAttribute(kNameSpaceID_None, nsWidgetAtoms::hidden, menuHidden);
|
||||
if( menuHidden != NS_LITERAL_STRING("true"))
|
||||
if( menuHidden != NS_LITERAL_STRING("true")) {
|
||||
Str255 title;
|
||||
::InsertMenuItem(mRootMenu, ::GetMenuTitle(menuRef, title), mNumMenus);
|
||||
OSStatus status = ::SetMenuItemHierarchicalMenu(mRootMenu, mNumMenus, menuRef);
|
||||
@ -508,8 +512,7 @@ NS_IMETHODIMP
|
||||
nsMenuBarX::ContentAppended( nsIDocument * aDocument, nsIContent * aContainer,
|
||||
PRInt32 aNewIndexInContainer)
|
||||
{
|
||||
nsCOMPtr<nsIContent> me ( do_QueryInterface(mDOMNode) );
|
||||
if ( aContainer == me.get() ) {
|
||||
if ( aContainer == mMenuBarContent ) {
|
||||
//Register(aContainer, );
|
||||
//InsertMenu ( aNewIndexInContainer );
|
||||
}
|
||||
@ -602,8 +605,7 @@ NS_IMETHODIMP
|
||||
nsMenuBarX::ContentRemoved( nsIDocument * aDocument, nsIContent * aContainer,
|
||||
nsIContent * aChild, PRInt32 aIndexInContainer )
|
||||
{
|
||||
nsCOMPtr<nsIContent> me ( do_QueryInterface(mDOMNode) );
|
||||
if ( aContainer == me.get() ) {
|
||||
if ( aContainer == mMenuBarContent ) {
|
||||
Unregister(aChild);
|
||||
RemoveMenu ( aIndexInContainer );
|
||||
}
|
||||
@ -629,8 +631,7 @@ NS_IMETHODIMP
|
||||
nsMenuBarX::ContentInserted( nsIDocument * aDocument, nsIContent * aContainer,
|
||||
nsIContent * aChild, PRInt32 aIndexInContainer )
|
||||
{
|
||||
nsCOMPtr<nsIContent> me ( do_QueryInterface(mDOMNode) );
|
||||
if ( aContainer == me.get() ) {
|
||||
if ( aContainer == mMenuBarContent ) {
|
||||
//Register(aChild, );
|
||||
//InsertMenu ( aIndexInContainer );
|
||||
}
|
||||
|
@ -35,6 +35,8 @@
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsWidgetAtoms.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
|
||||
#include "nsStringUtil.h"
|
||||
|
||||
@ -269,7 +271,7 @@ NS_METHOD nsMenuItemX::DoCommand()
|
||||
nsCOMPtr<nsIWebShell> webShell = do_QueryReferent(mWebShellWeakRef);
|
||||
if (!webShell)
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
MenuHelpers::WebShellToPresContext(webShell, getter_AddRefs(presContext));
|
||||
MenuHelpersX::WebShellToPresContext(webShell, getter_AddRefs(presContext));
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsMouseEvent event;
|
||||
@ -337,7 +339,7 @@ NS_METHOD nsMenuItemX::GetShortcutChar(nsString &aText)
|
||||
// uncheck them all.
|
||||
//
|
||||
void
|
||||
nsMenuItemX :: UncheckRadioSiblings(nsIDOMElement* inCheckedElement)
|
||||
nsMenuItemX :: UncheckRadioSiblings(nsIContent* inCheckedContent)
|
||||
{
|
||||
nsAutoString myGroupName;
|
||||
inCheckedContent->GetAttribute(kNameSpaceID_None, nsWidgetAtoms::name, myGroupName);
|
||||
|
@ -84,7 +84,7 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
void UncheckRadioSiblings ( nsIDOMElement* inCheckedElement ) ;
|
||||
void UncheckRadioSiblings ( nsIContent* inCheckedElement ) ;
|
||||
|
||||
nsString mLabel;
|
||||
nsString mKeyEquivalent;
|
||||
|
@ -554,9 +554,8 @@ nsEventStatus nsMenuX::MenuSelected(const nsMenuEvent & aMenuEvent)
|
||||
}
|
||||
|
||||
// Open the node.
|
||||
nsCOMPtr<nsIDOMElement> domElement = do_QueryInterface(mDOMNode);
|
||||
if (domElement)
|
||||
domElement->SetAttribute(NS_LITERAL_STRING("open"), NS_LITERAL_STRING("true"));
|
||||
mMenuContent->SetAttribute(kNameSpaceID_None, nsWidgetAtoms::open, NS_LITERAL_STRING("true"), PR_TRUE);
|
||||
|
||||
|
||||
// Fire our oncreate handler. If we're told to stop, don't build the menu at all
|
||||
PRBool keepProcessing = OnCreate();
|
||||
@ -575,10 +574,10 @@ nsEventStatus nsMenuX::MenuSelected(const nsMenuEvent & aMenuEvent)
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
if (mIsHelpMenu) {
|
||||
HelpMenuConstruct(aMenuEvent, nsnull /* mParentWindow */, mDOMNode, webShell);
|
||||
HelpMenuConstruct(aMenuEvent, nsnull /* mParentWindow */, nsnull, webShell);
|
||||
mConstructed = true;
|
||||
} else {
|
||||
MenuConstruct(aMenuEvent, nsnull /* mParentWindow */, mDOMNode, webShell);
|
||||
MenuConstruct(aMenuEvent, nsnull /* mParentWindow */, nsnull, webShell);
|
||||
mConstructed = true;
|
||||
}
|
||||
} else {
|
||||
@ -793,7 +792,7 @@ NS_METHOD nsMenuX::IsHelpMenu(PRBool* aIsHelpMenu)
|
||||
* Get GetMenuContent
|
||||
*
|
||||
*/
|
||||
NS_METHOD nsMenu::GetMenuContent(nsIContent ** aMenuContent)
|
||||
NS_METHOD nsMenuX::GetMenuContent(nsIContent ** aMenuContent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aMenuContent);
|
||||
NS_IF_ADDREF(*aMenuContent = mMenuContent);
|
||||
@ -1048,7 +1047,7 @@ nsMenuX::OnCreate()
|
||||
return PR_FALSE;
|
||||
}
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
MenuHelpers::WebShellToPresContext(webShell, getter_AddRefs(presContext) );
|
||||
MenuHelpersX::WebShellToPresContext(webShell, getter_AddRefs(presContext) );
|
||||
if ( presContext ) {
|
||||
nsresult rv = NS_OK;
|
||||
nsIContent* dispatchTo = popupContent ? popupContent : mMenuContent;
|
||||
@ -1145,7 +1144,7 @@ nsMenuX::OnDestroy()
|
||||
GetMenuPopupContent(getter_AddRefs(popupContent));
|
||||
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
MenuHelpers::WebShellToPresContext (webShell, getter_AddRefs(presContext) );
|
||||
MenuHelpersX::WebShellToPresContext (webShell, getter_AddRefs(presContext) );
|
||||
if (presContext ) {
|
||||
nsresult rv = NS_OK;
|
||||
nsIContent* dispatchTo = popupContent ? popupContent : mMenuContent;
|
||||
@ -1168,7 +1167,7 @@ nsMenuX::OnDestroy()
|
||||
// it (so the strcmp won't kill us).
|
||||
//
|
||||
void
|
||||
nsMenu::GetMenuPopupContent(nsIContent** aResult)
|
||||
nsMenuX::GetMenuPopupContent(nsIContent** aResult)
|
||||
{
|
||||
if (!aResult )
|
||||
return;
|
||||
@ -1267,7 +1266,7 @@ nsMenuX::AttributeChanged(nsIDocument *aDocument, PRInt32 aNameSpaceID, nsIAtom
|
||||
mNeedsRebuild = PR_TRUE;
|
||||
|
||||
nsAutoString valueString;
|
||||
domElement->GetAttribute(NS_LITERAL_STRING("disabled"), valueString);
|
||||
mMenuContent->GetAttribute(kNameSpaceID_None, nsWidgetAtoms::disabled, valueString);
|
||||
if(valueString == NS_LITERAL_STRING("true"))
|
||||
SetEnabled(PR_FALSE);
|
||||
else
|
||||
@ -1278,7 +1277,7 @@ nsMenuX::AttributeChanged(nsIDocument *aDocument, PRInt32 aNameSpaceID, nsIAtom
|
||||
else if(aAttribute == nsWidgetAtoms::label) {
|
||||
mNeedsRebuild = PR_TRUE;
|
||||
|
||||
domElement->GetAttribute(NS_LITERAL_STRING("label"), mLabel);
|
||||
mMenuContent->GetAttribute(kNameSpaceID_None, nsWidgetAtoms::label, mLabel);
|
||||
|
||||
// reuse the existing menu, to avoid invalidating root menu bar.
|
||||
NS_ASSERTION(mMacMenuHandle != NULL, "nsMenuX::AttributeChanged: invalid menu handle.");
|
||||
|
Loading…
x
Reference in New Issue
Block a user