From 91c95ea168d26e718ba3ac633168bdb24b65fa36 Mon Sep 17 00:00:00 2001 From: "saari%netscape.com" Date: Tue, 11 May 1999 18:16:25 +0000 Subject: [PATCH] changing nsIMenuItem for context menu support git-svn-id: svn://10.0.0.236/trunk@31084 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/widget/public/nsIMenuItem.h | 28 ++++----------------------- mozilla/widget/src/gtk/nsMenuItem.cpp | 10 +++++++--- mozilla/widget/src/gtk/nsMenuItem.h | 18 ++++++++--------- 3 files changed, 19 insertions(+), 37 deletions(-) diff --git a/mozilla/widget/public/nsIMenuItem.h b/mozilla/widget/public/nsIMenuItem.h index 16514cefaf0..70cb0b73ab8 100644 --- a/mozilla/widget/public/nsIMenuItem.h +++ b/mozilla/widget/public/nsIMenuItem.h @@ -48,29 +48,9 @@ class nsIMenuItem : public nsISupports { * Creates the MenuItem * */ - NS_IMETHOD Create(nsIMenu *aParent, - const nsString &aLabel, - PRBool isSeparator) = 0; - - /** - * Creates the MenuItem - * - */ - NS_IMETHOD Create(nsIPopUpMenu *aParent, - const nsString &aLabel, - PRUint32 aCommand) = 0; - - /** - * Creates the MenuItem as a Separator - * - */ - NS_IMETHOD Create(nsIMenu *aParent) = 0; - - /** - * Creates the MenuItem as a Separator - * - */ - NS_IMETHOD Create(nsIPopUpMenu *aParent) = 0; + NS_IMETHOD Create(nsISupports * aParent, + const nsString & aLabel, + PRBool isSeparator) = 0; /** * Get the MenuItem label @@ -79,7 +59,7 @@ class nsIMenuItem : public nsISupports { NS_IMETHOD GetLabel(nsString &aText) = 0; /** - * Get the MenuItem label + * Get the MenuItem label * */ NS_IMETHOD SetLabel(nsString &aText) = 0; diff --git a/mozilla/widget/src/gtk/nsMenuItem.cpp b/mozilla/widget/src/gtk/nsMenuItem.cpp index 7270706694c..d8445e2d3e3 100644 --- a/mozilla/widget/src/gtk/nsMenuItem.cpp +++ b/mozilla/widget/src/gtk/nsMenuItem.cpp @@ -203,7 +203,7 @@ nsIWidget * nsMenuItem::GetMenuBarParent(nsISupports * aParent) } //------------------------------------------------------------------------- -NS_METHOD nsMenuItem::Create(nsIMenu * aParent, +NS_METHOD nsMenuItem::Create(nsISupports * aParent, const nsString & aLabel, PRBool aIsSeparator) @@ -212,8 +212,12 @@ NS_METHOD nsMenuItem::Create(nsIMenu * aParent, return NS_ERROR_FAILURE; } - mMenuParent = aParent; - + if(aParent){ + nsIMenu * menu; + aParent->QueryInterface(kIMenuIID, (void**) &menu); + mMenuParent = menu; + NS_RELEASE(menu); + } nsIWidget * widget = nsnull; // MenuBar's Parent nsISupports * sups; if (NS_OK == aParent->QueryInterface(kISupportsIID,(void**)&sups)) { diff --git a/mozilla/widget/src/gtk/nsMenuItem.h b/mozilla/widget/src/gtk/nsMenuItem.h index 0fde058d4e2..a780763363e 100644 --- a/mozilla/widget/src/gtk/nsMenuItem.h +++ b/mozilla/widget/src/gtk/nsMenuItem.h @@ -45,17 +45,10 @@ public: // nsISupports NS_DECL_ISUPPORTS - NS_IMETHOD Create(nsIMenu *aParent, - const nsString &aLabel, - PRBool aIsSeparator); - - NS_IMETHOD Create(nsIPopUpMenu *aParent, - const nsString &aLabel, - PRUint32 aCommand) ; - NS_IMETHOD Create(nsIMenu * aParent); - NS_IMETHOD Create(nsIPopUpMenu * aParent); - // nsIMenuBar Methods + NS_IMETHOD Create(nsISupports *aParent, + const nsString &aLabel, + PRBool aIsSeparator); NS_IMETHOD GetLabel(nsString &aText); NS_IMETHOD SetLabel(nsString &aText); NS_IMETHOD SetEnabled(PRBool aIsEnabled); @@ -87,6 +80,11 @@ public: nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent); protected: + NS_IMETHOD Create(nsIPopUpMenu *aParent, + const nsString &aLabel, + PRUint32 aCommand) ; + NS_IMETHOD Create(nsIMenu * aParent); + NS_IMETHOD Create(nsIPopUpMenu * aParent); void Create(nsIWidget * aMBParent, GtkWidget *aParent, const nsString &aLabel, PRBool aIsSeparator); nsIWidget *GetMenuBarParent(nsISupports * aParentSupports);