зеркало из https://github.com/mozilla/pjs.git
This should be the last of this round of menu checkins
This commit is contained in:
Родитель
7ae9fd7cda
Коммит
3fc71cf9aa
|
@ -21,6 +21,9 @@
|
|||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIWebShell.h"
|
||||
|
||||
class nsIMenuBar;
|
||||
class nsIMenu;
|
||||
|
@ -125,6 +128,23 @@ class nsIMenu : public nsISupports {
|
|||
*/
|
||||
NS_IMETHOD RemoveMenuListener(nsIMenuListener * aMenuListener) = 0;
|
||||
|
||||
/**
|
||||
* Set DOMNode
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetDOMNode(nsIDOMNode * aMenuNode) = 0;
|
||||
|
||||
/**
|
||||
* Set DOMElement
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetDOMElement(nsIDOMElement * aMenuElement) = 0;
|
||||
|
||||
/**
|
||||
* Set WebShell
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetWebShell(nsIWebShell * aWebShell) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
||||
// {7F045771-4BEB-11d2-8DBB-00609703C14E}
|
||||
#define NS_IMENUITEM_IID \
|
||||
{ 0x7f045771, 0x4beb, 0x11d2, \
|
||||
|
@ -140,6 +143,22 @@ class nsIMenuItem : public nsISupports {
|
|||
*/
|
||||
NS_IMETHOD IsSeparator(PRBool & aIsSep) = 0;
|
||||
|
||||
/**
|
||||
* Sets the JavaScript Command to be invoked when a "gui" event occurs on a source widget
|
||||
* @param aStrCmd the JS command to be cached for later execution
|
||||
* @return NS_OK
|
||||
*/
|
||||
NS_IMETHOD SetCommand(const nsString & aStrCmd) = 0;
|
||||
|
||||
/**
|
||||
* Executes the "cached" JavaScript Command
|
||||
* @return NS_OK if the command was executed properly, otherwise an error code
|
||||
*/
|
||||
NS_IMETHOD DoCommand() = 0;
|
||||
|
||||
NS_IMETHOD SetDOMElement(nsIDOMElement * aDOMElement) = 0;
|
||||
NS_IMETHOD GetDOMElement(nsIDOMElement ** aDOMElement) = 0;
|
||||
NS_IMETHOD SetWebShell(nsIWebShell * aWebShell) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -42,6 +42,13 @@ class nsIMenuListener : public nsISupports {
|
|||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IMENULISTENER_IID; return iid; }
|
||||
|
||||
/**
|
||||
* Processes a menu item selected event
|
||||
* @param aMenuEvent See nsGUIEvent.h
|
||||
* @return whether the event was consumed or ignored. See nsEventStatus
|
||||
*/
|
||||
virtual nsEventStatus MenuItemSelected(const nsMenuEvent & aMenuEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a menu selected event
|
||||
* @param aMenuEvent See nsGUIEvent.h
|
||||
|
@ -56,7 +63,18 @@ class nsIMenuListener : public nsISupports {
|
|||
*/
|
||||
virtual nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent) = 0;
|
||||
|
||||
virtual nsEventStatus MenuConstruct(const nsMenuEvent & aMenuEvent) = 0;
|
||||
virtual nsEventStatus MenuConstruct(
|
||||
|
||||
const nsMenuEvent & aMenuEvent,
|
||||
|
||||
nsIWidget * aParentWindow,
|
||||
|
||||
void * menubarNode,
|
||||
|
||||
void * aWebShell) = 0;
|
||||
|
||||
|
||||
|
||||
virtual nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent) = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -310,6 +310,14 @@ NS_METHOD nsMenu::RemoveMenuListener(nsIMenuListener * aMenuListener)
|
|||
//-------------------------------------------------------------------------
|
||||
// nsIMenuListener interface
|
||||
//-------------------------------------------------------------------------
|
||||
nsEventStatus nsMenu::MenuItemSelected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
if (nsnull != mListener) {
|
||||
mListener->MenuSelected(aMenuEvent);
|
||||
}
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
nsEventStatus nsMenu::MenuSelected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
if (nsnull != mListener) {
|
||||
|
@ -328,7 +336,11 @@ nsEventStatus nsMenu::MenuDeselected(const nsMenuEvent & aMenuEvent)
|
|||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
nsEventStatus nsMenu::MenuConstruct(const nsMenuEvent & aMenuEvent)
|
||||
nsEventStatus nsMenu::MenuConstruct(
|
||||
const nsMenuEvent & aMenuEvent,
|
||||
nsIWidget * aParentWindow,
|
||||
void * menuNode,
|
||||
void * aWebShell)
|
||||
{
|
||||
if (nsnull != mListener) {
|
||||
mListener->MenuDeselected(aMenuEvent);
|
||||
|
@ -344,3 +356,33 @@ nsEventStatus nsMenu::MenuDestruct(const nsMenuEvent & aMenuEvent)
|
|||
}
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
/**
|
||||
* Set DOMNode
|
||||
*
|
||||
*/
|
||||
NS_METHOD nsMenu::SetDOMNode(nsIDOMNode * aMenuNode)
|
||||
{
|
||||
return NS_OK:
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
/**
|
||||
* Set DOMElement
|
||||
*
|
||||
*/
|
||||
NS_METHOD nsMenu::SetDOMElement(nsIDOMElement * aMenuElement)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
/**
|
||||
* Set WebShell
|
||||
*
|
||||
*/
|
||||
NS_METHOD nsMenu::SetWebShell(nsIWebShell * aWebShell)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
|
@ -40,9 +40,14 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIMenuListener methods
|
||||
nsEventStatus MenuItemSelected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuConstruct(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuConstruct(
|
||||
const nsMenuEvent & aMenuEvent,
|
||||
nsIWidget * aParentWindow,
|
||||
void * menuNode,
|
||||
void * aWebShell);
|
||||
nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent);
|
||||
|
||||
NS_IMETHOD Create(nsISupports * aParent, const nsString &aLabel);
|
||||
|
@ -65,6 +70,10 @@ public:
|
|||
NS_IMETHOD AddMenuListener(nsIMenuListener * aMenuListener);
|
||||
NS_IMETHOD RemoveMenuListener(nsIMenuListener * aMenuListener);
|
||||
|
||||
NS_IMETHOD SetDOMNode(nsIDOMNode * aMenuNode);
|
||||
NS_IMETHOD SetDOMElement(nsIDOMElement * aMenuElement);
|
||||
NS_IMETHOD SetWebShell(nsIWebShell * aWebShell);
|
||||
|
||||
protected:
|
||||
void Create(GtkWidget *aParent, const nsString &aLabel);
|
||||
GtkWidget *GetNativeParent();
|
||||
|
|
|
@ -197,6 +197,11 @@ NS_METHOD nsMenuBar::Paint()
|
|||
// nsMenuListener interface
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsEventStatus nsMenuBar::MenuItemSelected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
nsEventStatus nsMenuBar::MenuSelected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
|
@ -207,7 +212,11 @@ nsEventStatus nsMenuBar::MenuDeselected(const nsMenuEvent & aMenuEvent)
|
|||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
nsEventStatus nsMenuBar::MenuConstruct(const nsMenuEvent & aMenuEvent)
|
||||
nsEventStatus nsMenuBar::MenuConstruct(
|
||||
const nsMenuEvent & aMenuEvent,
|
||||
nsIWidget * aParentWindow,
|
||||
void * menuNode,
|
||||
void * aWebShell)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
|
|
@ -37,9 +37,14 @@ public:
|
|||
virtual ~nsMenuBar();
|
||||
|
||||
// nsIMenuListener interface
|
||||
nsEventStatus MenuItemSelected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuConstruct(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuConstruct(
|
||||
const nsMenuEvent & aMenuEvent,
|
||||
nsIWidget * aParentWindow,
|
||||
void * menuNode,
|
||||
void * aWebShell);
|
||||
nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
|
|
@ -321,6 +321,15 @@ NS_METHOD nsMenuItem::IsSeparator(PRBool & aIsSep)
|
|||
//-------------------------------------------------------------------------
|
||||
// nsIMenuListener interface
|
||||
//-------------------------------------------------------------------------
|
||||
nsEventStatus nsMenuItem::MenuItemSelected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
if(mXULCommandListener)
|
||||
return mXULCommandListener->MenuSelected(aMenuEvent);
|
||||
|
||||
g_print("nsMenuItem::MenuSelected\n");
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
nsEventStatus nsMenuItem::MenuSelected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
if(mXULCommandListener)
|
||||
|
@ -336,7 +345,11 @@ nsEventStatus nsMenuItem::MenuDeselected(const nsMenuEvent & aMenuEvent)
|
|||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
nsEventStatus nsMenuItem::MenuConstruct(const nsMenuEvent & aMenuEvent)
|
||||
nsEventStatus nsMenuItem::MenuConstruct(
|
||||
const nsMenuEvent & aMenuEvent,
|
||||
nsIWidget * aParentWindow,
|
||||
void * menuNode,
|
||||
void * aWebShell)
|
||||
{
|
||||
g_print("nsMenuItem::MenuConstruct\n");
|
||||
return nsEventStatus_eIgnore;
|
||||
|
@ -347,3 +360,42 @@ nsEventStatus nsMenuItem::MenuDestruct(const nsMenuEvent & aMenuEvent)
|
|||
g_print("nsMenuItem::MenuDestruct\n");
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
/**
|
||||
* Sets the JavaScript Command to be invoked when a "gui" event occurs on a source widget
|
||||
* @param aStrCmd the JS command to be cached for later execution
|
||||
* @return NS_OK
|
||||
*/
|
||||
NS_METHOD nsMenuItem::SetCommand(const nsString & aStrCmd)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
/**
|
||||
* Executes the "cached" JavaScript Command
|
||||
* @return NS_OK if the command was executed properly, otherwise an error code
|
||||
*/
|
||||
NS_METHOD nsMenuItem::DoCommand()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenuItem::SetDOMElement(nsIDOMElement * aDOMElement)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenuItem::GetDOMElement(nsIDOMElement ** aDOMElement)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenuItem::SetWebShell(nsIWebShell * aWebShell)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
|
@ -65,10 +65,21 @@ public:
|
|||
NS_IMETHOD RemoveMenuListener(nsIMenuListener * aMenuListener);
|
||||
NS_IMETHOD IsSeparator(PRBool & aIsSep);
|
||||
|
||||
NS_IMETHOD SetCommand(const nsString & aStrCmd);
|
||||
NS_IMETHOD DoCommand();
|
||||
NS_IMETHOD SetDOMElement(nsIDOMElement * aDOMElement);
|
||||
NS_IMETHOD GetDOMElement(nsIDOMElement ** aDOMElement);
|
||||
NS_IMETHOD SetWebShell(nsIWebShell * aWebShell);
|
||||
|
||||
// nsIMenuListener interface
|
||||
nsEventStatus MenuItemSelected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuConstruct(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuConstruct(
|
||||
const nsMenuEvent & aMenuEvent,
|
||||
nsIWidget * aParentWindow,
|
||||
void * menuNode,
|
||||
void * aWebShell);
|
||||
nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -330,6 +330,50 @@ NS_METHOD nsMenu::RemoveMenuListener(nsIMenuListener * aMenuListener)
|
|||
// nsIMenuListener interface
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsEventStatus nsMenu::MenuItemSelected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
nsEventStatus eventStatus = nsEventStatus_eIgnore;
|
||||
|
||||
// Determine if this is the correct menu to handle the event
|
||||
PRInt16 menuID = HiWord(((nsMenuEvent)aMenuEvent).mCommand);
|
||||
if(mMacMenuID == menuID)
|
||||
{
|
||||
// Call MenuSelected on the correct nsMenuItem
|
||||
PRInt16 menuItemID = LoWord(((nsMenuEvent)aMenuEvent).mCommand);
|
||||
nsIMenuListener * menuListener = nsnull;
|
||||
((nsIMenuItem*)mMenuItemVoidArray[menuItemID-1])->QueryInterface(kIMenuListenerIID, &menuListener);
|
||||
if(menuListener) {
|
||||
eventStatus = menuListener->MenuSelected(aMenuEvent);
|
||||
NS_IF_RELEASE(menuListener);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Make sure none of our submenus are the ones that should be handling this
|
||||
for (int i = mMenuItemVoidArray.Count(); i > 0; i--)
|
||||
{
|
||||
if(nsnull != mMenuItemVoidArray[i-1])
|
||||
{
|
||||
nsIMenu * submenu = nsnull;
|
||||
((nsISupports*)mMenuItemVoidArray[i-1])->QueryInterface(kIMenuIID, &submenu);
|
||||
if(submenu)
|
||||
{
|
||||
nsIMenuListener * menuListener = nsnull;
|
||||
((nsISupports*)mMenuItemVoidArray[i-1])->QueryInterface(kIMenuListenerIID, &menuListener);
|
||||
if(menuListener){
|
||||
eventStatus = menuListener->MenuSelected(aMenuEvent);
|
||||
NS_IF_RELEASE(menuListener);
|
||||
if(nsEventStatus_eIgnore != eventStatus)
|
||||
return eventStatus;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return eventStatus;
|
||||
}
|
||||
|
||||
nsEventStatus nsMenu::MenuSelected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
nsEventStatus eventStatus = nsEventStatus_eIgnore;
|
||||
|
@ -381,7 +425,11 @@ nsEventStatus nsMenu::MenuDeselected(const nsMenuEvent & aMenuEvent)
|
|||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
nsEventStatus nsMenu::MenuConstruct(const nsMenuEvent & aMenuEvent)
|
||||
nsEventStatus nsMenu::MenuConstruct(
|
||||
const nsMenuEvent & aMenuEvent,
|
||||
nsIWidget * aParentWindow,
|
||||
void * menuNode,
|
||||
void * aWebShell)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
@ -391,3 +439,33 @@ nsEventStatus nsMenu::MenuDestruct(const nsMenuEvent & aMenuEvent)
|
|||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
/**
|
||||
* Set DOMNode
|
||||
*
|
||||
*/
|
||||
NS_METHOD nsMenu::SetDOMNode(nsIDOMNode * aMenuNode)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
/**
|
||||
* Set DOMElement
|
||||
*
|
||||
*/
|
||||
NS_METHOD nsMenu::SetDOMElement(nsIDOMElement * aMenuElement)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
/**
|
||||
* Set WebShell
|
||||
*
|
||||
*/
|
||||
NS_METHOD nsMenu::SetWebShell(nsIWebShell * aWebShell)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -38,9 +38,14 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIMenuListener methods
|
||||
nsEventStatus MenuItemSelected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuConstruct(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuConstruct(
|
||||
const nsMenuEvent & aMenuEvent,
|
||||
nsIWidget * aParentWindow,
|
||||
void * menuNode,
|
||||
void * aWebShell);
|
||||
nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent);
|
||||
|
||||
// nsIMenu Methods
|
||||
|
@ -58,7 +63,10 @@ public:
|
|||
NS_IMETHOD GetNativeData(void** aData);
|
||||
NS_IMETHOD AddMenuListener(nsIMenuListener * aMenuListener);
|
||||
NS_IMETHOD RemoveMenuListener(nsIMenuListener * aMenuListener);
|
||||
|
||||
NS_IMETHOD SetDOMNode(nsIDOMNode * aMenuNode);
|
||||
NS_IMETHOD SetDOMElement(nsIDOMElement * aMenuElement);
|
||||
NS_IMETHOD SetWebShell(nsIWebShell * aWebShell);
|
||||
|
||||
//
|
||||
NS_IMETHOD AddMenuItem(nsIMenuItem * aMenuItem);
|
||||
NS_IMETHOD AddMenu(nsIMenu * aMenu);
|
||||
|
|
|
@ -66,6 +66,13 @@ NS_IMPL_RELEASE(nsMenuBar)
|
|||
// nsMenuListener interface
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
nsEventStatus nsMenuBar::MenuItemSelected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
nsEventStatus nsMenuBar::MenuSelected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
// Dispatch menu event
|
||||
|
@ -96,7 +103,11 @@ nsEventStatus nsMenuBar::MenuDeselected(const nsMenuEvent & aMenuEvent)
|
|||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
nsEventStatus nsMenuBar::MenuConstruct(const nsMenuEvent & aMenuEvent)
|
||||
nsEventStatus nsMenuBar::MenuConstruct(
|
||||
const nsMenuEvent & aMenuEvent,
|
||||
nsIWidget * aParentWindow,
|
||||
void * menuNode,
|
||||
void * aWebShell)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
|
|
@ -36,9 +36,14 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIMenuListener interface
|
||||
nsEventStatus MenuItemSelected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuConstruct(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuConstruct(
|
||||
const nsMenuEvent & aMenuEvent,
|
||||
nsIWidget * aParentWindow,
|
||||
void * menuNode,
|
||||
void * aWebShell);
|
||||
nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent);
|
||||
|
||||
nsMenuBar();
|
||||
|
|
|
@ -334,6 +334,11 @@ NS_METHOD nsMenuItem::IsSeparator(PRBool & aIsSep)
|
|||
//-------------------------------------------------------------------------
|
||||
// nsIMenuListener interface
|
||||
//-------------------------------------------------------------------------
|
||||
nsEventStatus nsMenuItem::MenuItemSelected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
nsEventStatus nsMenuItem::MenuSelected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
if(mXULCommandListener)
|
||||
|
@ -350,7 +355,11 @@ nsEventStatus nsMenuItem::MenuDeselected(const nsMenuEvent & aMenuEvent)
|
|||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
nsEventStatus nsMenuItem::MenuConstruct(const nsMenuEvent & aMenuEvent)
|
||||
nsEventStatus nsMenuItem::MenuConstruct(
|
||||
const nsMenuEvent & aMenuEvent,
|
||||
nsIWidget * aParentWindow,
|
||||
void * menuNode,
|
||||
void * aWebShell)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
@ -358,4 +367,44 @@ nsEventStatus nsMenuItem::MenuConstruct(const nsMenuEvent & aMenuEvent)
|
|||
nsEventStatus nsMenuItem::MenuDestruct(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
/**
|
||||
* Sets the JavaScript Command to be invoked when a "gui" event occurs on a source widget
|
||||
* @param aStrCmd the JS command to be cached for later execution
|
||||
* @return NS_OK
|
||||
*/
|
||||
NS_METHOD nsMenuItem::SetCommand(const nsString & aStrCmd)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
/**
|
||||
* Executes the "cached" JavaScript Command
|
||||
* @return NS_OK if the command was executed properly, otherwise an error code
|
||||
*/
|
||||
NS_METHOD nsMenuItem::DoCommand()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenuItem::SetDOMElement(nsIDOMElement * aDOMElement)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenuItem::GetDOMElement(nsIDOMElement ** aDOMElement)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenuItem::SetWebShell(nsIWebShell * aWebShell)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
@ -66,10 +66,21 @@ public:
|
|||
NS_IMETHOD RemoveMenuListener(nsIMenuListener * aMenuListener);
|
||||
NS_IMETHOD IsSeparator(PRBool & aIsSep);
|
||||
|
||||
NS_IMETHOD SetCommand(const nsString & aStrCmd);
|
||||
NS_IMETHOD DoCommand();
|
||||
NS_IMETHOD SetDOMElement(nsIDOMElement * aDOMElement);
|
||||
NS_IMETHOD GetDOMElement(nsIDOMElement ** aDOMElement);
|
||||
NS_IMETHOD SetWebShell(nsIWebShell * aWebShell);
|
||||
|
||||
// nsIMenuListener interface
|
||||
nsEventStatus MenuItemSelected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuConstruct(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuConstruct(
|
||||
const nsMenuEvent & aMenuEvent,
|
||||
nsIWidget * aParentWindow,
|
||||
void * menuNode,
|
||||
void * aWebShell);
|
||||
nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -199,6 +199,11 @@ NS_IMETHODIMP nsXULCommand::ExecuteJavaScriptString(nsIWebShell* aWebShell, nsSt
|
|||
/////////////////////////////////////////////////////////////////////////
|
||||
// nsIMenuListener Method(s)
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
nsEventStatus nsXULCommand::MenuItemSelected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
DoCommand();
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
nsEventStatus nsXULCommand::MenuSelected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
|
@ -212,7 +217,16 @@ nsEventStatus nsXULCommand::MenuDeselected(const nsMenuEvent & aMenuEvent)
|
|||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
nsEventStatus nsXULCommand::MenuConstruct(const nsMenuEvent & aMenuEvent)
|
||||
nsEventStatus nsXULCommand::MenuConstruct(
|
||||
|
||||
const nsMenuEvent & aMenuEvent,
|
||||
|
||||
nsIWidget * aParentWindow,
|
||||
|
||||
void * menubarNode,
|
||||
|
||||
void * aWebShell)
|
||||
|
||||
{
|
||||
DoCommand();
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
|
|
|
@ -57,9 +57,19 @@ public:
|
|||
|
||||
|
||||
// nsIMenuListener
|
||||
virtual nsEventStatus MenuItemSelected(const nsMenuEvent & aMenuEvent);
|
||||
virtual nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent);
|
||||
virtual nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent) ;
|
||||
virtual nsEventStatus MenuConstruct(const nsMenuEvent & aMenuEvent);
|
||||
virtual nsEventStatus MenuConstruct(
|
||||
|
||||
const nsMenuEvent & aMenuEvent,
|
||||
|
||||
nsIWidget * aParentWindow,
|
||||
|
||||
void * menubarNode,
|
||||
|
||||
void * aWebShell);
|
||||
|
||||
virtual nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent);
|
||||
|
||||
protected:
|
||||
|
|
Загрузка…
Ссылка в новой задаче