Menu changes getting ready for dynamic menus

This commit is contained in:
saari%netscape.com 1999-04-13 00:12:59 +00:00
Родитель b63a2e9a5e
Коммит 07cb5b84da
6 изменённых файлов: 74 добавлений и 3 удалений

Просмотреть файл

@ -480,6 +480,7 @@ nsEventStatus nsMenu::MenuSelected(const nsMenuEvent & aMenuEvent)
printf("Menu Selected %s\n", menuLabel);
delete[] menuLabel;
if (nsnull != mListener) {
NS_ASSERTION(false, "get debugger");
mListener->MenuSelected(aMenuEvent);
}
return nsEventStatus_eIgnore;
@ -497,3 +498,27 @@ nsEventStatus nsMenu::MenuDeselected(const nsMenuEvent & aMenuEvent)
return nsEventStatus_eIgnore;
}
//-------------------------------------------------------------------------
nsEventStatus nsMenu::MenuConstruct(const nsMenuEvent & aMenuEvent)
{
char* menuLabel = GetACPString(mLabel);
printf("Menu Selected %s\n", menuLabel);
delete[] menuLabel;
if (nsnull != mListener) {
NS_ASSERTION(false, "get debugger");
mListener->MenuSelected(aMenuEvent);
}
return nsEventStatus_eIgnore;
}
//-------------------------------------------------------------------------
nsEventStatus nsMenu::MenuDestruct(const nsMenuEvent & aMenuEvent)
{
char* menuLabel = GetACPString(mLabel);
printf("Menu Deselected %s\n", menuLabel);
delete[] menuLabel;
if (nsnull != mListener) {
mListener->MenuDeselected(aMenuEvent);
}
return nsEventStatus_eIgnore;
}

Просмотреть файл

@ -44,11 +44,11 @@ public:
//nsIMenuListener interface
nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent);
nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent);
NS_IMETHOD Create(nsISupports * aParent, const nsString &aLabel);
nsEventStatus MenuConstruct(const nsMenuEvent & aMenuEvent);
nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent);
// nsIMenu Methods
NS_IMETHOD Create(nsISupports * aParent, const nsString &aLabel);
NS_IMETHOD GetParent(nsISupports *&aParent);
NS_IMETHOD GetLabel(nsString &aText);
NS_IMETHOD SetLabel(const nsString &aText);

Просмотреть файл

@ -79,6 +79,16 @@ nsEventStatus nsMenuBar::MenuDeselected(const nsMenuEvent & aMenuEvent)
return nsEventStatus_eIgnore;
}
nsEventStatus nsMenuBar::MenuConstruct(const nsMenuEvent & aMenuEvent)
{
return nsEventStatus_eIgnore;
}
nsEventStatus nsMenuBar::MenuDestruct(const nsMenuEvent & aMenuEvent)
{
return nsEventStatus_eIgnore;
}
//-------------------------------------------------------------------------
//
// nsMenuBar constructor
@ -240,3 +250,10 @@ NS_METHOD nsMenuBar::Paint()
mParent->Invalidate(PR_TRUE);
return NS_OK;
}
NS_METHOD nsMenuBar::ConstructMenuBar(nsIDOMElement * menubarElement)
{
// Build the menubar
//mDOMElement = menubarElement;
return NS_OK;
}

Просмотреть файл

@ -23,6 +23,10 @@
#include "nsWindow.h"
#include "nsSwitchToUIThread.h"
#include "nsCOMPtr.h"
#include "nsIDOMElement.h"
#include "nsIWebShell.h"
#include "nsIMenuBar.h"
#include "nsIMenuListener.h"
#include "nsVoidArray.h"
@ -43,6 +47,8 @@ public:
// nsIMenuListener interface
nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent);
nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent);
nsEventStatus MenuConstruct(const nsMenuEvent & aMenuEvent);
nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent);
NS_DECL_ISUPPORTS
@ -62,6 +68,8 @@ public:
NS_IMETHOD Paint();
NS_IMETHOD SetNativeData(void* aData);
NS_IMETHOD ConstructMenuBar(nsIDOMElement * menubarElement);
protected:
PRUint32 mNumMenus;
HMENU mMenu;
@ -71,6 +79,8 @@ protected:
nsVoidArray * mItems;
nsCOMPtr<nsIWebShell> mWebShell;
nsCOMPtr<nsIDOMElement> mDOMElement;
};
#endif // nsMenuBar_h__

Просмотреть файл

@ -314,3 +314,20 @@ nsEventStatus nsMenuItem::MenuDeselected(const nsMenuEvent & aMenuEvent)
return nsEventStatus_eIgnore;
}
//-------------------------------------------------------------------------
nsEventStatus nsMenuItem::MenuConstruct(const nsMenuEvent & aMenuEvent)
{
if (mListener) {
mListener->MenuSelected(aMenuEvent);
}
return nsEventStatus_eIgnore;
}
//-------------------------------------------------------------------------
nsEventStatus nsMenuItem::MenuDestruct(const nsMenuEvent & aMenuEvent)
{
if (mListener) {
mListener->MenuDeselected(aMenuEvent);
}
return nsEventStatus_eIgnore;
}

Просмотреть файл

@ -67,6 +67,8 @@ public:
// nsIMenuListener interface
nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent);
nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent);
nsEventStatus MenuConstruct(const nsMenuEvent & aMenuEvent);
nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent);
// Need for Native Impl
void SetCmdId(PRInt32 aId);