nsIMenu.h

- Add SetLabel method

nsMenu.h
- Added SetLabel method

nsMenu.cpp
- Added SetLabel method

nsIWidget.h
- Added AddMenuListener method

/m/pub/mozilla/webshell/tests/viewer/nsSetupRegistry.cpp
- Registered factories for nsMenuBar, nsMenu, and nsMenuItem


git-svn-id: svn://10.0.0.236/trunk@18760 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
saari%netscape.com
1999-01-27 07:51:20 +00:00
parent 97b9d670fb
commit 05ddd629aa
10 changed files with 64 additions and 2 deletions

View File

@@ -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);
}

View File

@@ -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
*

View File

@@ -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)
{

View File

@@ -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);

View File

@@ -23,6 +23,10 @@
#include "nsString.h"
#include "nsStringUtil.h"
#if defined(XP_MAC)
#include <TextUtils.h>
#endif
//#include <Xm/CascadeBG.h>
//#include <Xm/SeparatoG.h>
@@ -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)
{

View File

@@ -20,6 +20,7 @@
#define nsMenu_h__
#include "nsIMenu.h"
#include <Menus.h>
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__

View File

@@ -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)
{

View File

@@ -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);

View File

@@ -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)
{

View File

@@ -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);