Something like this should work:
Please correct me if something should be done otherwise.

        nsCOMPtr<nsIDOMNode>            pINode                  = // Initialize 
from wherever. We
assume you have this pointer here

        nsCOMPtr<nsIDOMDocument>        pIDOMDocument;
        pINode->GetOwnerDocument( getter_AddRefs( pIDOMDocument ) );

        nsCOMPtr<nsIDOMDocumentEvent> pDOMDocEvent
( do_QueryInterface( pIDOMDocument ) );
        nsCOMPtr<nsIDOMEvent> pEvent;
        rv =    pDOMDocEvent->CreateEvent(NS_LITERAL_STRING("mouseevent"),
getter_AddRefs( pEvent ) );
        nsCOMPtr<nsIDOMMouseEvent> pMouseEvent
( do_QueryInterface( pEvent ) );

        PRBool bRetval ;
        pMouseEvent->InitMouseEvent(NS_LITERAL_STRING("mouseover"), PR_TRUE,
PR_FALSE, nsnull, 1, 0, 0, 0, 0, PR_FALSE, PR_FALSE, PR_FALSE,
PR_FALSE, 0, 0 );
        pEventTgt->DispatchEvent( pMouseEvent, &bRetval );
        pMouseEvent->InitMouseEvent(NS_LITERAL_STRING("click"), PR_TRUE,
PR_FALSE, nsnull, 1, 0, 0, 0, 0, PR_FALSE, PR_FALSE, PR_FALSE,
PR_FALSE, 0, 0 );
        pEventTgt->DispatchEvent( pMouseEvent, &bRetval );
        pMouseEvent->InitMouseEvent(NS_LITERAL_STRING("mouseout"), PR_TRUE,
PR_FALSE, nsnull, 1, 0, 0, 0, 0, PR_FALSE, PR_FALSE, PR_FALSE,
PR_FALSE, 0, 0 );
        pEventTgt->DispatchEvent( pMouseEvent, &bRetval );

_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to