nsIWinTaskbar 编辑

widget/public/nsIWinTaskbar.idlScriptable Represents a service that exposes the APIs provided by the Microsoft Windows taskbar. 1.0 66 Introduced Gecko 1.9.2 Inherits from: nsISupports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)

Starting with Windows 7, applications gain some control over their appearance in the taskbar. By default, there is a single taskbar preview per top level window (excluding pop-ups). This preview is represented by an nsITaskbarWindowPreview object.

An application can register its own "tab" previews. These previews automatically hide the corresponding nsITaskbarWindowPreview. These don't have to correspond to tabs within the application; they can vary in size, shape, and location. They don't even have to represent actual GUI elements on the window.

Unlike window previews, tab previews require most of the functionality of the nsITaskbarPreviewController interface be implemented.

Warning: This API has undergone changes that are not yet documented. Among these is the addition of the method getOverlayIconController(). This method is currently known to crash if used under certain conditions. See bug 744992 for details and to track progress on a fix.

Implemented by: @mozilla.org/windows-taskbar;1. To create an instance, use:

var winTaskbar = Components.classes["@mozilla.org/windows-taskbar;1"]
                 .getService(Components.interfaces.nsIWinTaskbar);

Method overview

nsIJumpListBuilder createJumpListBuilder();
nsITaskbarTabPreview createTaskbarTabPreview(in nsIDocShell shell, in nsITaskbarPreviewController controller);
nsITaskbarProgress getTaskbarProgress(in nsIDocShell shell);
nsITaskbarWindowPreview getTaskbarWindowPreview(in nsIDocShell shell);
void setGroupIdForWindow(in nsIDOMWindow aParent, in AString aIdentifier);

Attributes

AttributeTypeDescription
availablebooleanReturns true if the operating system supports Windows 7 or later taskbar features; you can use this instead of in-place operating system version checking. Read only.
defaultGroupIdAStringThe default application user model ID the application registers with the system. This ID is used by the taskbar for grouping windows and when associating pinned shortcuts with running instances and jump lists. Read only.

For XULRunner applications, the defaultGroupId attribute is configured using application.ini settings, and is of the format "vendor.application.version". For example, if the Vendor is configured to "Foobar Systems", the application's Name is "Squashweb", and the application's Version is 1.0, the defaultGroupId attribute would be "Foobar Systems.Squashweb.1.0". See XUL Application Packaging for additional details.

Methods

createJumpListBuilder()

Retrieve a taskbar jump list builder.

Fails if a jump list build operation has already been initiated, developers should make use of a single instance of nsIJumpListBuilder for building lists within an application.

nsIJumpListBuilder createJumpListBuilder();
Parameters

None.

Return value

An nsIJumpListBuilder.

createTaskbarTabPreview()

Creates a taskbar tab preview, given an nsIDocShell reference to a top-level window.

nsITaskbarTabPreview createTaskbarTabPreview(
  in nsIDocShell shell,
  in nsITaskbarPreviewController controller
);
Parameters
shell
An nsIDocShell object representing the top-level window from which to create the preview.
controller
An nsITaskbarPreviewController you implement.
Return value

An nsITaskbarTabPreview object for the new tab preview.

Example
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var taskbar = Components.classes["@mozilla.org/windows-taskbar;1"].getService(Components.interfaces.nsIWinTaskbar);

// Get the docShell for the browser

var navigator2 = top.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebNavigation);
var docShell = navigator2.QueryInterface(Components.interfaces.nsIDocShell);

// Get the parent docShell; this is the top-level docShell

var docShellTreeItem = docShell.QueryInterface(Components.interfaces.nsIDocShellTreeItem);
var parent = docShellTreeItem.parent;
var ds = parent.QueryInterface(Components.interfaces.nsIDocShell);

// Create the preview

taskbar.createTaskbarTabPreview(ds, {});

getTaskbarProgress()

Gets the taskbar progress for a window.

nsITaskbarProgress getTaskbarProgress(
  in nsIDocShell shell
);
Parameters
shell
The nsIDocShell used to find the toplevel window.
Return value

An nsITaskbarProgress.

getTaskbarWindowPreview()

Returns the taskbar preview for the window whose top level is identified by nsIDocShell.

nsITaskbarWindowPreview getTaskbarWindowPreview(
  in nsIDocShell shell
);
Parameters
shell
An nsIDocShell object to use to find the top-level window.
Return value

An nsITaskbarWindowPreview object for the window's preview.

setGroupIdForWindow()

Set the grouping id for a window. Ids should be unique to the application and window to insure conflicts with other pinned applications do no arise.

void setGroupIdForWindow(
  in nsIDOMWindow aParent,
  in AString aIdentifier
);
Parameters
aParent
The parent nsIDOMWindow.
aIdentifier
The new identifier for the window.

See also

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

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

发布评论

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

词条统计

浏览:53 次

字数:11309

最后编辑:7年前

编辑次数:0 次

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