michael@0: /* vim: se cin sw=2 ts=2 et : */ michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIDocShell; michael@0: interface nsITaskbarPreview; michael@0: interface nsITaskbarPreviewButton; michael@0: michael@0: /** michael@0: * nsITaskbarPreviewController michael@0: * michael@0: * nsITaskbarPreviewController provides the behavior for the taskbar previews. michael@0: * Its methods and properties are used by nsITaskbarPreview. Clients are michael@0: * intended to provide their own implementation of this interface. Depending on michael@0: * the interface the controller is attached to, only certain methods/attributes michael@0: * are required to be implemented. michael@0: */ michael@0: [scriptable, uuid(4FC0AFBB-3E22-4FBA-AC21-953350AF0411)] michael@0: interface nsITaskbarPreviewController : nsISupports michael@0: { michael@0: /** michael@0: * The width of the preview image. This value is allowed to change at any michael@0: * time. See drawPreview for more information. michael@0: */ michael@0: readonly attribute unsigned long width; michael@0: michael@0: /** michael@0: * The height of the preview image. This value is allowed to change at any michael@0: * time. See drawPreview for more information. michael@0: */ michael@0: readonly attribute unsigned long height; michael@0: michael@0: /** michael@0: * The aspect ratio of the thumbnail - this does not need to match the ratio michael@0: * of the preview. This value is allowed to change at any time. See michael@0: * drawThumbnail for more information. michael@0: */ michael@0: readonly attribute float thumbnailAspectRatio; michael@0: michael@0: /** michael@0: * Invoked by nsITaskbarPreview when it needs to render the preview. The michael@0: * context is attached to a surface with the controller's width and height michael@0: * which are obtained immediately before the call. michael@0: * michael@0: * Note that the context is not attached to a canvas element. michael@0: * michael@0: * @param ctx Canvas drawing context michael@0: */ michael@0: boolean drawPreview(in nsISupports ctx); michael@0: michael@0: /** michael@0: * Invoked by the taskbar preview when it needs to draw the thumbnail in the michael@0: * taskbar's application preview window. michael@0: * michael@0: * Note: it is guaranteed that width/height == thumbnailAspectRatio michael@0: * (modulo rounding errors) michael@0: * michael@0: * Also note that the context is not attached to a canvas element. michael@0: * michael@0: * @param ctx Canvas drawing context michael@0: * @param width The width of the surface backing the drawing context michael@0: * @param height The height of the surface backing the drawing context michael@0: */ michael@0: boolean drawThumbnail(in nsISupports ctx, in unsigned long width, in unsigned long height); michael@0: michael@0: /** michael@0: * Invoked when the user presses the close button on the tab preview. michael@0: */ michael@0: void onClose(); michael@0: michael@0: /** michael@0: * Invoked when the user clicks on the tab preview. michael@0: * michael@0: * @return true if the top level window corresponding to the preview should michael@0: * be activated, false if activation is not accepted. michael@0: */ michael@0: boolean onActivate(); michael@0: michael@0: /** michael@0: * Invoked when one of the buttons on the window preview's toolbar is pressed. michael@0: * michael@0: * @param button The button that was pressed. This can be compared with the michael@0: * buttons returned by nsITaskbarWindowPreview.getButton. michael@0: */ michael@0: void onClick(in nsITaskbarPreviewButton button); michael@0: }; michael@0: