How do I know if XUL menupopup opens or up?
I have an extension that can be placed on any toolbar (like bookmarks, menus, or status bars). In general, the context menu opens down, but when it is placed on the status bar and Firefox closes at the bottom of the screen, the context menu opens up. I would like to try reordering the context menu based on up or down orientation, so that the same options are always closest to the mouse.
For example, when opened down, it looks like this:
-> (mouse) --------------- - MenuItem A - --------------- - MenuItem B - --------------- - MenuItem C - --------------- - ....... - ---------------
When it opens up like this:
--------------- - MenuItem A - --------------- - MenuItem B - --------------- - MenuItem C - --------------- - ....... - --------------- -> (mouse)
However, I would like "MenuItem A" to always appear closest to the mouse, since it is the most common item. I can render elements dynamically, so I just need to figure out the orientation.
a source to share
When developing an FF extension, the MDC documents are invaluable. Be prepared to spend a lot of time there.
Irc.mozilla.net also has a lot of great help from various channels. Most of the pages in MDC will tell you about the appropriate channel for the page you are looking at. Look for "discuss on irc" in the upper right corner.
Some possible documents for you:
https://developer.mozilla.org/en/XUL:menupopup#a-popup.position
a source to share