nsIScrollable 编辑
/docshell/base/nsIScrollable.idl
Scriptable 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.
Constant | Value | Description |
ScrollOrientation_X | 1 | Horizontal scrolling. When passing this in to a method you are requesting or setting data for the horizontal scrollbar. |
ScrollOrientation_Y | 2 | Vertical 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.
Constant | Value | Description |
Scrollbar_Auto | 1 | Scrollbars visible only when needed. |
Scrollbar_Never | 2 | Scrollbars never visible, even when scrolling is still possible. |
Scrollbar_Always | 3 | Scrollbars 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论