Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

nsITaskbarPreviewController

This interface is used on Microsoft Windows to provide the behavior of taskbar previews. Its methods and properties are used by the nsITaskbarPreview interface.
1.0
28
Introduced
Gecko 1.9.2
Inherits from: nsISupports Last changed in Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0)

Clients should provide their own implementation of this interface. Depending on whether the controller is connected to an nsITaskbarTabPreview or nsITaskbarWindowPreview, only certain methods and attributes need to be implemented.

Method overview

boolean drawPreview(in nsIDOMCanvasRenderingContext2D ctx);
boolean drawThumbnail(in nsIDOMCanvasRenderingContext2D ctx, in unsigned long width, in unsigned long height);
boolean onActivate();
void onClick(in nsITaskbarPreviewButton button);
void onClose();

Attributes

Attribute Type Description
height unsigned long The height in pixels of the preview image. This value may change at any time. See drawPreview() for more information. Read only.
thumbnailAspectRatio float The thumbnail's aspect ratio. This doesn't need to match the preview's aspect ratio, and is allowed to be changed at any time. See drawThumbnail() for more information. Read only.
width unsigned long The width in pixels of the preview image. This value may change at any time. See drawPreview() for more information. Read only.

Note: Although these attributes are read only, that indicates that the previews controlled by an nsITaskbarPreviewController cannot alter these values. The controller and its supporting code, however, may change this values at any time.

Methods

drawPreview()

Invoked by nsITaskbarPreview when it needs to render the preview. The specified context is attached to a surface with the controller's width and height, the values of which are obtained immediately prior to calling this method.

boolean drawPreview(
  in nsIDOMCanvasRenderingContext2D ctx
);
Parameters
ctx
An nsIDOMCanvasRenderingContext2D object representing the drawing context into which the preview is to be rendered. Note that this context is not actually attached to a canvas element.
Return value

true if you want a frame drawn around the preview, otherwise false.

drawThumbnail()

Invoked by the taskbar preview when it needs to draw the thumbnail in the taskbar's application preview window.

boolean drawThumbnail(
  in nsIDOMCanvasRenderingContext2D ctx,
  in unsigned long width,
  in unsigned long height
);
Parameters
ctx
An nsIDOMCanvasRenderingContext2D object representing the drawing context into which the thumbnail is to be rendered. Note that this context is not actually attached to a canvas element.
width
The width of the surface backing the drawing context.
height
The height of the surface backing the drawing context.

Note: It's guaranteed that width ÷ height will equal the thumbnailAspectRatio, within the margin of rounding errors.

Return value

true if you want a frame drawn around the thumbnail, otherwise false.

onActivate()

Invoked when the user clicks on the tab preview.

boolean onActivate();
Parameters

None.

Return value

true if the top level window corresponding to the preview should be activated, false if activation is not accepted.

onClick()

Invoked when one of the buttons on the window preview's toolbar is clicked by the user.

void onClick(
  in nsITaskbarPreviewButton button
);
Parameters
button
An nsITaskbarPreviewButton object representing the button that was pressed. This can be compared to the buttons returned by the nsITaskbarWindowPreview.getButton().

onClose()

Invoked when the user presses the close button on the tab preview.

void onClose();
Parameters

None.

See also

Document Tags and Contributors

 Contributors to this page: Sheppy, fscholz, trevorh
 Last updated by: Sheppy,