2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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 07:57:51 +00:00
|
|
|
|
2013-09-22 23:24:27 +00:00
|
|
|
#include "nsISupports.idl"
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
|
|
|
|
interface nsIDOMElement;
|
2010-08-09 16:17:19 +00:00
|
|
|
interface nsIDOMNode;
|
|
|
|
interface nsIDOMEvent;
|
2011-06-03 19:38:23 +00:00
|
|
|
interface nsIDOMClientRect;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
|
2013-05-08 22:59:03 +00:00
|
|
|
[scriptable, uuid(b1192cac-467b-42ca-88d6-fcdec5bb4ef7)]
|
2001-08-18 01:04:47 +00:00
|
|
|
interface nsIPopupBoxObject : nsISupports
|
2000-05-30 07:57:51 +00:00
|
|
|
{
|
2007-07-04 15:49:38 +00:00
|
|
|
/**
|
|
|
|
* This method is deprecated. Use openPopup or openPopupAtScreen instead.
|
|
|
|
*/
|
2001-08-18 01:04:47 +00:00
|
|
|
void showPopup(in nsIDOMElement srcContent, in nsIDOMElement popupContent,
|
|
|
|
in long xpos, in long ypos,
|
|
|
|
in wstring popupType, in wstring anchorAlignment,
|
|
|
|
in wstring popupAlignment);
|
2001-09-10 07:33:33 +00:00
|
|
|
|
2007-07-04 15:49:38 +00:00
|
|
|
/**
|
|
|
|
* Hide the popup if it is open.
|
|
|
|
*/
|
|
|
|
void hidePopup();
|
2007-06-29 22:15:59 +00:00
|
|
|
|
2001-09-10 07:33:33 +00:00
|
|
|
/**
|
|
|
|
* Allow the popup to automatically position itself.
|
|
|
|
*/
|
|
|
|
attribute boolean autoPosition;
|
|
|
|
|
|
|
|
/**
|
2007-07-04 15:49:38 +00:00
|
|
|
* 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.
|
2001-09-10 07:33:33 +00:00
|
|
|
*/
|
|
|
|
void enableKeyboardNavigator(in boolean enableKeyboardNavigator);
|
|
|
|
|
|
|
|
/**
|
2006-03-23 22:08:37 +00:00
|
|
|
* Enable automatic popup dismissal. This only has effect when called
|
|
|
|
* on an open popup.
|
2001-09-10 07:33:33 +00:00
|
|
|
*/
|
|
|
|
void enableRollup(in boolean enableRollup);
|
|
|
|
|
2005-12-31 23:34:46 +00:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
const uint32_t ROLLUP_DEFAULT = 0; /* widget/platform default */
|
|
|
|
const uint32_t ROLLUP_CONSUME = 1; /* consume the rollup event */
|
|
|
|
const uint32_t ROLLUP_NO_CONSUME = 2; /* don't consume the rollup event */
|
|
|
|
void setConsumeRollupEvent(in uint32_t consume);
|
2005-12-31 23:34:46 +00:00
|
|
|
|
2001-09-10 07:33:33 +00:00
|
|
|
/**
|
|
|
|
* Size the popup to the given dimensions
|
|
|
|
*/
|
|
|
|
void sizeTo(in long width, in long height);
|
|
|
|
|
|
|
|
/**
|
2007-07-04 15:49:38 +00:00
|
|
|
* Move the popup to a point on screen in CSS pixels.
|
2001-09-10 07:33:33 +00:00
|
|
|
*/
|
|
|
|
void moveTo(in long left, in long top);
|
|
|
|
|
2007-07-04 15:49:38 +00: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.
|
|
|
|
*
|
|
|
|
* For an anchored popup, the x and y arguments may be used to offset the
|
2007-11-17 15:47:38 +00: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 15:49:38 +00: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
|
|
|
|
* @param position manner is which to anchor the popup to node
|
|
|
|
* @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 16:17:19 +00:00
|
|
|
* @param triggerEvent the event that triggered this popup (mouse click for example)
|
2007-07-04 15:49:38 +00:00
|
|
|
*/
|
|
|
|
void openPopup(in nsIDOMElement anchorElement,
|
|
|
|
in AString position,
|
|
|
|
in long x, in long y,
|
|
|
|
in boolean isContextMenu,
|
2010-08-09 16:17:19 +00:00
|
|
|
in boolean attributesOverride,
|
|
|
|
in nsIDOMEvent triggerEvent);
|
2007-07-04 15:49:38 +00: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 05:04:41 +00: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 15:49:38 +00:00
|
|
|
*
|
|
|
|
* @param isContextMenu true for context menus, false for other popups
|
|
|
|
* @param x horizontal screen position
|
|
|
|
* @param y vertical screen position
|
2010-08-09 16:17:19 +00:00
|
|
|
* @param triggerEvent the event that triggered this popup (mouse click for example)
|
2007-07-04 15:49:38 +00:00
|
|
|
*/
|
2010-08-09 16:17:19 +00:00
|
|
|
void openPopupAtScreen(in long x, in long y,
|
|
|
|
in boolean isContextMenu,
|
|
|
|
in nsIDOMEvent triggerEvent);
|
2007-08-15 23:52:47 +00: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
|
|
|
|
*/
|
|
|
|
readonly attribute AString popupState;
|
2010-08-09 16:17:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The node that triggered the popup. If the popup is not open, will return
|
|
|
|
* null.
|
|
|
|
*/
|
|
|
|
readonly attribute nsIDOMNode triggerNode;
|
2010-09-21 17:53:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve the anchor that was specified to openPopup or for menupopups in a
|
|
|
|
* menu, the parent menu.
|
|
|
|
*/
|
|
|
|
readonly attribute nsIDOMElement anchorNode;
|
2011-06-03 19:38:23 +00:00
|
|
|
|
2012-10-23 12:11:13 +00:00
|
|
|
/**
|
2011-06-03 19:38:23 +00:00
|
|
|
* Retrieve the screen rectangle of the popup, including the area occupied by
|
|
|
|
* any titlebar or borders present.
|
|
|
|
*/
|
|
|
|
nsIDOMClientRect getOuterScreenRect();
|
2012-10-23 12:11:13 +00: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.
|
|
|
|
*/
|
|
|
|
void moveToAnchor(in nsIDOMElement anchorElement,
|
|
|
|
in AString position,
|
|
|
|
in long x, in long y,
|
|
|
|
in boolean attributesOverride);
|
2013-04-19 00:47:27 +00:00
|
|
|
|
|
|
|
/** Returns the alignment position where the popup has appeared relative to its
|
|
|
|
* anchor node or point, accounting for any flipping that occurred.
|
|
|
|
*/
|
|
|
|
readonly attribute AString alignmentPosition;
|
2013-05-08 22:59:03 +00:00
|
|
|
readonly attribute long alignmentOffset;
|
2000-05-30 07:57:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
%{C++
|
2013-09-22 23:24:27 +00:00
|
|
|
class nsIBoxObject;
|
|
|
|
|
2000-05-30 07:57:51 +00:00
|
|
|
nsresult
|
2001-08-18 01:04:47 +00:00
|
|
|
NS_NewPopupBoxObject(nsIBoxObject** aResult);
|
2000-05-30 07:57:51 +00:00
|
|
|
|
|
|
|
%}
|