Back to index

lightning-sunbird  0.9+nobinonly
nsIXTFElement.idl
Go to the documentation of this file.
00001 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is the Mozilla XTF project.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Alex Fritze.
00019  * Portions created by the Initial Developer are Copyright (C) 2004
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Alex Fritze <alex@croczilla.com> (original author)
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #include "nsISupports.idl"
00040 interface nsIAtom;
00041 interface nsIDOMDocument;
00042 interface nsIDOMElement;
00043 interface nsIDOMNode;
00044 interface nsIDOMEvent;
00045 
00046 [scriptable, uuid(a8b607fd-24b6-4a8c-9a89-d9b24f8e2592)]
00047 interface nsIXTFElement : nsISupports
00048 {
00049   // called when the wrapper object is being destroyed.
00050   void onDestroyed();
00051 
00052   // Constants for attribute elementType:
00053 
00054   // Elements of type GENERIC_ELEMENT are required to implement the
00055   // nsIXTFGenericElement interface in addition to nsIXTFElement:
00056   const unsigned long ELEMENT_TYPE_GENERIC_ELEMENT = 0;
00057 
00058   // Elements of type SVG_VISUAL are required to implement the
00059   // nsIXTFSVGVisual interface in addition to nsIXTFElement:
00060   const unsigned long ELEMENT_TYPE_SVG_VISUAL      = 1;
00061 
00062   // Elements of type XML_VISUAL are required to implement the
00063   // nsIXTFXMLVisual interface in addition to nsIXTFElement:
00064   const unsigned long ELEMENT_TYPE_XML_VISUAL      = 2;
00065 
00066   // Elements of type XUL_VISUAL are required to implement the
00067   // nsIXTFXULVisual interface in addition to nsIXTFElement:
00068   const unsigned long ELEMENT_TYPE_XUL_VISUAL      = 3;
00069 
00070   // Elements of type BINDABLE are required to implement the
00071   // nsIXTFBindableElement interface in addition to nsIXTFElement:
00072   const unsigned long ELEMENT_TYPE_BINDABLE        = 4;
00073 
00074   // elementType identifies the type of wrapper that will be built for
00075   // a given xtf element. It must remain constant for the entire
00076   // lifetime of the xtf element (i.e. before any onCreated()-calls
00077   // until after onDestroyed()-calls).
00078   readonly attribute unsigned long elementType;
00079 
00080   // If isAttributeHandler is set to 'true', the xtf element indicates
00081   // that it wants to manage its own attributes. In this case it needs
00082   // to implement the nsIXTFAttributeHandler interface in addition to
00083   // its other interfaces. 'isAttributeHandler' must remain constant
00084   // for the entire lifetime of the xtf element (i.e. before any
00085   // onCreated()-calls until after onDestroyed()-calls).
00086   readonly attribute boolean isAttributeHandler;
00087   
00088   // getScriptingInterfaces: This array serves 2 purposes: a) All
00089   // interfaces in this array will automatically be accessible when
00090   // our wrapper element is used from JS (other interfaces need to be
00091   // explicitly QI'ed for), and b) All these interfaces are callable
00092   // from unpriviliged script.
00093   void getScriptingInterfaces(out unsigned long count,
00094                               [array, size_is(count), retval] out nsIIDPtr array);
00095 
00096   // Notification mask constants:
00097   // To receive a given event set the corresponding bit in
00098   // nsIXTFElementWrapper::notificationMask.
00099   const unsigned long NOTIFY_WILL_CHANGE_DOCUMENT  = 0x00000001;
00100   const unsigned long NOTIFY_DOCUMENT_CHANGED      = 0x00000002;
00101   
00102   const unsigned long NOTIFY_WILL_CHANGE_PARENT    = 0x00000004;
00103   const unsigned long NOTIFY_PARENT_CHANGED        = 0x00000008;
00104   
00105   const unsigned long NOTIFY_WILL_INSERT_CHILD     = 0x00000010;
00106   const unsigned long NOTIFY_CHILD_INSERTED        = 0x00000020;
00107   
00108   const unsigned long NOTIFY_WILL_APPEND_CHILD     = 0x00000040;
00109   const unsigned long NOTIFY_CHILD_APPENDED        = 0x00000080;
00110   
00111   const unsigned long NOTIFY_WILL_REMOVE_CHILD     = 0x00000100;
00112   const unsigned long NOTIFY_CHILD_REMOVED         = 0x00000200;
00113   
00114   const unsigned long NOTIFY_WILL_SET_ATTRIBUTE    = 0x00000400;
00115   const unsigned long NOTIFY_ATTRIBUTE_SET         = 0x00000800;
00116   
00117   const unsigned long NOTIFY_WILL_REMOVE_ATTRIBUTE = 0x00001000;
00118   const unsigned long NOTIFY_ATTRIBUTE_REMOVED     = 0x00002000;
00119   
00120   const unsigned long NOTIFY_BEGIN_ADDING_CHILDREN = 0x00004000;
00121   const unsigned long NOTIFY_DONE_ADDING_CHILDREN  = 0x00008000;
00122   
00123   const unsigned long NOTIFY_HANDLE_DEFAULT        = 0x00010000;
00124   
00125   // Event notifications:
00126 
00127   void willChangeDocument(in nsIDOMDocument newDoc);
00128   void documentChanged(in nsIDOMDocument newDoc);
00129   
00130   void willChangeParent(in nsIDOMElement newParent);
00131   void parentChanged(in nsIDOMElement newParent);
00132 
00133   void willInsertChild(in nsIDOMNode child, in unsigned long index);
00134   void childInserted(in nsIDOMNode child, in unsigned long index);
00135 
00136   void willAppendChild(in nsIDOMNode child);
00137   void childAppended(in nsIDOMNode child);
00138 
00139   void willRemoveChild(in unsigned long index);
00140   void childRemoved(in unsigned long index);
00141 
00142   void willSetAttribute(in nsIAtom name, in AString newValue);
00143   void attributeSet(in nsIAtom name, in AString newValue);
00144 
00145   void willRemoveAttribute(in nsIAtom name);
00146   void attributeRemoved(in nsIAtom name);
00147 
00148   // These are for batching of child insertions during document load
00149 
00150   // beginAddingChildren is called before any attributes or child nodes are
00151   // added to the element.
00152   void beginAddingChildren();
00153   void doneAddingChildren();
00154 
00155   // The default handler for DOM Events.
00156   // This method is called after the normal DOM event flow.
00157   // If the return value is true, the event is marked as handled and
00158   // other default handlers won't be able to handle it again.
00159   boolean handleDefault(in nsIDOMEvent aEvent);
00160 
00161   // Set this element to be equivalent to |aElement|.  This does not need
00162   // to worry about copying attributes or child nodes, but should copy any
00163   // other needed state.
00164   void cloneState(in nsIDOMElement aElement);
00165 };
00166