nsISelectionController 编辑

content/base/public/nsISelectionController.idlScriptable Please add a summary to this article. Inherits from: nsISelectionDisplay Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)

Method overview

void characterExtendForBackspace(); Native code only!
void characterExtendForDelete(); Native code only!
void characterMove(in boolean forward, in boolean extend);
boolean checkVisibility(in nsIDOMNode node, in short startOffset, in short endOffset);
void completeMove(in boolean forward, in boolean extend);
void completeScroll(in boolean forward);
boolean getCaretEnabled();
short getDisplaySelection();
nsISelection getSelection(in short type);
void intraLineMove(in boolean forward, in boolean extend);
void lineMove(in boolean forward, in boolean extend);
void pageMove(in boolean forward, in boolean extend);
void repaintSelection(in short type);
void scrollHorizontal(in boolean left);
void scrollLine(in boolean forward);
void scrollPage(in boolean forward);
void scrollSelectionIntoView(in short type, in short region, in short flags);
void selectAll();
void setCaretEnabled(in boolean enabled);
void setCaretReadOnly(in boolean readOnly);
void setCaretVisibilityDuringSelection(in boolean visibility);
void setCaretWidth(in short pixels); Obsolete since Gecko 1.8
void setDisplaySelection(in short toggle);
void wordExtendForDelete(in boolean forward); Native code only!
void wordMove(in boolean forward, in boolean extend);

Attributes

AttributeTypeDescription
caretVisiblebooleanThis is true if the caret is enabled, visible, and currently blinking. This is still true when the caret is enabled, visible, but in its "off" blink cycle. Read only.

Constants

Selection constants

ConstantGecko versionDescription
1.7 - 1.91.9.1 - 1.9.22.0
SELECTION_NONE0 
SELECTION_NORMAL1 
SELECTION_SPELLCHECK2 
SELECTION_IME_RAWINPUT4 
SELECTION_IME_SELECTEDRAWTEXT8 
SELECTION_IME_CONVERTEDTEXT16 
SELECTION_IME_SELECTEDCONVERTEDTEXT32 
SELECTION_ACCESSIBILITY64For accessibility API usage.
SELECTION_FIND 128 
NUM_SELECTIONTYPES89 
SELECTION_ANCHOR_REGION0 
SELECTION_FOCUS_REGION1 
SELECTION_WHOLE_SELECTION 2 
NUM_SELECTION_REGIONS23 
SELECTION_OFF0 
SELECTION_HIDDEN1Hidden displays selection.
SELECTION_ON2 
SELECTION_DISABLED3 
SELECTION_ATTENTION4 

Scroll constants

ConstantValueDescription
SCROLL_SYNCHRONOUS1<<1If set scrolls the selection into view before returning. If not set, posts a request which is processed at some point after the method returns.
SCROLL_FIRST_ANCESTOR_ONLY1<<2If set, only the first ancestor will be scrolled into view.
SCROLL_CENTER_VERTICALLY1<<4If set, the specified location will be scrolled to the center of the view.

Methods

Native code only!

characterExtendForBackspace

Will extend the selection one character cell backward in the document. This method is used internally for handling backspace key only when we're after UTF-16 surrogates.

void characterExtendForBackspace();
Parameters

None.

Native code only!

characterExtendForDelete

Will extend the selection one character cell forward in the document. This method is used internally for handling delete key.

void characterExtendForDelete();
Parameters

None.

characterMove()

Will move the selection one character forward/backward in the document. This will also have the effect of collapsing the selection if the extend = PR_FALSE the "point" of selection that is extended is considered the "focus" point, or the last point adjusted by the selection.

void characterMove(
  in boolean forward,
  in boolean extend
);
Parameters
forward
Forward or backward if PR_FALSE.
extend
Should it collapse the selection or extend it?

checkVisibility()

Checks if textnode and offsets are actually rendered in the current precontext.

boolean checkVisibility(
  in nsIDOMNode node,
  in short startOffset,
  in short endOffset
);
Parameters
node
nsIDOMNode to test.
startOffset
Offset in DOM to first char of textnode to test.
endOffset
Offset in DOM to last char of textnode to test.
Return value

true if visible, false if not.

completeMove()

Will move page view to the top or bottom of the document this will also have the effect of collapsing the selection if the extend = PR_FALSE the "point" of selection that is extended is considered the "focus" point, or the last point adjusted by the selection.

void completeMove(
  in boolean forward,
  in boolean extend
);
Parameters
forward
Forward or backward if PR_FALSE.
extend
Should it collapse the selection or extend it?

completeScroll()

Will move page view to the top or bottom of the document.

void completeScroll(
  in boolean forward
);
Parameters
forward
Forward or backward if PR_FALSE.

getCaretEnabled()

Gets the current state of the caret, as set by setCaretEnabled().

boolean getCaretEnabled();
Parameters

None.

Return value

If aOutEnabled==null, returns NS_ERROR_INVALID_ARG else NS_OK.

getDisplaySelection()

Will get the display mode for the selection.

short getDisplaySelection();
Parameters

None.

Return value

OFF, ON, DISABLED.

getSelection()

Will return the selection that the presentation shell may implement.

nsISelection getSelection(
  in short type
);
Parameters
type
Will hold the type of selection. (SelectionType)
Return value

Will hold the return value.

intraLineMove()

Will move the selection to the front of the line or end of the line in the document. This will also have the effect of collapsing the selection if the extend = PR_FALSE the "point" of selection that is extended is considered the "focus" point, or the last point adjusted by the selection.

void intraLineMove(
  in boolean forward,
  in boolean extend
);
Parameters
forward
Forward or backward if PR_FALSE.
extend
Should it collapse the selection or extend it?

lineMove()

Will move the selection one line forward/backward in the document. This will also have the effect of collapsing the selection if the extend = PR_FALSE the "point" of selection that is extended is considered the "focus" point, or the last point adjusted by the selection.

void lineMove(
  in boolean forward,
  in boolean extend
);
Parameters
forward
Forward or backward if PR_FALSE.
extend
Should it collapse the selection or extend it?

pageMove()

Will move the selection one page forward/backward in the document. This will also have the effect of collapsing the selection if the extend = PR_FALSE the "point" of selection that is extended is considered the "focus" point, or the last point adjusted by the selection.

void pageMove(
  in boolean forward,
  in boolean extend
);
Parameters
forward
Forward or backward if PR_FALSE
extend
Should it collapse the selection or extend it?

repaintSelection()

Repaints the selection specified.

void repaintSelection(
  in short type
);
Parameters
type
Specifies the selection to repaint.

scrollHorizontal()

Will scroll left or right dependent on the boolean.

void scrollHorizontal(
  in boolean left
);
Parameters
left
If true will scroll left. If not will scroll right.

scrollLine()

Will scroll line up or down dependent on the boolean.

void scrollLine(
  in boolean forward
);
Parameters
forward
Scroll forward or backwards in selection.

scrollPage()

Will scroll the page without affecting the selection.

void scrollPage(
  in boolean forward
);
Parameters
forward
Scroll forward or backwards in selection.

scrollSelectionIntoView()

Scrolls a region of the selection, so that it is visible in the scrolled view.

Note: If isSynchronous is true, calling this method may flush the pending reflow. This is dangerous for some objects. See bug 418470, comment 12 for details.
void scrollSelectionIntoView(
  in short type,
  in short region,
  in short flags
);
Parameters
type
The selection to scroll into view. (SelectionType)
region
The region inside the selection to scroll into view. (SelectionRegion)
flags
One of the SCROLL_* constants.
Exceptions thrown
Missing Exception
Missing Description

selectAll()

Will select the whole page.

void selectAll();
Parameters

None.

setCaretEnabled()

Set the caret as enabled or disabled. An enabled caret will draw or blink when made visible. A disabled caret will never show up. Can be called any time.

void setCaretEnabled(
  in boolean enabled
);
Parameters
enabled
PR_TRUE to enable caret. PR_FALSE to disable.

setCaretReadOnly()

Set the caret readonly or not. An readonly caret will draw but not blink when made visible.

void setCaretReadOnly(
  in boolean readOnly
);
Parameters
readOnly
PR_TRUE to enable caret. PR_FALSE to disable.

setCaretVisibilityDuringSelection()

Show the caret even in selections. By default the caret is hidden unless the selection is collapsed. Use this function to show the caret even in selections.

void setCaretVisibilityDuringSelection(
  in boolean visibility
);
Parameters
visibility
PR_TRUE to show the caret in selections. PR_FALSE to hide.

setCaretWidth()

Obsolete since Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)

Set the carets width. Can be called any time.

void setCaretWidth(
  in short pixels
);
Parameters
pixels
The width to set the caret to in pixels.

setDisplaySelection()

Will set the display mode for the selection.

void setDisplaySelection(
  in short toggle
);
Parameters
toggle
OFF, ON, DISABLED.
Native code only!

wordExtendForDelete

Will extend the selection one word forward/backward in the document. This method is used internally for handling ctrl[option]-backspace and ctrl[option]-del.

void wordExtendForDelete(
  in boolean forward
);
Parameters
forward
Forward or backward if PR_FALSE.

wordMove()

Wwill move the selection one word forward/backward in the document. This will also have the effect of collapsing the selection if the extend = PR_FALSE the "point" of selection that is extended is considered the "focus" point, or the last point adjusted by the selection.

void wordMove(
  in boolean forward,
  in boolean extend
);
Parameters
forward
Forward or backward if PR_FALSE.
extend
Should it collapse the selection or extend it?

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

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

发布评论

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

词条统计

浏览:49 次

字数:23012

最后编辑:7 年前

编辑次数:0 次

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