nsITaskbarPreviewController 编辑

widget/public/nsITaskbarPreviewController.idlScriptable 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 66 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

AttributeTypeDescription
heightunsigned longThe height in pixels of the preview image. This value may change at any time. See drawPreview() for more information. Read only.
thumbnailAspectRatiofloatThe 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.
widthunsigned longThe 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:85 次

字数:8647

最后编辑:6 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文