nsITaskbarPreviewController 编辑
widget/public/nsITaskbarPreviewController.idl
Scriptable 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
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. |
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.
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 thensITaskbarWindowPreview.getButton()
.
onClose()
Invoked when the user presses the close button on the tab preview.
void onClose();
Parameters
None.
See also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论