2018-09-13 23:04:55 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2000-05-30 11:57:51 +04:00
|
|
|
|
2018-04-27 18:04:37 +03:00
|
|
|
dictionary OpenPopupOptions {
|
|
|
|
// manner in which to anchor the popup to node
|
|
|
|
DOMString position = "";
|
|
|
|
// horizontal offset
|
|
|
|
long x = 0;
|
|
|
|
// vertical offset
|
|
|
|
long y = 0;
|
|
|
|
// isContextMenu true for context menus, false for other popups
|
|
|
|
boolean isContextMenu = false;
|
|
|
|
// true if popup node attributes override position
|
|
|
|
boolean attributesOverride = false;
|
|
|
|
// triggerEvent the event that triggered this popup (mouse click for example)
|
|
|
|
Event? triggerEvent = null;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef (DOMString or OpenPopupOptions) StringOrOpenPopupOptions;
|
|
|
|
|
2018-04-27 18:04:38 +03:00
|
|
|
[HTMLConstructor, Func="IsChromeOrXBL"]
|
|
|
|
interface XULPopupElement : XULElement
|
2000-05-30 11:57:51 +04:00
|
|
|
{
|
2014-10-15 00:15:21 +04:00
|
|
|
/**
|
2001-09-10 11:33:33 +04:00
|
|
|
* Allow the popup to automatically position itself.
|
|
|
|
*/
|
|
|
|
attribute boolean autoPosition;
|
|
|
|
|
2007-07-04 19:49:38 +04:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*
|
2014-10-15 00:15:21 +04:00
|
|
|
* For an anchored popup, the x and y arguments may be used to offset the
|
2007-11-17 18:47:38 +03:00
|
|
|
* 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.
|
2007-07-04 19:49:38 +04:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* @param anchorElement the node to anchor the popup to, may be null
|
2018-04-27 18:04:37 +03:00
|
|
|
* @param options either options to use, or a string position
|
2007-07-04 19:49:38 +04:00
|
|
|
* @param x horizontal offset
|
|
|
|
* @param y vertical offset
|
|
|
|
* @param isContextMenu true for context menus, false for other popups
|
|
|
|
* @param attributesOverride true if popup node attributes override position
|
2010-08-09 20:17:19 +04:00
|
|
|
* @param triggerEvent the event that triggered this popup (mouse click for example)
|
2007-07-04 19:49:38 +04:00
|
|
|
*/
|
2018-04-27 18:04:37 +03:00
|
|
|
void openPopup(optional Element? anchorElement = null,
|
2019-07-03 10:46:39 +03:00
|
|
|
optional StringOrOpenPopupOptions options,
|
2018-04-27 18:04:37 +03:00
|
|
|
optional long x = 0,
|
|
|
|
optional long y = 0,
|
|
|
|
optional boolean isContextMenu = false,
|
|
|
|
optional boolean attributesOverride = false,
|
|
|
|
optional Event? triggerEvent = null);
|
2007-07-04 19:49:38 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
2009-09-23 09:04:41 +04:00
|
|
|
* screen. The x and y coordinates are measured in CSS pixels, and like all
|
|
|
|
* screen coordinates, are given relative to the top left of the primary
|
|
|
|
* screen.
|
2007-07-04 19:49:38 +04:00
|
|
|
*
|
|
|
|
* @param isContextMenu true for context menus, false for other popups
|
|
|
|
* @param x horizontal screen position
|
|
|
|
* @param y vertical screen position
|
2010-08-09 20:17:19 +04:00
|
|
|
* @param triggerEvent the event that triggered this popup (mouse click for example)
|
2007-07-04 19:49:38 +04:00
|
|
|
*/
|
2018-04-27 18:04:38 +03:00
|
|
|
void openPopupAtScreen(optional long x = 0, optional long y = 0,
|
|
|
|
optional boolean isContextMenu = false,
|
|
|
|
optional Event? triggerEvent = null);
|
2007-08-16 03:52:47 +04:00
|
|
|
|
2015-05-08 21:49:54 +03:00
|
|
|
/**
|
|
|
|
* Open the popup anchored at a specific screen rectangle. This function is
|
|
|
|
* similar to openPopup except that that rectangle of the anchor is supplied
|
|
|
|
* rather than an element. The anchor rectangle arguments are screen
|
|
|
|
* coordinates.
|
|
|
|
*/
|
|
|
|
void openPopupAtScreenRect(optional DOMString position = "",
|
2018-04-27 18:04:38 +03:00
|
|
|
optional long x = 0,
|
|
|
|
optional long y = 0,
|
|
|
|
optional long width = 0,
|
|
|
|
optional long height = 0,
|
|
|
|
optional boolean isContextMenu = false,
|
|
|
|
optional boolean attributesOverride = false,
|
|
|
|
optional Event? triggerEvent = null);
|
2015-05-08 21:49:54 +03:00
|
|
|
|
2018-04-27 18:04:37 +03:00
|
|
|
/**
|
|
|
|
* Hide the popup if it is open. The cancel argument is used as a hint that
|
|
|
|
* the popup is being closed because it has been cancelled, rather than
|
|
|
|
* something being selected within the panel.
|
|
|
|
*
|
|
|
|
* @param cancel if true, then the popup is being cancelled.
|
|
|
|
*/
|
|
|
|
void hidePopup(optional boolean cancel = false);
|
|
|
|
|
2018-04-27 18:04:38 +03:00
|
|
|
/**
|
|
|
|
* Attribute getter and setter for label.
|
|
|
|
*/
|
|
|
|
[SetterThrows]
|
|
|
|
attribute DOMString label;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Attribute getter and setter for position.
|
|
|
|
*/
|
|
|
|
[SetterThrows]
|
|
|
|
attribute DOMString position;
|
|
|
|
|
2007-08-16 03:52:47 +04:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2018-04-27 18:04:38 +03:00
|
|
|
readonly attribute DOMString state;
|
2010-08-09 20:17:19 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The node that triggered the popup. If the popup is not open, will return
|
|
|
|
* null.
|
|
|
|
*/
|
2014-10-15 00:15:21 +04:00
|
|
|
readonly attribute Node? triggerNode;
|
2010-09-21 21:53:01 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve the anchor that was specified to openPopup or for menupopups in a
|
|
|
|
* menu, the parent menu.
|
|
|
|
*/
|
2014-10-15 00:15:21 +04:00
|
|
|
readonly attribute Element? anchorNode;
|
2011-06-03 23:38:23 +04:00
|
|
|
|
2012-10-23 16:11:13 +04:00
|
|
|
/**
|
2011-06-03 23:38:23 +04:00
|
|
|
* Retrieve the screen rectangle of the popup, including the area occupied by
|
|
|
|
* any titlebar or borders present.
|
|
|
|
*/
|
2014-10-15 00:15:21 +04:00
|
|
|
DOMRect getOuterScreenRect();
|
2012-10-23 16:11:13 +04:00
|
|
|
|
2018-04-27 18:04:37 +03:00
|
|
|
/**
|
|
|
|
* Move the popup to a point on screen in CSS pixels.
|
|
|
|
*/
|
|
|
|
void moveTo(long left, long top);
|
|
|
|
|
2012-10-23 16:11:13 +04:00
|
|
|
/**
|
|
|
|
* Move an open popup to the given anchor position. The arguments have the same
|
|
|
|
* meaning as the corresponding argument to openPopup. This method has no effect
|
|
|
|
* on popups that are not open.
|
|
|
|
*/
|
2018-04-27 18:04:38 +03:00
|
|
|
void moveToAnchor(optional Element? anchorElement = null,
|
2014-10-21 00:33:09 +04:00
|
|
|
optional DOMString position = "",
|
2018-04-27 18:04:38 +03:00
|
|
|
optional long x = 0, optional long y = 0,
|
|
|
|
optional boolean attributesOverride = false);
|
2013-04-19 04:47:27 +04:00
|
|
|
|
2018-04-27 18:04:37 +03:00
|
|
|
/**
|
|
|
|
* Size the popup to the given dimensions
|
|
|
|
*/
|
|
|
|
void sizeTo(long width, long height);
|
|
|
|
|
2013-04-19 04:47:27 +04:00
|
|
|
/** Returns the alignment position where the popup has appeared relative to its
|
|
|
|
* anchor node or point, accounting for any flipping that occurred.
|
|
|
|
*/
|
2014-10-15 00:15:21 +04:00
|
|
|
readonly attribute DOMString alignmentPosition;
|
2013-05-09 02:59:03 +04:00
|
|
|
readonly attribute long alignmentOffset;
|
2013-09-23 03:24:27 +04:00
|
|
|
|
2016-06-09 18:34:12 +03:00
|
|
|
void setConstraintRect(DOMRectReadOnly rect);
|
2014-10-15 00:15:21 +04:00
|
|
|
};
|