Bug 732976 - SingleSourceFactory should generate checksums file. r=ted
[gecko.git] / widget / nsITaskbarPreviewController.idl
blob3c04a1d40c4edd0b7f37b1c495e333f96f9d2b46
1 /* vim: se cin sw=2 ts=2 et : */
2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4 * ***** BEGIN LICENSE BLOCK *****
5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
7 * The contents of this file are subject to the Mozilla Public License Version
8 * 1.1 (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
10 * http://www.mozilla.org/MPL/
12 * Software distributed under the License is distributed on an "AS IS" basis,
13 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14 * for the specific language governing rights and limitations under the
15 * License.
17 * The Original Code is mozilla.org code.
19 * The Initial Developer of the Original Code is
20 * Mozilla Foundation.
21 * Portions created by the Initial Developer are Copyright (C) 2009
22 * the Initial Developer. All Rights Reserved.
24 * Contributor(s):
25 * Rob Arnold <tellrob@gmail.com>
27 * Alternatively, the contents of this file may be used under the terms of
28 * either the GNU General Public License Version 2 or later (the "GPL"), or
29 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 * in which case the provisions of the GPL or the LGPL are applicable instead
31 * of those above. If you wish to allow use of your version of this file only
32 * under the terms of either the GPL or the LGPL, and not to allow others to
33 * use your version of this file under the terms of the MPL, indicate your
34 * decision by deleting the provisions above and replace them with the notice
35 * and other provisions required by the GPL or the LGPL. If you do not delete
36 * the provisions above, a recipient may use your version of this file under
37 * the terms of any one of the MPL, the GPL or the LGPL.
39 * ***** END LICENSE BLOCK ***** */
41 #include "nsISupports.idl"
43 interface nsIDocShell;
44 interface nsIDOMCanvasRenderingContext2D;
45 interface nsITaskbarPreview;
46 interface nsITaskbarPreviewButton;
48 /**
49 * nsITaskbarPreviewController
51 * nsITaskbarPreviewController provides the behavior for the taskbar previews.
52 * Its methods and properties are used by nsITaskbarPreview. Clients are
53 * intended to provide their own implementation of this interface. Depending on
54 * the interface the controller is attached to, only certain methods/attributes
55 * are required to be implemented.
57 [scriptable, uuid(4FC0AFBB-3E22-4FBA-AC21-953350AF0411)]
58 interface nsITaskbarPreviewController : nsISupports
60 /**
61 * The width of the preview image. This value is allowed to change at any
62 * time. See drawPreview for more information.
64 readonly attribute unsigned long width;
66 /**
67 * The height of the preview image. This value is allowed to change at any
68 * time. See drawPreview for more information.
70 readonly attribute unsigned long height;
72 /**
73 * The aspect ratio of the thumbnail - this does not need to match the ratio
74 * of the preview. This value is allowed to change at any time. See
75 * drawThumbnail for more information.
77 readonly attribute float thumbnailAspectRatio;
79 /**
80 * Invoked by nsITaskbarPreview when it needs to render the preview. The
81 * context is attached to a surface with the controller's width and height
82 * which are obtained immediately before the call.
84 * Note that the context is not attached to a canvas element.
86 * @param ctx Canvas drawing context
88 boolean drawPreview(in nsIDOMCanvasRenderingContext2D ctx);
90 /**
91 * Invoked by the taskbar preview when it needs to draw the thumbnail in the
92 * taskbar's application preview window.
94 * Note: it is guaranteed that width/height == thumbnailAspectRatio
95 * (modulo rounding errors)
97 * Also note that the context is not attached to a canvas element.
99 * @param ctx Canvas drawing context
100 * @param width The width of the surface backing the drawing context
101 * @param height The height of the surface backing the drawing context
103 boolean drawThumbnail(in nsIDOMCanvasRenderingContext2D ctx, in unsigned long width, in unsigned long height);
106 * Invoked when the user presses the close button on the tab preview.
108 void onClose();
111 * Invoked when the user clicks on the tab preview.
113 * @return true if the top level window corresponding to the preview should
114 * be activated, false if activation is not accepted.
116 boolean onActivate();
119 * Invoked when one of the buttons on the window preview's toolbar is pressed.
121 * @param button The button that was pressed. This can be compared with the
122 * buttons returned by nsITaskbarWindowPreview.getButton.
124 void onClick(in nsITaskbarPreviewButton button);