Closed Bug 35562 Opened 25 years ago Closed 25 years ago

Need the ability to do a context menu in the embedding case

Categories

(Core Graveyard :: Embedding: APIs, defect, P3)

x86
Other
defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: travis, Assigned: adamlock)

References

Details

(Keywords: embed, Whiteboard: [nsbeta3+])

Embedding currently has no ability to do a context menu. In some way we are going to have to hook up a xul window to provide the context menus for our embedding.
Blocks: 35556
Sorry for the spam, changing QA contact.
QA Contact: paulmac → jrgm
-> adam
Assignee: travis → adamlock
The easiest way to implement popups with no explicit support from mozilla is to register a mouse DOM event listener on the current document. When the MouseDown event fires, use the nsIDOMMouseEvent to ensure that it's the rightmouse button and to get the DOM node/element was clicked on. I'm currently thinking of ways I could put some of this code into webbrowser. Ideally I would like webbrowser to detect the right mouse click and and notify the client to deal with it. How abstract this should be is undecided.
I also investigated webbrowser and noticed that it always assumes that it's the topmost content docshelltreeitem, never chrome. If we intend to allow XUL popup menus, then webbrowser will have to be a chrome docshelltree item so that we can attach a XUL popup handler to an invisible chrome wrapper around the content that catches mouse events.
Status: NEW → ASSIGNED
Keywords: embed
Keywords: nsbeta3
A desirable further requirement is for developers who use the embedding XUL to be able to implement C++ callback on their webbrowser site which is called when the XUL popup is about to be displayed. The callback gives the site the chance to remove, add, enable & disable items on the menu before they are shown. When an item from the menu is selected, the C++ is called once more with the result which it can choose to what it likes with or let the XUL do the default behaviour. To kick some ideas around, here are some of the issues to be resolved. 1. Is the menu callback done every time or just the once? If it's done everytime, it means the menu has to be rebuilt and makes it more costly to display. 2. Are submenus allowed? If yes then we might as pass the menu's DOM to the C++ client and let them do what they like with it. 3. Can we mix C++ menu items with standard XUL onclick handled items? 4. Do we pass a 'context' with the menu. The C++ might want to show different items for a click on a link than for selected text. An alternative to all this would be to implement a Javascript global object with some simple methods - doCommand() and queryCommand(). The embedder would implement the dynamic menu logic entirely in Javascript and use the helper object if it needed to call to the C++ for any reason.
+
Whiteboard: nsbeta3+
Whiteboard: nsbeta3+ → [nsbeta3+]
Target Milestone: --- → M18
Adding requirement of 48220 to here: nsIContextMenuListener needs an input field enum
*** Bug 48220 has been marked as a duplicate of this bug. ***
Fix checked in
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
How can I verify this bug
Blanca, there are two ways: 1. Take my word for it that it's working :) 2. Build mozilla/embedding/browser/activex/tests/cbrowse on Win32. Install the Mozilla ActiveX control as per the instructions on http://www.iol.ie/~locka/mozilla/mozilla.htm. Run CBrowse, selecting the Mozilla control to test. Browse to a web page, e.g. http://www.mozilla.org and right click anywhere on it. If a popup menu appears, the context menu code is working.
Updating QA Contact
QA Contact: jrgm → mdunn
Correction: Changing QA contact for the Embed API bugs to David Epstein.
QA Contact: mdunn → depstein
QA Contact: depstein → dsirnapalli
change qa contact to dsirnapalli. He'll work with context menus.
In mfcEmbed the context menu is working.This mean embedding currently has the ability to do a context menu. marking it to verified.
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.