1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is mozilla.org code.
16 *
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 2000
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 * David Hyatt <hyatt@netscape.com> (original author)
24 * Johnny Stenback <jst@netscape.com>
25 *
26 * Alternatively, the contents of this file may be used under the terms of
27 * either of the GNU General Public License Version 2 or later (the "GPL"),
28 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
37 *
38 * ***** END LICENSE BLOCK ***** */
39
40 #include "domstubs.idl"
41
42 interface nsIDOMXULCommandDispatcher;
43 interface nsIObserver;
44
45 [scriptable, uuid(9816241b-2a20-44ff-903b-575f40c0ecc5)]
46 interface nsIDOMXULDocument : nsISupports
47 {
48 attribute nsIDOMNode popupNode;
49
50 /**
51 * These attributes correspond to trustedGetPopupNode().rangeOffset and
52 * rangeParent. They will help you find where in the DOM the popup is
53 * happening. Can be accessed from chrome only, and only during a popup
54 * event. Accessing any other time will be an error.
55 */
56 readonly attribute nsIDOMNode popupRangeParent;
57 readonly attribute long popupRangeOffset;
58
59 attribute nsIDOMNode tooltipNode;
60
61 readonly attribute nsIDOMXULCommandDispatcher commandDispatcher;
62
63 readonly attribute long width;
64 readonly attribute long height;
65
66 nsIDOMNodeList getElementsByAttribute(in DOMString name,
67 in DOMString value);
68
69 nsIDOMNodeList getElementsByAttributeNS(in DOMString namespaceURI,
70 in DOMString name,
71 in DOMString value);
72
73 void addBroadcastListenerFor(in nsIDOMElement broadcaster,
74 in nsIDOMElement observer,
75 in DOMString attr);
76
77 void removeBroadcastListenerFor(in nsIDOMElement broadcaster,
78 in nsIDOMElement observer,
79 in DOMString attr);
80
81 void persist(in DOMString id, in DOMString attr);
82
83 /**
84 * Loads a XUL overlay and merges it with the current document, notifying an
85 * observer when the merge is complete.
86 * @param url
87 * The URL of the overlay to load and merge
88 * @param observer
89 * An object implementing nsIObserver that will be notified with a
90 * message of topic "xul-overlay-merged" when the merge is complete.
91 * The subject parameter of |observe| will QI to a nsIURI - the URI
92 * of the merged overlay. This parameter is optional and may be null.
93 *
94 * NOTICE: In the 2.0 timeframe this API will change such that the
95 * implementation will fire a DOMXULOverlayMerged event upon merge
96 * completion rather than notifying an observer. Do not rely on this
97 * API's behavior _not_ to change because it will!
98 * - Ben Goodger (8/23/2005)
99 */
100 void loadOverlay(in DOMString url, in nsIObserver aObserver);
101
102 /**
103 * Get the popup node from this XUL document without doing a security check to
104 * make sure that the caller has access to this node. This is for use from C++
105 * callers that can indirectly be called from content.
106 */
107 [noscript] nsIDOMNode trustedGetPopupNode();
108
109 /**
110 * Like trustedGetPopupNode, but gets the tooltip node instead.
111 */
112 [noscript] nsIDOMNode trustedGetTooltipNode();
113 };