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 | /* vim: se cin sw=2 ts=2 et : */ |
michael@0 | 2 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 3 | * |
michael@0 | 4 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 5 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 6 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 7 | |
michael@0 | 8 | #include "nsISupports.idl" |
michael@0 | 9 | |
michael@0 | 10 | interface nsIDocShell; |
michael@0 | 11 | interface nsITaskbarPreview; |
michael@0 | 12 | interface nsITaskbarPreviewButton; |
michael@0 | 13 | |
michael@0 | 14 | /** |
michael@0 | 15 | * nsITaskbarPreviewController |
michael@0 | 16 | * |
michael@0 | 17 | * nsITaskbarPreviewController provides the behavior for the taskbar previews. |
michael@0 | 18 | * Its methods and properties are used by nsITaskbarPreview. Clients are |
michael@0 | 19 | * intended to provide their own implementation of this interface. Depending on |
michael@0 | 20 | * the interface the controller is attached to, only certain methods/attributes |
michael@0 | 21 | * are required to be implemented. |
michael@0 | 22 | */ |
michael@0 | 23 | [scriptable, uuid(4FC0AFBB-3E22-4FBA-AC21-953350AF0411)] |
michael@0 | 24 | interface nsITaskbarPreviewController : nsISupports |
michael@0 | 25 | { |
michael@0 | 26 | /** |
michael@0 | 27 | * The width of the preview image. This value is allowed to change at any |
michael@0 | 28 | * time. See drawPreview for more information. |
michael@0 | 29 | */ |
michael@0 | 30 | readonly attribute unsigned long width; |
michael@0 | 31 | |
michael@0 | 32 | /** |
michael@0 | 33 | * The height of the preview image. This value is allowed to change at any |
michael@0 | 34 | * time. See drawPreview for more information. |
michael@0 | 35 | */ |
michael@0 | 36 | readonly attribute unsigned long height; |
michael@0 | 37 | |
michael@0 | 38 | /** |
michael@0 | 39 | * The aspect ratio of the thumbnail - this does not need to match the ratio |
michael@0 | 40 | * of the preview. This value is allowed to change at any time. See |
michael@0 | 41 | * drawThumbnail for more information. |
michael@0 | 42 | */ |
michael@0 | 43 | readonly attribute float thumbnailAspectRatio; |
michael@0 | 44 | |
michael@0 | 45 | /** |
michael@0 | 46 | * Invoked by nsITaskbarPreview when it needs to render the preview. The |
michael@0 | 47 | * context is attached to a surface with the controller's width and height |
michael@0 | 48 | * which are obtained immediately before the call. |
michael@0 | 49 | * |
michael@0 | 50 | * Note that the context is not attached to a canvas element. |
michael@0 | 51 | * |
michael@0 | 52 | * @param ctx Canvas drawing context |
michael@0 | 53 | */ |
michael@0 | 54 | boolean drawPreview(in nsISupports ctx); |
michael@0 | 55 | |
michael@0 | 56 | /** |
michael@0 | 57 | * Invoked by the taskbar preview when it needs to draw the thumbnail in the |
michael@0 | 58 | * taskbar's application preview window. |
michael@0 | 59 | * |
michael@0 | 60 | * Note: it is guaranteed that width/height == thumbnailAspectRatio |
michael@0 | 61 | * (modulo rounding errors) |
michael@0 | 62 | * |
michael@0 | 63 | * Also note that the context is not attached to a canvas element. |
michael@0 | 64 | * |
michael@0 | 65 | * @param ctx Canvas drawing context |
michael@0 | 66 | * @param width The width of the surface backing the drawing context |
michael@0 | 67 | * @param height The height of the surface backing the drawing context |
michael@0 | 68 | */ |
michael@0 | 69 | boolean drawThumbnail(in nsISupports ctx, in unsigned long width, in unsigned long height); |
michael@0 | 70 | |
michael@0 | 71 | /** |
michael@0 | 72 | * Invoked when the user presses the close button on the tab preview. |
michael@0 | 73 | */ |
michael@0 | 74 | void onClose(); |
michael@0 | 75 | |
michael@0 | 76 | /** |
michael@0 | 77 | * Invoked when the user clicks on the tab preview. |
michael@0 | 78 | * |
michael@0 | 79 | * @return true if the top level window corresponding to the preview should |
michael@0 | 80 | * be activated, false if activation is not accepted. |
michael@0 | 81 | */ |
michael@0 | 82 | boolean onActivate(); |
michael@0 | 83 | |
michael@0 | 84 | /** |
michael@0 | 85 | * Invoked when one of the buttons on the window preview's toolbar is pressed. |
michael@0 | 86 | * |
michael@0 | 87 | * @param button The button that was pressed. This can be compared with the |
michael@0 | 88 | * buttons returned by nsITaskbarWindowPreview.getButton. |
michael@0 | 89 | */ |
michael@0 | 90 | void onClick(in nsITaskbarPreviewButton button); |
michael@0 | 91 | }; |
michael@0 | 92 |