diff --git a/mozilla/webshell/tests/viewer/nsSetupRegistry.cpp b/mozilla/webshell/tests/viewer/nsSetupRegistry.cpp index dc174f6825d..99b228574d5 100644 --- a/mozilla/webshell/tests/viewer/nsSetupRegistry.cpp +++ b/mozilla/webshell/tests/viewer/nsSetupRegistry.cpp @@ -177,6 +177,10 @@ static NS_DEFINE_CID(kLiveconnectCID, NS_CLIVECONNECT_CID); static NS_DEFINE_CID(kJVMManagerCID, NS_JVMMANAGER_CID); #endif +static NS_DEFINE_IID(kCMenuBarCID, NS_MENUBAR_CID); +static NS_DEFINE_IID(kCMenuCID, NS_MENU_CID); +static NS_DEFINE_IID(kCMenuItemCID, NS_MENUITEM_CID); + extern "C" void NS_SetupRegistry() { @@ -254,4 +258,7 @@ NS_SetupRegistry() nsRepository::RegisterFactory(kJVMManagerCID, OJI_DLL, PR_FALSE, PR_FALSE); #endif + nsRepository::RegisterFactory(kCMenuBarCID, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsRepository::RegisterFactory(kCMenuCID, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsRepository::RegisterFactory(kCMenuItemCID, WIDGET_DLL, PR_FALSE, PR_FALSE); } diff --git a/mozilla/widget/public/nsIMenu.h b/mozilla/widget/public/nsIMenu.h index 7249d2246c7..8778b313c71 100644 --- a/mozilla/widget/public/nsIMenu.h +++ b/mozilla/widget/public/nsIMenu.h @@ -63,6 +63,12 @@ class nsIMenu : public nsISupports { */ NS_IMETHOD GetLabel(nsString &aText) = 0; + /** + * Set the Menu label + * + */ + NS_IMETHOD SetLabel(nsString &aText) = 0; + /** * Adds a Menu Item * diff --git a/mozilla/widget/src/gtk/nsMenu.cpp b/mozilla/widget/src/gtk/nsMenu.cpp index 14b37e714f6..cf7b15c4baf 100644 --- a/mozilla/widget/src/gtk/nsMenu.cpp +++ b/mozilla/widget/src/gtk/nsMenu.cpp @@ -120,6 +120,13 @@ NS_METHOD nsMenu::GetLabel(nsString &aText) return NS_OK; } +//------------------------------------------------------------------------- +NS_METHOD nsMenu::SetLabel(nsString &aText) +{ + mLabel = aText; + return NS_OK; +} + //------------------------------------------------------------------------- NS_METHOD nsMenu::AddItem(const nsString &aText) { diff --git a/mozilla/widget/src/gtk/nsMenu.h b/mozilla/widget/src/gtk/nsMenu.h index e6de53561cc..2274c56ce8b 100644 --- a/mozilla/widget/src/gtk/nsMenu.h +++ b/mozilla/widget/src/gtk/nsMenu.h @@ -42,6 +42,7 @@ public: // nsIMenu Methods NS_IMETHOD GetParent(nsISupports *&aParent); NS_IMETHOD GetLabel(nsString &aText); + NS_IMETHOD SetLabel(nsString &aText); NS_IMETHOD AddItem(const nsString &aText); NS_IMETHOD AddItem(nsIMenuItem * aMenuItem); NS_IMETHOD AddMenu(nsIMenu * aMenu); diff --git a/mozilla/widget/src/mac/nsMenu.cpp b/mozilla/widget/src/mac/nsMenu.cpp index 8bba1da9270..1f157aece34 100644 --- a/mozilla/widget/src/mac/nsMenu.cpp +++ b/mozilla/widget/src/mac/nsMenu.cpp @@ -23,6 +23,10 @@ #include "nsString.h" #include "nsStringUtil.h" +#if defined(XP_MAC) +#include +#endif + //#include //#include @@ -39,9 +43,10 @@ nsMenu::nsMenu() : nsIMenu() { NS_INIT_REFCNT(); mNumMenuItems = 0; - //mMenu = nsnull; mMenuParent = nsnull; mMenuBarParent = nsnull; + + mMacMenuHandle = nsnull; } //------------------------------------------------------------------------- @@ -160,6 +165,21 @@ NS_METHOD nsMenu::GetLabel(nsString &aText) return NS_OK; } +//------------------------------------------------------------------------- +NS_METHOD nsMenu::SetLabel(nsString &aText) +{ + mLabel = aText; + + // Mac Menu id may be 1-255 + //mMacMenuHandle = ::NewMenu(1, (unsigned char *)mName.ToNewCString() ); + Str255 test; + strcpy((char*)&test, "test"); + c2pstr((char*)test); + mMacMenuHandle = ::NewMenu(500, test); + + return NS_OK; +} + //------------------------------------------------------------------------- NS_METHOD nsMenu::AddItem(const nsString &aText) { diff --git a/mozilla/widget/src/mac/nsMenu.h b/mozilla/widget/src/mac/nsMenu.h index 02a8b895f46..cce94847795 100644 --- a/mozilla/widget/src/mac/nsMenu.h +++ b/mozilla/widget/src/mac/nsMenu.h @@ -20,6 +20,7 @@ #define nsMenu_h__ #include "nsIMenu.h" +#include class nsIMenuBar; @@ -42,6 +43,7 @@ public: // nsIMenu Methods NS_IMETHOD GetParent(nsISupports *&aParent); NS_IMETHOD GetLabel(nsString &aText); + NS_IMETHOD SetLabel(nsString &aText); NS_IMETHOD AddItem(const nsString &aText); NS_IMETHOD AddItem(nsIMenuItem * aMenuItem); NS_IMETHOD AddMenu(nsIMenu * aMenu); @@ -61,11 +63,12 @@ protected: nsString mLabel; PRUint32 mNumMenuItems; - //Widget mMenu; nsIMenu * mMenuParent; nsIMenuBar * mMenuBarParent; + // MacSpecific + MenuHandle mMacMenuHandle; }; #endif // nsMenu_h__ diff --git a/mozilla/widget/src/motif/nsMenu.cpp b/mozilla/widget/src/motif/nsMenu.cpp index a02aa38cd60..1792648e782 100644 --- a/mozilla/widget/src/motif/nsMenu.cpp +++ b/mozilla/widget/src/motif/nsMenu.cpp @@ -152,6 +152,14 @@ NS_METHOD nsMenu::GetLabel(nsString &aText) return NS_OK; } +//------------------------------------------------------------------------- +NS_METHOD nsMenu::SetLabel(nsString &aText) +{ + mLabel = aText; + + return NS_OK; +} + //------------------------------------------------------------------------- NS_METHOD nsMenu::AddItem(const nsString &aText) { diff --git a/mozilla/widget/src/motif/nsMenu.h b/mozilla/widget/src/motif/nsMenu.h index 39a9cd30b9b..c2f5d75ea33 100644 --- a/mozilla/widget/src/motif/nsMenu.h +++ b/mozilla/widget/src/motif/nsMenu.h @@ -44,6 +44,7 @@ public: // nsIMenu Methods NS_IMETHOD GetParent(nsISupports *&aParent); NS_IMETHOD GetLabel(nsString &aText); + NS_IMETHOD SetLabel(nsString &aText); NS_IMETHOD AddItem(const nsString &aText); NS_IMETHOD AddItem(nsIMenuItem * aMenuItem); NS_IMETHOD AddMenu(nsIMenu * aMenu); diff --git a/mozilla/widget/src/windows/nsMenu.cpp b/mozilla/widget/src/windows/nsMenu.cpp index e911eec2f40..3abcfcde844 100644 --- a/mozilla/widget/src/windows/nsMenu.cpp +++ b/mozilla/widget/src/windows/nsMenu.cpp @@ -114,6 +114,14 @@ NS_METHOD nsMenu::GetLabel(nsString &aText) return NS_OK; } +//------------------------------------------------------------------------- +NS_METHOD nsMenu::SetLabel(nsString &aText) +{ + mLabel = aText; + + return NS_OK; +} + //------------------------------------------------------------------------- NS_METHOD nsMenu::AddItem(const nsString &aText) { diff --git a/mozilla/widget/src/windows/nsMenu.h b/mozilla/widget/src/windows/nsMenu.h index b6eff047570..43b17612b31 100644 --- a/mozilla/widget/src/windows/nsMenu.h +++ b/mozilla/widget/src/windows/nsMenu.h @@ -44,6 +44,7 @@ public: // nsIMenu Methods NS_IMETHOD GetParent(nsISupports *&aParent); NS_IMETHOD GetLabel(nsString &aText); + NS_IMETHOD SetLabel(nsString &aText); NS_IMETHOD AddItem(const nsString &aText); NS_IMETHOD AddItem(nsIMenuItem * aMenuItem); NS_IMETHOD AddMenu(nsIMenu * aMenu);