HtmlContainerInt
Low level handling of Html Renderer logic. Allows html layout and rendering without association to actual control, those allowing to handle html rendering on any graphics object. Using this class will require the client to handle all propagation's of mouse/keyboard events, layout/paint calls, scrolling offset, location/size/rectangle handling and UI refresh requests.
Implementa: IDisposable
Construtores
HtmlContainerInt(RAdapter)
Init.
Propriedades
ActualSize : RSize
The actual size of the rendered html (after layout)
AvoidAsyncImagesLoading : bool
Gets or sets a value indicating if image asynchronous loading should be avoided (default - false). True - images are loaded synchronously during html parsing. False - images are loaded asynchronously to html parsing when downloaded from URL or loaded from disk.
AvoidGeometryAntialias : bool
Gets or sets a value indicating if anti-aliasing should be avoided for geometry like backgrounds and borders (default - false).
AvoidImagesLateLoading : bool
Gets or sets a value indicating if image loading only when visible should be avoided (default - false). True - images are loaded as soon as the html is parsed. False - images that are not visible because of scroll location are not loaded until they are scrolled to.
IsContextMenuEnabled : bool
Is the build-in context menu enabled and will be shown on mouse right click (default - true)
IsSelectionEnabled : bool
Is content selection is enabled for the rendered html (default - true). If set to 'false' the rendered html will be static only with ability to click on links.
Location : RPoint
The top-left most location of the rendered html. This will offset the top-left corner of the rendered html.
MarginBottom : int
the bottom margin between the page end and the text
MarginLeft : int
the left margin between the page start and the text
MarginRight : int
the right margin between the page end and the text
MaxSize : RSize
The max width and height of the rendered html. The max width will effect the html layout wrapping lines, resize images and tables where possible. The max height does NOT effect layout, but will not render outside it (clip).ActualSize can be exceed the max size by layout restrictions (unwrapable line, set image size, etc.). Set zero for unlimited (width\height separately).
ScrollOffset : RPoint
The scroll offset of the html. This will adjust the rendered html by the given offset so the content will be "scrolled".
SelectedHtml : string
Copy the currently selected html segment with style.
SelectedText : string
Get the currently selected text segment in the html.
SelectionBackColor : RColor
the back-color to use for selected text
SelectionForeColor : RColor
the text fore color use for selected text
Métodos
AddHoverBox(CssBox, CssBlock)
Add css box that has ":hover" selector to be handled on mouse hover.
- box
- the box that has the hover selector
- block
- the css block with the css data with the selector
Clear()
Clear the content of the HTML container releasing any resources used to render previously existing content.
ClearSelection()
Clear the current selection.
Dispose(bool)
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
GetAttributeAt(RPoint, string) : string
Get attribute value of element at the given x,y location by given key. If more than one element exist with the attribute at the location the inner most is returned.
- location
- the location to find the attribute at
- attribute
- the attribute key to get value by
Retorna: found attribute value or null if not found
GetElementRectangle(string) : RRect?
Get the rectangle of html element as calculated by html layout. Element if found by id (id attribute on the html element). Note: to get the screen rectangle you need to adjust by the hosting control.
- elementId
- the id of the element to get its rectangle
Retorna: the rectangle of the element or null if not found
GetHtml(HtmlGenerationStyle) : string
Get html from the current DOM tree with style if requested.
- styleGen
- Optional: controls the way styles are generated when html is generated (default: Inline)
Retorna: generated html
GetImageDownloader() : ImageDownloader
Get image downloader to be used to download images for the current html rendering. Lazy create single downloader to be used for all images in the current html.
GetLinkAt(RPoint) : string
Get css link href at the given x,y location.
- location
- the location to find the link at
Retorna: css link href if exists or null
GetLinks() : List<LinkElementData<RRect>>
Get all the links in the HTML with the element rectangle and href data.
Retorna: collection of all the links in the HTML
HandleKeyDown(RControl, RKeyEvent)
Handle key down event for selection and copy.
- parent
- the control hosting the html to invalidate
- e
- the pressed key
HandleLinkClicked(RControl, RPoint, CssBox)
Handle link clicked going over LinkClicked event and using Start if not canceled.
- parent
- the control hosting the html to invalidate
- location
- the location of the mouse
- link
- the link that was clicked
HandleMouseDoubleClick(RControl, RPoint)
Handle mouse double click to select word under the mouse.
- parent
- the control hosting the html to set cursor and invalidate
- location
- the location of the mouse
HandleMouseDown(RControl, RPoint)
Handle mouse down to handle selection.
- parent
- the control hosting the html to invalidate
- location
- the location of the mouse
HandleMouseLeave(RControl)
Handle mouse leave to handle hover cursor.
- 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
- location
- the location of the mouse
HandleMouseUp(RControl, RPoint, RMouseEvent)
Handle mouse up to handle selection and link click.
- parent
- the control hosting the html to invalidate
- location
- the location of the mouse
- e
- the mouse event data
IsMouseInContainer(RPoint) : bool
Check if the mouse is currently on the html container. Relevant if the html container is not filled in the hosted control (location is not zero and the size is not the full size of the control).
OffsetByScroll(RPoint) : RPoint
Adjust the offset of the given location by the current scroll offset.
- location
- the location to adjust
Retorna: the adjusted location
PerformLayout(RGraphics)
Measures the bounds of box and children, recursively.
- g
- Device context to draw
RaiseHtmlImageLoadEvent(HtmlImageLoadEventArgs)
Raise the image load event with the given event args.
- args
- the event args
RaiseHtmlStylesheetLoadEvent(HtmlStylesheetLoadEventArgs)
Raise the stylesheet load event with the given event args.
- args
- the event args
ReportError(HtmlRenderErrorType, string, Exception)
Report error in html render process.
- type
- the type of error to report
- message
- the error message
- exception
- optional: the exception that occured
RequestRefresh(bool)
Request invalidation and re-layout of the control hosting the renderer.
- layout
- is re-layout is required for the refresh
Eventos
ImageLoad : EventHandler<HtmlImageLoadEventArgs>
Raised when an image is about to be loaded by file path or URI. This event allows to provide the image manually, if not handled the image will be loaded from file or download from URI.
LinkClicked : EventHandler<HtmlLinkClickedEventArgs>
Raised when the user clicks on a link in the html. Allows canceling the execution of the link.
LoadComplete : EventHandler
Raised when the set html document has been fully loaded. Allows manipulation of the html dom, scroll position, etc.
Refresh : EventHandler<HtmlRefreshEventArgs>
Raised when html renderer requires refresh of the control hosting (invalidation and re-layout).
RenderError : EventHandler<HtmlRenderErrorEventArgs>
Raised when an error occurred during html rendering.
ScrollChange : EventHandler<HtmlScrollEventArgs>
Raised when Html Renderer request scroll to specific location. This can occur on document anchor click.
StylesheetLoad : EventHandler<HtmlStylesheetLoadEventArgs>
Raised when a stylesheet is about to be loaded by file path or URI by link element. This event allows to provide the stylesheet manually or provide new source (file or Uri) to load from. If no alternative data is provided the original source will be used.
Campos
_actualSize : RSize
The actual size of the rendered html (after layout)
_avoidAsyncImagesLoading : bool
Gets or sets a value indicating if image asynchronous loading should be avoided (default - false).
_avoidGeometryAntialias : bool
Gets or sets a value indicating if anti-aliasing should be avoided for geometry like backgrounds and borders
_avoidImagesLateLoading : bool
Gets or sets a value indicating if image loading only when visible should be avoided (default - false).
_cssParser : CssParser
parser for CSS data
_hoverBoxes : List<HoverBoxBlock>
list of all css boxes that have ":hover" selector on them
_imageDownloader : ImageDownloader
Handler for downloading of images in the html
_isContextMenuEnabled : bool
Is the build-in context menu enabled (default - true)
_isSelectionEnabled : bool
Is content selection is enabled for the rendered html (default - true). If set to 'false' the rendered html will be static only with ability to click on links.
_loadComplete : bool
is the load of the html document is complete
_marginBottom : int
the bottom margin between the page end and the text
_marginLeft : int
the left margin between the page start and the text
_marginRight : int
the right margin between the page end and the text
_marginTop : int
the top margin between the page start and the text
_maxSize : RSize
the max width and height of the rendered html, effects layout, actual size cannot exceed this values. Set zero for unlimited.
_scrollOffset : RPoint
Gets or sets the scroll offset of the document for scroll controls
_selectionBackColor : RColor
the back-color to use for selected text
_selectionForeColor : RColor
the text fore color use for selected text
_selectionHandler : SelectionHandler
Handler for text selection in the html.