nsIScrollable 编辑

/docshell/base/nsIScrollable.idlScriptable This interface can be implemented by a control that supports scrolling. This is a generic interface without concern for the type of content that may be inside. Inherits from: nsIScrollable Last changed in Gecko 29.0 (Firefox 29.0 / Thunderbird 29.0 / SeaMonkey 2.26)

Method overview

long getCurScrollPos(in long scrollOrientation); Obsolete since Gecko 29.0
long getDefaultScrollbarPreferences(in long scrollOrientation);
void getScrollbarVisibility(out boolean verticalVisible, out boolean horizontalVisible);
void getScrollRange(in long scrollOrientation, out long minPos, out long maxPos); Obsolete since Gecko 29.0
void setCurScrollPos(in long scrollOrientation, in long curPos); Obsolete since Gecko 29.0
void setCurScrollPosEx(in long curHorizontalPos, in long curVerticalPos); Obsolete since Gecko 29.0
void setDefaultScrollbarPreferences(in long scrollOrientation, in long scrollbarPref);
void setScrollRange(in long scrollOrientation, in long minPos, in long maxPos); Obsolete since Gecko 29.0
void setScrollRangeEx(in long minHorizontalPos, in long maxHorizontalPos, in long minVerticalPos, in long maxVerticalPos); Obsolete since Gecko 29.0

Constants

Scroll orientations

Scroll orientations a scrollbar can be in.

ConstantValueDescription
ScrollOrientation_X1Horizontal scrolling. When passing this in to a method you are requesting or setting data for the horizontal scrollbar.
ScrollOrientation_Y2Vertical scrolling. When passing this in to a method you are requesting or setting data for the vertical scrollbar.

Scrollbar states

Visibility states of a scrollbar.

ConstantValueDescription
Scrollbar_Auto1Scrollbars visible only when needed.
Scrollbar_Never2Scrollbars never visible, even when scrolling is still possible.
Scrollbar_Always3Scrollbars always visible, even when scrolling is not possible.

Methods

getCurScrollPos()

Obsolete since Gecko 29.0 (Firefox 29.0 / Thunderbird 29.0 / SeaMonkey 2.26)
long getCurScrollPos(
  in long scrollOrientation
);
Parameters
scrollOrientation
An integer representing the orientation of the scrollbar.
Return value

 

getDefaultScrollbarPreferences()

long getDefaultScrollbarPreferences(
  in long scrollOrientation
);
Parameters
scrollOrientation
An integer representing the orientation of the scrollbar.
Return value

An integer representing the state of the scrollbar.

getScrollbarVisibility()

void getScrollbarVisibility(
  out boolean verticalVisible,
  out boolean horizontalVisible
);
Parameters
verticalVisible
Boolean specifying the visibility of the vertical scrollbar.
horizontalVisible
Boolean specifying the visibility of the horizontal scrollbar.

getScrollRange()

Obsolete since Gecko 29.0 (Firefox 29.0 / Thunderbird 29.0 / SeaMonkey 2.26)
void getScrollRange(
  in long scrollOrientation,
  out long minPos,
  out long maxPos
);
Parameters
scrollOrientation
An integer representing the orientation of the scrollbar.
minPos
Minimal position of the scroll range.
maxPos
Maximal position of the scroll range.

setCurScrollPos()

Obsolete since Gecko 29.0 (Firefox 29.0 / Thunderbird 29.0 / SeaMonkey 2.26)
void setCurScrollPos(
  in long scrollOrientation,
  in long curPos
);
Parameters
scrollOrientation
An integer representing the orientation of the scrollbar.
curPos
An integer representing the position of the cursor.

setCurScrollPosEx()

Obsolete since Gecko 29.0 (Firefox 29.0 / Thunderbird 29.0 / SeaMonkey 2.26)
void setCurScrollPosEx(
  in long curHorizontalPos,
  in long curVerticalPos
);
Parameters
curHorizontalPos
An integer representing the horizontal position of the cursor.
curVerticalPos
An integer representing the vertical position of the cursor.

setDefaultScrollbarPreferences()

void setDefaultScrollbarPreferences(
  in long scrollOrientation,
  in long scrollbarPref
);
Parameters
scrollOrientation
An integer representing the orientation of the scrollbar.
scrollbarPref
An integer representing the state of the scrollbar.

setScrollRange()

Obsolete since Gecko 29.0 (Firefox 29.0 / Thunderbird 29.0 / SeaMonkey 2.26)
void setScrollRange(
  in long scrollOrientation,
  in long minPos,
  in long maxPos
);
Parameters
scrollOrientation
An integer representing the orientation of the scrollbar.
minPos
An integer representing the minimal position of the scroll range.
maxPos
An integer representing the maximal position of the scroll range.

setScrollRangeEx()

Obsolete since Gecko 29.0 (Firefox 29.0 / Thunderbird 29.0 / SeaMonkey 2.26)
void setScrollRangeEx(
  in long minHorizontalPos,
  in long maxHorizontalPos,
  in long minVerticalPos,
  in long maxVerticalPos
);
Parameters
minHorizontalPos
An integer representing the minimal position of the horizontal scroll range.
maxHorizontalPos
An integer representing the maximal position of the horizontal scroll range.
minVerticalPos
An integer representing the minimal position of the vertical scroll range.
maxVerticalPos
An integer representing the maximal position of the vertical scroll range.

Example

var nsiScr = gBrowser.selectedBrowser.docShell.QueryInterface(Components.interfaces.nsIScrollable);
var v={};
var h={};

nsiScr.getScrollbarVisibility(v,h);

v.value //returns true if the vertical scrollbar is displayed
h.value //returns true if the horizontal scrollbar is displayed

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

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

发布评论

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

词条统计

浏览:91 次

字数:9970

最后编辑:7 年前

编辑次数:0 次

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