SelectionHandler
Handler for text selection in the html.
Implementiert: IDisposable
Konstruktoren
Methoden
CalculateWordCharIndexAndOffset(RControl, CssRect, RPoint, bool)
Calculate the character index and offset by characters for the given word and given offset..
- control
- used to create graphics to measure string
- word
- the word to calculate its index and offset
- loc
- the location to calculate for
- selectionStart
- to set the starting or ending char and offset data
CalculateWordCharIndexAndOffset(RControl, CssRect, RPoint, bool, int, double)
Calculate the character index and offset by characters for the given word and given offset. If the location is below the word line then set the selection to the end. If the location is to the right of the word then set the selection to the end. If the offset is to the left of the word set the selection to the beginning. Otherwise calculate the width of each substring to find the char the location is on.
- control
- used to create graphics to measure string
- word
- the word to calculate its index and offset
- loc
- the location to calculate for
- inclusive
- is to include the first character in the calculation
- selectionIndex
- return the index of the char under the location
- selectionOffset
- return the offset of the char under the location
CheckNonEmptySelection(RPoint, bool) : bool
Check if the current selection is non empty, has some selection data.
- loc
- allowPartialSelect
- true - partial word selection allowed, false - only full words selection
Rückgabe: true - is non empty selection, false - empty selection
CheckSelectionDirection()
Check if the selection direction is forward or backward. Is the selection start word is before the selection end word in DFS traversal.
ClearSelection(CssBox)
Clear the selection from all the words in the css box recursively.
- box
- the css box to selectionStart clear at
ClearSelection()
Clear the current selection.
CopySelectedHtml()
Copy the currently selected html segment to clipboard. Copy rich html text and plain text.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
GetSelectedEndIndexOffset(CssRect) : int
The selection end index if the last selected word is partially selected (-1 if not selected or fully selected) if the given word is not starting or ending selection word -1 is returned as full word selection is in place.
- word
- the word to return the selection end index for
GetSelectedEndOffset(CssRect) : double
The selection end offset if the last selected word is partially selected (-1 if not selected or fully selected) if the given word is not starting or ending selection word -1 is returned as full word selection is in place.
- word
- the word to return the selection end offset for
GetSelectedHtml() : string
Copy the currently selected html segment with style.
GetSelectedStartOffset(CssRect) : double
The selection start offset if the first selected word is partially selected (-1 if not selected or fully selected) if the given word is not starting or ending selection word -1 is returned as full word selection is in place.
- word
- the word to return the selection start offset for
GetSelectedText() : string
Get the currently selected text segment in the html.
GetSelectingStartIndex(CssRect) : int
The selection start index if the first selected word is partially selected (-1 if not selected or fully selected) if the given word is not starting or ending selection word -1 is returned as full word selection is in place.
- word
- the word to return the selection start index for
Rückgabe: data value or -1 if not applicable
HandleMouseDown(RControl, RPoint, bool)
Handle mouse down to handle selection.
- parent
- the control hosting the html to invalidate
- loc
- the location of the mouse on the html
- isMouseInContainer
HandleMouseLeave(RControl)
On mouse leave change the cursor back to default.
- parent
- the control hosting the html to set cursor and invalidate
HandleMouseMove(RControl, RPoint)
Handle mouse move to handle hover cursor and text selection.
- parent
- the control hosting the html to set cursor and invalidate
- loc
- the location of the mouse on the html
HandleMouseUp(RControl, bool) : bool
Handle mouse up to handle selection and link click.
- parent
- the control hosting the html to invalidate
- leftMouseButton
- is the left mouse button has been released
Rückgabe: is the mouse up should be ignored
HandleSelection(RControl, RPoint, bool)
Handle html text selection by mouse move over the html with left mouse button pressed. Calculate the words in the selected range and set their selected property.
- control
- the control hosting the html to invalidate
- loc
- the mouse location
- allowPartialSelect
- true - partial word selection allowed, false - only full words selection
SelectAll(RControl)
Select all the words in the html.
- control
- the control hosting the html to invalidate
SelectAllWords(CssBox)
Select all the words that are under DOM hierarchy.
- box
- the box to start select all at
SelectWord(RControl, RPoint)
Select the word at the given location if found.
- control
- the control hosting the html to invalidate
- loc
- the location to select word at
SelectWordsInRange(CssBox, CssRect, CssRect)
Select all the words that are between word and word in the DOM hierarchy.
- root
- the root of the DOM sub-tree the selection is in
- selectionStart
- selection start word limit
- selectionEnd
- selection end word limit
SelectWordsInRange(CssBox, CssRect, CssRect, bool) : bool
Select all the words that are between word and word in the DOM hierarchy.
- box
- the current traversal node
- selectionStart
- selection start word limit
- selectionEnd
- selection end word limit
- inSelection
- used to know the traversal is currently in selected range
StartDragDrop(RControl)
Start drag & drop operation on the currently selected html segment.
- control
- the control to start the drag & drop on
Felder
_backwardSelection : bool
is the selection goes backward in the html, the starting word comes after the ending word in DFS traversing.
_contextMenuHandler : ContextMenuHandler
handler for showing context menu on right click
_cursorChanged : bool
is the cursor on the control has been changed by the selection handler
_dragDropData : object
used to know if drag & drop was already started not to execute the same operation over
_inSelection : bool
used to ignore mouse up after selection
_isDoubleClickSelect : bool
current selection process is after double click (full word selection)
_lastMouseDown : DateTime
used to know if double click selection is requested
_mouseDownInControl : bool
used to know if selection is in the control or started outside so it needs to be ignored
_mouseDownOnSelectedWord : bool
used to handle drag & drop
_selectionEnd : CssRect
the ending word of html selection where the user ended the selection, if the selection is backwards then it will be the first selected word.
_selectionEndIndex : int
the selection end index if the last selected word is partially selected (-1 if not selected or fully selected)
_selectionEndOffset : double
the selection end offset if the last selected word is partially selected (-1 if not selected or fully selected)
_selectionStart : CssRect
the starting word of html selection where the user started the selection, if the selection is backwards then it will be the last selected word.
_selectionStartIndex : int
the selection start index if the first selected word is partially selected (-1 if not selected or fully selected)
_selectionStartOffset : double
the selection start offset if the first selected word is partially selected (-1 if not selected or fully selected)
_selectionStartPoint : RPoint
the mouse location when selection started used to ignore small selections