Widget Wrappers 编辑

Widget wrappers are objects that provide information about a widget. There are 'group' wrappers which provide information about the widget across all windows, and 'single' wrappers which provide information about a specific instance in a specific window.

Group wrapper

Methods

forWindow()

A method to obtain a single window wrapper for a widget, in the window aWindow passed as the only argument.

Properties

All of a wrapper's properties are read-only unless otherwise indicated.

AttributeDescription
idthe widget's ID
typethe type of widget (button, view, custom). For XUL-provided widgets, this is always 'custom'
providerthe provider type of the widget, id est one of PROVIDER_API or PROVIDER_XUL
instancesan array of all instances (single window wrappers) of the widget. This array is NOT live.
areaTypethe type of the widget's current area
isGrouptrue, will be false for wrappers around single widget nodes
sourcefor API-provided widgets, whether they are built-in to Firefox or add-on-provided
disabledfor API-provided widgets, whether the widget is currently disabled. NB: this property is writable, and will toggle all the widgets' nodes' disabled states
labelfor API-provided widgets, the label of the widget
tooltiptextfor API-provided widgets, the tooltip of the widget
showInPrivateBrowsingfor API-provided widgets, whether the widget is visible in private browsing

Single wrapper

Properties

All of a wrapper's properties are read-only unless otherwise indicated.

AttributeDescription
idthe widget's ID
typethe type of widget (button, view, custom). For XUL-provided widgets, this is always 'custom'
providerthe provider type of the widget, id est one of PROVIDER_API or PROVIDER_XUL
nodereference to the corresponding DOM node
anchorthe anchor on which to anchor panels opened from this node. This will point to the overflow chevron on overflowable toolbars if and only if your widget node is overflowed, to the anchor for the panel menu if your widget is inside the panel menu, and to the node itself in all other cases
overflowedboolean indicating whether the node is currently in the overflow panel of the toolbar
isGroupfalse, will be true for the group widget
labelfor API-provided widgets, convenience getter for the label attribute of the DOM node
tooltiptextfor API-provided widgets, convenience getter for the tooltiptext attribute of the DOM node
disabledfor API-provided widgets, convenience getter and setter for the disabled state of this single widget. Note that you may prefer to use the group wrapper's getter/setter instead.

 

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

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

发布评论

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

词条统计

浏览:83 次

字数:4343

最后编辑:8年前

编辑次数:0 次

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