Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef nsIXULDocument_h___ |
michael@0 | 7 | #define nsIXULDocument_h___ |
michael@0 | 8 | |
michael@0 | 9 | #include "nsISupports.h" |
michael@0 | 10 | #include "nsString.h" |
michael@0 | 11 | #include "nsCOMArray.h" |
michael@0 | 12 | |
michael@0 | 13 | class nsIXULTemplateBuilder; |
michael@0 | 14 | class nsIContent; |
michael@0 | 15 | |
michael@0 | 16 | |
michael@0 | 17 | // 81ba4be5-6cc5-478a-9b08-b3e7ed524455 |
michael@0 | 18 | #define NS_IXULDOCUMENT_IID \ |
michael@0 | 19 | {0x81ba4be5, 0x6cc5, 0x478a, {0x9b, 0x08, 0xb3, 0xe7, 0xed, 0x52, 0x44, 0x55}} |
michael@0 | 20 | |
michael@0 | 21 | |
michael@0 | 22 | /* |
michael@0 | 23 | * An XUL-specific extension to nsIDocument. Includes methods for |
michael@0 | 24 | * setting the root resource of the document content model, a factory |
michael@0 | 25 | * method for constructing the children of a node, etc. |
michael@0 | 26 | */ |
michael@0 | 27 | class nsIXULDocument : public nsISupports |
michael@0 | 28 | { |
michael@0 | 29 | public: |
michael@0 | 30 | NS_DECLARE_STATIC_IID_ACCESSOR(NS_IXULDOCUMENT_IID) |
michael@0 | 31 | |
michael@0 | 32 | /** |
michael@0 | 33 | * Get the elements for a particular resource --- all elements whose 'id' |
michael@0 | 34 | * or 'ref' is aID. The nsCOMArray will be truncated and filled in with |
michael@0 | 35 | * nsIContent pointers. |
michael@0 | 36 | */ |
michael@0 | 37 | virtual void GetElementsForID(const nsAString& aID, nsCOMArray<nsIContent>& aElements) = 0; |
michael@0 | 38 | |
michael@0 | 39 | /** |
michael@0 | 40 | * Notify the XUL document that a subtree has been added |
michael@0 | 41 | */ |
michael@0 | 42 | NS_IMETHOD AddSubtreeToDocument(nsIContent* aElement) = 0; |
michael@0 | 43 | |
michael@0 | 44 | /** |
michael@0 | 45 | * Notify the XUL document that a subtree has been removed |
michael@0 | 46 | */ |
michael@0 | 47 | NS_IMETHOD RemoveSubtreeFromDocument(nsIContent* aElement) = 0; |
michael@0 | 48 | |
michael@0 | 49 | /** |
michael@0 | 50 | * Attach a XUL template builder to the specified content node. |
michael@0 | 51 | * @param aBuilder the template builder to attach, or null if |
michael@0 | 52 | * the builder is to be removed. |
michael@0 | 53 | */ |
michael@0 | 54 | NS_IMETHOD SetTemplateBuilderFor(nsIContent* aContent, nsIXULTemplateBuilder* aBuilder) = 0; |
michael@0 | 55 | |
michael@0 | 56 | /** |
michael@0 | 57 | * Retrieve the XUL template builder that's attached to a content |
michael@0 | 58 | * node. |
michael@0 | 59 | */ |
michael@0 | 60 | NS_IMETHOD GetTemplateBuilderFor(nsIContent* aContent, nsIXULTemplateBuilder** aResult) = 0; |
michael@0 | 61 | |
michael@0 | 62 | /** |
michael@0 | 63 | * This is invoked whenever the prototype for this document is loaded |
michael@0 | 64 | * and should be walked, regardless of whether the XUL cache is |
michael@0 | 65 | * disabled, whether the protototype was loaded, whether the |
michael@0 | 66 | * prototype was loaded from the cache or created by parsing the |
michael@0 | 67 | * actual XUL source, etc. |
michael@0 | 68 | * |
michael@0 | 69 | * @param aResumeWalk whether this should also call ResumeWalk(). |
michael@0 | 70 | * Sometimes the caller of OnPrototypeLoadDone resumes the walk itself |
michael@0 | 71 | */ |
michael@0 | 72 | NS_IMETHOD OnPrototypeLoadDone(bool aResumeWalk) = 0; |
michael@0 | 73 | |
michael@0 | 74 | /** |
michael@0 | 75 | * Callback notifying when a document could not be parsed properly. |
michael@0 | 76 | */ |
michael@0 | 77 | virtual bool OnDocumentParserError() = 0; |
michael@0 | 78 | |
michael@0 | 79 | /** |
michael@0 | 80 | * Reset the document direction so that it is recomputed. |
michael@0 | 81 | */ |
michael@0 | 82 | virtual void ResetDocumentDirection() = 0; |
michael@0 | 83 | |
michael@0 | 84 | virtual void ResetDocumentLWTheme() = 0; |
michael@0 | 85 | }; |
michael@0 | 86 | |
michael@0 | 87 | NS_DEFINE_STATIC_IID_ACCESSOR(nsIXULDocument, NS_IXULDOCUMENT_IID) |
michael@0 | 88 | |
michael@0 | 89 | // factory functions |
michael@0 | 90 | nsresult NS_NewXULDocument(nsIXULDocument** result); |
michael@0 | 91 | |
michael@0 | 92 | #endif // nsIXULDocument_h___ |