nsIScreenManager 编辑

widget/public/nsIScreenManager.idlScriptable This interface lets you get information about the display screen (or screens) attached to the user's computer. 66 Introduced Gecko 0.9.5 Inherits from: nsISupports Last changed in Gecko 1.9 (Firefox 3)

Implemented by: @mozilla.org/gfx/screenmanager;1 as a service:

var screenManager = Components.classes["@mozilla.org/gfx/screenmanager;1"]
                    .getService(Components.interfaces.nsIScreenManager);

Method overview

nsIScreen screenForNativeWidget( in voidPtr nativeWidget ); Native code only!
nsIScreen screenForRect( in long left, in long top, in long width, in long height );

Attributes

AttributeTypeDescription
numberOfScreensunsigned longThe number of screens on the user's computer. Read only.
primaryScreennsIScreenThe primary display screen; this is the screen with the menu bar (on the Mac) or taskbar or equivalent on Windows or Linux. Read only.

Methods

Native code only!

screenForNativeWidget

Returns the nsIScreen instance for the native widget pointer. This pointer's definition is specific to the platform's native widget implementation, and is typically of the same type as NS_NATIVE_WINDOW.

nsIScreen screenForNativeWidget(
  in voidPtr nativeWidget
);
Parameters
nativeWidget
The native widget for which to obtain an nsIScreen instance.
Return value

The nsIScreen instance for the native widget pointer.

screenForRect()

Returns the nsIScreen containing the specified rectangle. If the rectangle overlaps multiple screens, the screen containing the majority of the rectangle's area is selected and returned.

The coordinates must be specified using global (screen) coordinates, and are in pixels.

nsIScreen screenForRect(
  in long left,
  in long top,
  in long width,
  in long height
);
Parameters
left
The left edge of the rectangle.
top
The top edge of the rectangle.
width
The width of the rectangle.
height
The height of the rectangle.
Return value

The nsIScreen containing the majority of the rectangle's area.

See also

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

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

发布评论

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

词条统计

浏览:49 次

字数:4642

最后编辑:7年前

编辑次数:0 次

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