WARNING: Most of this content (with the exception of the Mozilla 1.9 XPCOM reference) is very old, and can be expected to be out of date and possibly obsolete. For better XUL documentation, please visit the XUL hub at the Mozilla Developer Center.

nsIPopupBoxObject

IID:A41AF368-9F73-4D73-A058-49DD7E41F9EA
Inherits From:nsISupports

This interface is implemented by the following components:


Constants

Control whether the event that caused the popup to be automatically dismissed ("rolled up") should be consumed, or dispatched as a normal event. This should be set immediately before calling showPopup() if non-default behavior is desired.
PRUint32 ROLLUP_DEFAULT = 0
PRUint32 ROLLUP_CONSUME = 1
PRUint32 ROLLUP_NO_CONSUME = 2

Properties

PRBool autoPosition

Allow the popup to automatically position itself.

readonly AString popupState

Returns the state of the popup: closed - the popup is closed open - the popup is open showing - the popup is in the process of being shown hiding - the popup is in the process of being hidden


Methods

void enableKeyboardNavigator ( PRBool enableKeyboardNavigator ) void enableRollup ( PRBool enableRollup ) void hidePopup ( ) void moveTo ( PRInt32 left , PRInt32 top ) void openPopup ( nsIDOMElement anchorElement , AString position , PRInt32 x , PRInt32 y , PRBool isContextMenu , PRBool attributesOverride ) void openPopupAtScreen ( PRInt32 x , PRInt32 y , PRBool isContextMenu ) void setConsumeRollupEvent ( PRUint32 consume ) void showPopup ( nsIDOMElement srcContent , nsIDOMElement popupContent , PRInt32 xpos , PRInt32 ypos , PRUnichar* popupType , PRUnichar* anchorAlignment , PRUnichar* popupAlignment ) void sizeTo ( PRInt32 width , PRInt32 height )

void enableKeyboardNavigator ( PRBool enableKeyboardNavigator )

If keyboard navigation is enabled, the keyboard may be used to navigate the menuitems on the popup. Enabling keyboard navigation is the default behaviour and will install capturing key event listeners on the popup that do not propagate key events to the contents. If you wish to place elements in a popup which accept key events, such as textboxes, keyboard navigation should be disabled.

Setting ignorekeys="true" on the popup element also disables keyboard navigation, and is recommended over calling this method.

Arguments:
enableKeyboardNavigator

void enableRollup ( PRBool enableRollup )

Enable automatic popup dismissal. This only has effect when called on an open popup.

Arguments:
enableRollup

void hidePopup ( )

Hide the popup if it is open.


void moveTo ( PRInt32 left , PRInt32 top )

Move the popup to a point on screen in CSS pixels.

Arguments:
left
top

void openPopup ( nsIDOMElement anchorElement , AString position , PRInt32 x , PRInt32 y , PRBool isContextMenu , PRBool attributesOverride )

Open the popup relative to a specified node at a specific location.

The popup may be either anchored to another node or opened freely. To anchor a popup to a node, supply an anchor node and set the position to a string indicating the manner in which the popup should be anchored. Possible values for position are: before_start, before_end, after_start, after_end, start_before, start_after, end_before, end_after, overlap, after_pointer

The anchor node does not need to be in the same document as the popup.

If the attributesOverride argument is true, the popupanchor, popupalign and position attributes on the popup node override the position value argument. If attributesOverride is false, the attributes are only used if position is empty.

For an anchored popup, the x and y arguments may be used to offset the popup from its anchored position by some distance, measured in CSS pixels. x increases to the right and y increases down. Negative values may also be used to move to the left and upwards respectively.

Unanchored popups may be created by supplying null as the anchor node. An unanchored popup appears at the position specified by x and y, relative to the viewport of the document containing the popup node. In this case, position and attributesOverride are ignored.

Arguments:
anchorElement: the node to anchor the popup to, may be null
position: manner is which to anchor the popup to node
x: horizontal offset
y: vertical offset
isContextMenu: true for context menus, false for other popups
attributesOverride: true if popup node attributes override position

void openPopupAtScreen ( PRInt32 x , PRInt32 y , PRBool isContextMenu )

Open the popup at a specific screen position specified by x and y. This position may be adjusted if it would cause the popup to be off of the screen. The x and y coordinates are measured in CSS pixels. The monitor selected is determined within the platform specific widget code, but in general, the coordinates are relative to the screen the window containing the popup is on.

Arguments:
x: horizontal screen position
y: vertical screen position
isContextMenu: true for context menus, false for other popups

void setConsumeRollupEvent ( PRUint32 consume )

Arguments:
consume

void showPopup ( nsIDOMElement srcContent , nsIDOMElement popupContent , PRInt32 xpos , PRInt32 ypos , PRUnichar* popupType , PRUnichar* anchorAlignment , PRUnichar* popupAlignment )

This method is deprecated. Use openPopup or openPopupAtScreen instead.

Arguments:
srcContent
popupContent
xpos
ypos
popupType
anchorAlignment
popupAlignment

void sizeTo ( PRInt32 width , PRInt32 height )

Size the popup to the given dimensions

Arguments:
width
height

Reference documentation is generated from Mozilla's source.

Copyright © 1999-2006 XULPlanet.com