Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions
nsPluginDOMContextMenuListener Class Reference
Inheritance diagram for nsPluginDOMContextMenuListener:
Inheritance graph
[legend]
Collaboration diagram for nsPluginDOMContextMenuListener:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsPluginDOMContextMenuListener ()
virtual ~nsPluginDOMContextMenuListener ()
NS_DECL_ISUPPORTS NS_IMETHOD ContextMenu (nsIDOMEvent *aContextMenuEvent)
 Processes a context menu event.
nsresult Init (nsObjectFrame *aFrame)
nsresult Destroy (nsObjectFrame *aFrame)
NS_IMETHOD HandleEvent (nsIDOMEvent *aEvent)
nsEventStatus ProcessEvent (const nsGUIEvent &anEvent)
 Processes all events.
void handleEvent (in nsIDOMEvent event)
 This method is called whenever an event occurs of the type for which the EventListener interface was registered.

Detailed Description

Definition at line 185 of file nsObjectFrame.cpp.


Constructor & Destructor Documentation

Definition at line 2221 of file nsObjectFrame.cpp.

{
}

Definition at line 2225 of file nsObjectFrame.cpp.

{
}

Member Function Documentation

Processes a context menu event.

Parameters:
aContextMenuEvent
See also:
nsIDOMEvent.h
Returns:
whether the event was consumed or ignored.
See also:
nsresult

Implements nsIDOMContextMenuListener.

Definition at line 2232 of file nsObjectFrame.cpp.

{
  aContextMenuEvent->PreventDefault(); // consume event

  return NS_OK;
}

Definition at line 2259 of file nsObjectFrame.cpp.

{
  nsIContent* content = aFrame->GetContent();

  // Unregister context menu listener
  if (content) {
    nsCOMPtr<nsIDOMEventTarget> receiver(do_QueryInterface(content));
    if (receiver) {
      nsCOMPtr<nsIDOMContextMenuListener> cxMenuListener;
      QueryInterface(NS_GET_IID(nsIDOMContextMenuListener), getter_AddRefs(cxMenuListener));
      if (cxMenuListener) { 
        receiver->RemoveEventListener(NS_LITERAL_STRING("contextmenu"), cxMenuListener, PR_TRUE);
      }
      else NS_ASSERTION(PR_FALSE, "Unable to remove event listener for plugin");
    }
    else NS_ASSERTION(PR_FALSE, "plugin was not an event listener");
  }
  else NS_ASSERTION(PR_FALSE, "plugin had no content");

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

This method is called whenever an event occurs of the type for which the EventListener interface was registered.

Parameters:
evtThe Event contains contextual information about the event. It also contains the stopPropagation and preventDefault methods which are used in determining the event's flow and default action.

Definition at line 199 of file nsObjectFrame.cpp.

  {
    return NS_OK;
  }

Definition at line 2239 of file nsObjectFrame.cpp.

{
  nsIContent* content = aFrame->GetContent();

  // Register context menu listener
  if (content) {
    nsCOMPtr<nsIDOMEventTarget> receiver(do_QueryInterface(content));
    if (receiver) {
      nsCOMPtr<nsIDOMContextMenuListener> cxMenuListener;
      QueryInterface(NS_GET_IID(nsIDOMContextMenuListener), getter_AddRefs(cxMenuListener));
      if (cxMenuListener) {
        receiver->AddEventListener(NS_LITERAL_STRING("contextmenu"), cxMenuListener, PR_TRUE);
        return NS_OK;
      }
    }
  }

  return NS_ERROR_NO_INTERFACE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Processes all events.

If a mouse listener is registered this method will not process mouse events.

Parameters:
anEventthe event to process. See nsGUIEvent.h for event types.

Implements nsIEventListener.

Definition at line 203 of file nsObjectFrame.cpp.


The documentation for this class was generated from the following file: