widget/nsITaskbarPreviewController.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/widget/nsITaskbarPreviewController.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,92 @@
     1.4 +/* vim: se cin sw=2 ts=2 et : */
     1.5 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.6 + *
     1.7 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    1.10 +
    1.11 +#include "nsISupports.idl"
    1.12 +
    1.13 +interface nsIDocShell;
    1.14 +interface nsITaskbarPreview;
    1.15 +interface nsITaskbarPreviewButton;
    1.16 +
    1.17 +/**
    1.18 + * nsITaskbarPreviewController
    1.19 + *
    1.20 + * nsITaskbarPreviewController provides the behavior for the taskbar previews.
    1.21 + * Its methods and properties are used by nsITaskbarPreview. Clients are
    1.22 + * intended to provide their own implementation of this interface. Depending on
    1.23 + * the interface the controller is attached to, only certain methods/attributes
    1.24 + * are required to be implemented.
    1.25 + */
    1.26 +[scriptable, uuid(4FC0AFBB-3E22-4FBA-AC21-953350AF0411)]
    1.27 +interface nsITaskbarPreviewController : nsISupports
    1.28 +{
    1.29 +  /**
    1.30 +   * The width of the preview image. This value is allowed to change at any
    1.31 +   * time. See drawPreview for more information.
    1.32 +   */
    1.33 +  readonly attribute unsigned long width;
    1.34 +
    1.35 +  /**
    1.36 +   * The height of the preview image. This value is allowed to change at any
    1.37 +   * time.  See drawPreview for more information.
    1.38 +   */
    1.39 +  readonly attribute unsigned long height;
    1.40 +
    1.41 +  /**
    1.42 +   * The aspect ratio of the thumbnail - this does not need to match the ratio
    1.43 +   * of the preview. This value is allowed to change at any time. See
    1.44 +   * drawThumbnail for more information.
    1.45 +   */
    1.46 +  readonly attribute float thumbnailAspectRatio;
    1.47 +
    1.48 +  /**
    1.49 +   * Invoked by nsITaskbarPreview when it needs to render the preview. The
    1.50 +   * context is attached to a surface with the controller's width and height
    1.51 +   * which are obtained immediately before the call.
    1.52 +   *
    1.53 +   * Note that the context is not attached to a canvas element.
    1.54 +   *
    1.55 +   * @param ctx Canvas drawing context
    1.56 +   */
    1.57 +  boolean drawPreview(in nsISupports ctx);
    1.58 +
    1.59 +  /**
    1.60 +   * Invoked by the taskbar preview when it needs to draw the thumbnail in the
    1.61 +   * taskbar's application preview window.
    1.62 +   *
    1.63 +   * Note: it is guaranteed that width/height == thumbnailAspectRatio
    1.64 +   * (modulo rounding errors)
    1.65 +   *
    1.66 +   * Also note that the context is not attached to a canvas element.
    1.67 +   *
    1.68 +   * @param ctx Canvas drawing context
    1.69 +   * @param width The width of the surface backing the drawing context
    1.70 +   * @param height The height of the surface backing the drawing context
    1.71 +   */
    1.72 +  boolean drawThumbnail(in nsISupports ctx, in unsigned long width, in unsigned long height);
    1.73 +
    1.74 +  /**
    1.75 +   * Invoked when the user presses the close button on the tab preview.
    1.76 +   */
    1.77 +  void onClose();
    1.78 +
    1.79 +  /**
    1.80 +   * Invoked when the user clicks on the tab preview.
    1.81 +   *
    1.82 +   * @return true if the top level window corresponding to the preview should
    1.83 +   *         be activated, false if activation is not accepted.
    1.84 +   */
    1.85 +  boolean onActivate();
    1.86 +
    1.87 +  /**
    1.88 +   * Invoked when one of the buttons on the window preview's toolbar is pressed.
    1.89 +   *
    1.90 +   * @param button The button that was pressed. This can be compared with the
    1.91 +   *               buttons returned by nsITaskbarWindowPreview.getButton.
    1.92 +   */
    1.93 +  void onClick(in nsITaskbarPreviewButton button);
    1.94 +};
    1.95 +

mercurial