htmlayout_dom.h File Reference

HTML Document Object Model. More...

#include "json-value.h"

Typedefs

typedef int HLDOM_RESULT
 Type of the result value for HTMLayout DOM functions.
typedef LPVOID HELEMENT
 DOM element handle.
typedef LPVOID HRANGE
 DOM range handle.
typedef BOOL CALLBACK HTMLayoutElementCallback (HELEMENT he, LPVOID param)
 Callback function used with HTMLayoutVisitElement().
typedef BOOL CALLBACK ElementEventProc (LPVOID tag, HELEMENT he, UINT evtg, LPVOID prms)
 Element callback function for all types of events.
typedef INT CALLBACK ELEMENT_COMPARATOR (HELEMENT he1, HELEMENT he2, LPVOID param)
 Callback comparator function used with HTMLayoutSortElements().
typedef BOOL CALLBACK HTMLayoutEnumerationCallback (LPVOID p, HELEMENT he, int pos, int postype, WCHAR code)
 Callback function used with HTMLayoutEnumearate().

Enumerations

enum  REQUEST_TYPE
 HTMLayoutSendRequest - send GET or POST request for the element. More...
enum  CTL_TYPE {
  CTL_NO, CTL_UNKNOWN = 1, CTL_EDIT, CTL_NUMERIC,
  CTL_BUTTON, CTL_CHECKBOX, CTL_RADIO, CTL_SELECT_SINGLE,
  CTL_SELECT_MULTIPLE, CTL_DD_SELECT, CTL_TEXTAREA, CTL_HTMLAREA,
  CTL_PASSWORD, CTL_PROGRESS, CTL_SLIDER, CTL_DECIMAL,
  CTL_CURRENCY
}
 Control types. More...
enum  ADVANCE_TO
 HTMLayoutRange*** - range manipulation routines. More...

Functions

EXTERN_C HLDOM_RESULT HLAPI HTMLayout_UseElement (HELEMENT he)
 Marks DOM object as used (a.k.a.
EXTERN_C HLDOM_RESULT HLAPI HTMLayout_UnuseElement (HELEMENT he)
 Marks DOM object as unused (a.k.a.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetRootElement (HWND hwnd, HELEMENT *phe)
 Get root DOM element of HTML document.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetFocusElement (HWND hwnd, HELEMENT *phe)
 Get focused DOM element of HTML document.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutFindElement (HWND hwnd, POINT pt, HELEMENT *phe)
 Find DOM element by coordinate.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetChildrenCount (HELEMENT he, UINT *count)
 Get number of child elements.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetNthChild (HELEMENT he, UINT n, HELEMENT *phe)
 Get handle of every element's child element.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetParentElement (HELEMENT he, HELEMENT *p_parent_he)
 Get parent element.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetElementText (HELEMENT he, LPWSTR characters, LPUINT length)
 Get text of the element and information where child elements are placed.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetElementHtml (HELEMENT he, LPBYTE *utf8bytes, BOOL outer)
 Get text of the element and information where child elements are placed.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetElementInnerText (HELEMENT he, LPBYTE *utf8bytes)
 Get inner text of the element.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSetElementInnerText (HELEMENT he, LPCBYTE utf8bytes, UINT length)
 Set inner text of the element.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetElementInnerText16 (HELEMENT he, LPWSTR *utf16words)
 Get inner text of the element as LPWSTR (utf16 words).
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSetElementInnerText16 (HELEMENT he, LPCWSTR utf16words, UINT length)
 Set inner text of the element from LPCWSTR buffer (utf16 words).
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetAttributeCount (HELEMENT he, LPUINT p_count)
 Get number of element's attributes.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetNthAttribute (HELEMENT he, UINT n, LPCSTR *p_name, LPCWSTR *p_value)
 Get value of any element's attribute by attribute's number.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetAttributeByName (HELEMENT he, LPCSTR name, LPCWSTR *p_value)
 Get value of any element's attribute by name.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSetAttributeByName (HELEMENT he, LPCSTR name, LPCWSTR value)
 Set attribute's value.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutClearAttributes (HELEMENT he)
 Remove all attributes from the element.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetElementIndex (HELEMENT he, LPUINT p_index)
 Get element index.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetElementType (HELEMENT he, LPCSTR *p_type)
 Get element's type.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetStyleAttribute (HELEMENT he, LPCSTR name, LPCWSTR *p_value)
 Get element's style attribute.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSetStyleAttribute (HELEMENT he, LPCSTR name, LPCWSTR value)
 Get element's style attribute.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutUpdateElement (HELEMENT he, BOOL renderNow)
 Apply changes and refresh element area in its window.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutUpdateElementEx (HELEMENT he, UINT flags)
 Apply changes and refresh element area in its window.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSetCapture (HELEMENT he)
 Set the mouse capture to the specified element.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetElementHwnd (HELEMENT he, HWND *p_hwnd, BOOL rootWindow)
 Get HWND of containing window.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutCombineURL (HELEMENT he, LPWSTR szUrlBuffer, DWORD UrlBufferSize)
 Combine given URL with URL of the document element belongs to.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutVisitElements (HELEMENT he, LPCSTR tagName, LPCSTR attributeName, LPCWSTR attributeValue, HTMLayoutElementCallback *callback, LPVOID param, DWORD depth)
 Call specified function for every element in a DOM that meets specified criteria.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSelectElements (HELEMENT he, LPCSTR CSS_selectors, HTMLayoutElementCallback *callback, LPVOID param)
 Call specified function for every element in a DOM that meets specified CSS selectors.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSelectParent (HELEMENT he, LPCSTR selector, UINT depth, HELEMENT *heFound)
 Find parent of the element by CSS selector.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSetElementHtml (HELEMENT he, LPCBYTE html, DWORD htmlLength, UINT where)
 Set inner or outer html of the element.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutDeleteElement (HELEMENT he)
 Delete element.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetElementUID (HELEMENT he, UINT *puid)
 Get Element UID.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetElementByUID (HWND hwnd, UINT uid, HELEMENT *phe)
 Get Element handle by its UID.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutShowPopup (HELEMENT hePopup, HELEMENT heAnchor, UINT placement)
 Shows block element (DIV) in popup window.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutShowPopupAt (HELEMENT hePopup, POINT pos, BOOL animate)
 Shows block element (DIV) in popup window at given position.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutHidePopup (HELEMENT he)
 Removes popup window.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetElementState (HELEMENT he, UINT *pstateBits)
 Get/set state bits, stateBits*** accept or'ed values above.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutCreateElement (LPCSTR tagname, LPCWSTR textOrNull, HELEMENT *phe)
 Create new element, the element is disconnected initially from the DOM.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutCloneElement (HELEMENT he, HELEMENT *phe)
 Create new element as copy of existing element, new element is a full (deep) copy of the element and is disconnected initially from the DOM.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutInsertElement (HELEMENT he, HELEMENT hparent, UINT index)
 Insert element at index position of parent.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutDetachElement (HELEMENT he)
 Take element out of its container (and DOM tree).
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSetTimer (HELEMENT he, UINT milliseconds)
 Start Timer for the element.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutAttachEventHandler (HELEMENT he, LPELEMENT_EVENT_PROC pep, LPVOID tag)
 Attach/Detach ElementEventProc to the element See htmlayout::event_handler.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutAttachEventHandlerEx (HELEMENT he, LPELEMENT_EVENT_PROC pep, LPVOID tag, UINT subscription)
 Attach ElementEventProc to the element and subscribe it to events providede by subscription parameter See htmlayout::attach_event_handler.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutWindowAttachEventHandler (HWND hwndLayout, LPELEMENT_EVENT_PROC pep, LPVOID tag, UINT subscription)
 Attach/Detach ElementEventProc to the htmlayout window.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSendEvent (HELEMENT he, UINT appEventCode, HELEMENT heSource, UINT_PTR reason, BOOL *handled)
 SendEvent - sends sinking/bubbling event to the child/parent chain of he element.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutPostEvent (HELEMENT he, UINT appEventCode, HELEMENT heSource, UINT reason)
 PostEvent - post sinking/bubbling event to the child/parent chain of he element.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutCallBehaviorMethod (HELEMENT he, METHOD_PARAMS *params)
 HTMLayoutCallMethod - calls behavior specific method.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutRequestElementData (HELEMENT he, LPCWSTR url, UINT dataType, HELEMENT initiator)
 HTMLayoutRequestElementData - request data download for the element.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetScrollInfo (HELEMENT he, LPPOINT scrollPos, LPRECT viewRect, LPSIZE contentSize)
 HTMLayoutGetScrollInfo - get scroll info of element with overflow:scroll or auto.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSetScrollPos (HELEMENT he, POINT scrollPos, BOOL smooth)
 HTMLayoutSetScrollPos - set scroll position of element with overflow:scroll or auto.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutIsElementVisible (HELEMENT he, BOOL *pVisible)
 HTMLayoutIsElementVisible - deep visibility, determines if element visible - has no visiblity:hidden and no display:none defined for itself or for any its parents.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutIsElementEnabled (HELEMENT he, BOOL *pEnabled)
 HTMLayoutIsElementEnabled - deep enable state, determines if element enabled - is not disabled by itself or no one of its parents is disabled.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSortElements (HELEMENT he, UINT firstIndex, UINT lastIndex, ELEMENT_COMPARATOR *cmpFunc, LPVOID cmpFuncParam)
 HTMLayoutSortElements - sort children of the element.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSwapElements (HELEMENT he1, HELEMENT he2)
 HTMLayoutSwapElements - swap element positions.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutTraverseUIEvent (UINT evt, LPVOID eventCtlStruct, LPBOOL bOutProcessed)
 HTMLayoutTraverseUIEvent - traverse (sink-and-bubble) MOUSE or KEY event.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutControlGetType (HELEMENT he, UINT *pType)
 HTMLayoutControlGetType - get type of control - type of behavior assigned to the element.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutControlGetValue (HELEMENT he, JSON_VALUE *pVal)
 HTMLayoutControlGetValue - get value of the control.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutControlSetValue (HELEMENT he, const JSON_VALUE *pVal)
 HTMLayoutControlSetValue - set value of the control and update UI.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutEnumerate (HELEMENT he, HTMLayoutEnumerationCallback *pcb, LPVOID p, BOOL forward)
 HTMLayoutEnumerate - character by character enumeartion of the dom.
EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetCharacterRect (HELEMENT he, int pos, RECT *outRect)
 HTMLayoutGetCharacterRect - position of single character on the screen.


Detailed Description

HTML Document Object Model.


Typedef Documentation

typedef INT CALLBACK ELEMENT_COMPARATOR(HELEMENT he1, HELEMENT he2, LPVOID param)

Callback comparator function used with HTMLayoutSortElements().

Shall return -1,0,+1 values to indicate result of comparison of two elements

typedef BOOL CALLBACK ElementEventProc(LPVOID tag, HELEMENT he, UINT evtg, LPVOID prms)

Element callback function for all types of events.

Similar to WndProc

Parameters:
tag LPVOID, tag assigned by HTMLayoutAttachElementProc function (like GWL_USERDATA)
he HELEMENT, this element handle (like HWND)
evtg UINT, group identifier of the event, value is one of EVENT_GROUPS
prms LPVOID, pointer to group specific parameters structure.
Returns:
TRUE if event was handled, FALSE otherwise.

typedef LPVOID HELEMENT

DOM element handle.

typedef int HLDOM_RESULT

Type of the result value for HTMLayout DOM functions.

Possible values are:

typedef LPVOID HRANGE

DOM range handle.

typedef BOOL CALLBACK HTMLayoutElementCallback(HELEMENT he, LPVOID param)

Callback function used with HTMLayoutVisitElement().

typedef BOOL CALLBACK HTMLayoutEnumerationCallback(LPVOID p, HELEMENT he, int pos, int postype, WCHAR code)

Callback function used with HTMLayoutEnumearate().

Parameters:
[in] he HELEMENT, element.
[in] pos int, position in the element.
[in] postype int, position type : 0 - he element head position. 1 - he element tail position. 2 - subblock insertion position 3 - character position.
[in] code int, UTF16 code unit value if postype == 3


Enumeration Type Documentation

enum ADVANCE_TO

HTMLayoutRange*** - range manipulation routines.

ATTN: Not completed yet

enum CTL_TYPE

Control types.

Control here is any dom element having appropriate behavior applied

Enumerator:
CTL_NO  This dom element has no behavior at all.
CTL_UNKNOWN  This dom element has behavior but its type is unknown.
CTL_EDIT  Single line edit box.
CTL_NUMERIC  Numeric input with optional spin buttons.
CTL_BUTTON  Command button.
CTL_CHECKBOX  CheckBox (button).
CTL_RADIO  OptionBox (button).
CTL_SELECT_SINGLE  Single select, ListBox or TreeView.
CTL_SELECT_MULTIPLE  Multiselectable select, ListBox or TreeView.
CTL_DD_SELECT  Dropdown single select.
CTL_TEXTAREA  Multiline TextBox.
CTL_HTMLAREA  WYSIWYG HTML editor.
CTL_PASSWORD  Password input element.
CTL_PROGRESS  Progress element.
CTL_SLIDER  Slider input element.
CTL_DECIMAL  Decimal number input element.
CTL_CURRENCY  Currency input element.

enum REQUEST_TYPE

HTMLayoutSendRequest - send GET or POST request for the element.

event handler on the 'he' element (if any) will be notified when data will be ready by receiving HANDLE_DATA_DELIVERY event.


Function Documentation

EXTERN_C HLDOM_RESULT HLAPI HTMLayout_UnuseElement ( HELEMENT  he  ) 

Marks DOM object as unused (a.k.a.

Release). Get handle of every element's child element.

Parameters:
[in] he HELEMENT
Returns:
HLDOM_RESULT
Application should call this function when it does not need element's handle anymore.
See also:
HTMLayout_UseElement()

EXTERN_C HLDOM_RESULT HLAPI HTMLayout_UseElement ( HELEMENT  he  ) 

Marks DOM object as used (a.k.a.

AddRef).

Parameters:
[in] he HELEMENT
Returns:
HLDOM_RESULT Application should call this function before using element handle. If the application fails to do that calls to other DOM functions for this handle may result in an error.
See also:
HTMLayout_UnuseElement()

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutCallBehaviorMethod ( HELEMENT  he,
METHOD_PARAMS *  params 
)

HTMLayoutCallMethod - calls behavior specific method.

Parameters:
[in] he HELEMENT, element - source of the event.
[in] params METHOD_PARAMS, pointer to method param block

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutClearAttributes ( HELEMENT  he  ) 

Remove all attributes from the element.

Parameters:
[in] he HELEMENT
Returns:
HLDOM_RESULT

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutCloneElement ( HELEMENT  he,
HELEMENT phe 
)

Create new element as copy of existing element, new element is a full (deep) copy of the element and is disconnected initially from the DOM.

Element created with ref_count = 1 thus you must call HTMLayout_UnuseElement on returned handler.

Parameters:
[in] he HELEMENT, source element.
[out] phe HELEMENT*, variable to receive handle of the new element.

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutCombineURL ( HELEMENT  he,
LPWSTR  szUrlBuffer,
DWORD  UrlBufferSize 
)

Combine given URL with URL of the document element belongs to.

Parameters:
[in] he HELEMENT
[in,out] szUrlBuffer LPWSTR, at input this buffer contains zero-terminated URL to be combined, after function call it contains zero-terminated combined URL
[in] UrlBufferSize DWORD, size of the buffer pointed by szUrlBuffer
Returns:
HLDOM_RESULT
This function is used for resolving relative references.

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutControlGetType ( HELEMENT  he,
UINT *  pType 
)

HTMLayoutControlGetType - get type of control - type of behavior assigned to the element.

Parameters:
[in] he HELEMENT, element.
[out] pType UINT*, pointer to variable receiving control type, for list of values see CTL_TYPE.

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutControlGetValue ( HELEMENT  he,
JSON_VALUE *  pVal 
)

HTMLayoutControlGetValue - get value of the control.

Parameters:
[in] he HELEMENT, element.
[out] pVal JSON_VALUE*, pointer to variable receiving control value.
*pVal - variable shall be properly initialized before the call

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutControlSetValue ( HELEMENT  he,
const JSON_VALUE *  pVal 
)

HTMLayoutControlSetValue - set value of the control and update UI.

Parameters:
[in] he HELEMENT, element.
[in] pVal const JSON_VALUE*, pointer to variable to set value from.
*pVal - variable shall contain valid JSON_VALUE.

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutCreateElement ( LPCSTR  tagname,
LPCWSTR  textOrNull,
HELEMENT phe 
)

Create new element, the element is disconnected initially from the DOM.

Element created with ref_count = 1 thus you must call HTMLayout_UnuseElement on returned handler.

Parameters:
[in] tagname LPCSTR, html tag of the element e.g. "div", "option", etc.
[in] textOrNull LPCWSTR, initial text of the element or NULL. text here is a plain text - method does no parsing.
[out] phe HELEMENT*, variable to receive handle of the element

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutDeleteElement ( HELEMENT  he  ) 

Delete element.

Parameters:
[in] he HELEMENT
Returns:
HLDOM_RESULT
This function removes element from the DOM tree and then deletes it.

Warning:
After call to this function he will become invalid.

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutDetachElement ( HELEMENT  he  ) 

Take element out of its container (and DOM tree).

Element will be destroyed when its reference counter will become zero

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutEnumerate ( HELEMENT  he,
HTMLayoutEnumerationCallback pcb,
LPVOID  p,
BOOL  forward 
)

HTMLayoutEnumerate - character by character enumeartion of the dom.

Parameters:
[in] he HELEMENT, element.
[in] pcb HTMLayoutEnumearationCallback, pointer to function that is called on each character position.
[in] forward BOOL, direction of the enumeration, TRUE - forward.

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutFindElement ( HWND  hwnd,
POINT  pt,
HELEMENT phe 
)

Find DOM element by coordinate.

Parameters:
[in] hwnd HWND, HTMLayout window for which you need to find elementz
[in] pt POINT, coordinates, window client area relative.
[out] phe HELEMENT*, variable to receive found element handle.
Returns:
HLDOM_RESULT
If element was not found then *phe will be set to zero.

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetAttributeByName ( HELEMENT  he,
LPCSTR  name,
LPCWSTR *  p_value 
)

Get value of any element's attribute by name.

Parameters:
[in] he HELEMENT
[in] name LPCSTR, attribute name
[out] p_value LPCWSTR*, will be set to address of the string containing attribute value
Returns:
HLDOM_RESULT

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetAttributeCount ( HELEMENT  he,
LPUINT  p_count 
)

Get number of element's attributes.

Parameters:
[in] he HELEMENT
[out] p_count LPUINT, variable to receive number of element attributes.
Returns:
HLDOM_RESULT

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetCharacterRect ( HELEMENT  he,
int  pos,
RECT *  outRect 
)

HTMLayoutGetCharacterRect - position of single character on the screen.

Parameters:
[in] he HELEMENT, element.
[in] pos int, index of the character in the he element.
[out] outRect RECT, rectangle that will receive view relative coordinates of the character placeholder.

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetChildrenCount ( HELEMENT  he,
UINT *  count 
)

Get number of child elements.

Parameters:
[in] he HELEMENT, element which child elements you need to count
[out] count UINT*, variable to receive number of child elements
Returns:
HLDOM_RESULT
Example:
for paragraph defined as
<p>Hello <b>wonderfull</b> world!</p> 
count will be set to 1 as the paragraph has only one sub element:
<b>wonderfull</b> 

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetElementByUID ( HWND  hwnd,
UINT  uid,
HELEMENT phe 
)

Get Element handle by its UID.

Parameters:
[in] hwnd HWND, HWND of HTMLayout window
[in] uid UINT
[out] phe HELEMENT*, variable to receive HELEMENT handle
Returns:
HLDOM_RESULT
This function retrieves element UID by its handle.

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetElementHtml ( HELEMENT  he,
LPBYTE *  utf8bytes,
BOOL  outer 
)

Get text of the element and information where child elements are placed.

Parameters:
[in] he HELEMENT
[out] utf8bytes pointer to byte address receiving UTF8 encoded HTML
[in] outer BOOL, if TRUE will retunr outer HTML otherwise inner.
Returns:
HLDOM_RESULT

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetElementHwnd ( HELEMENT  he,
HWND *  p_hwnd,
BOOL  rootWindow 
)

Get HWND of containing window.

Parameters:
[in] he HELEMENT
[out] p_hwnd HWND*, variable to receive window handle
[in] rootWindow BOOL, handle of which window to get:
  • TRUE - HTMLayout window
  • FALSE - nearest parent element having overflow:auto or :scroll
Returns:
HLDOM_RESULT

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetElementIndex ( HELEMENT  he,
LPUINT  p_index 
)

Get element index.

Parameters:
[in] he HELEMENT
[out] p_index LPUINT, variable to receive number of the element among parent element's subelements.
Returns:
HLDOM_RESULT

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetElementInnerText ( HELEMENT  he,
LPBYTE *  utf8bytes 
)

Get inner text of the element.

Parameters:
[in] he HELEMENT
[out] utf8bytes pointer to byte address receiving UTF8 encoded plain text
Returns:
HLDOM_RESULT

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetElementInnerText16 ( HELEMENT  he,
LPWSTR *  utf16words 
)

Get inner text of the element as LPWSTR (utf16 words).

Parameters:
[in] he HELEMENT
[out] utf16words pointer to byte address receiving UTF16 encoded plain text
Returns:
HLDOM_RESULT

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetElementText ( HELEMENT  he,
LPWSTR  characters,
LPUINT  length 
)

Get text of the element and information where child elements are placed.

Parameters:
[in] he HELEMENT
[out] characters LPWSTR, buffer to receive text. Zero characters '\0' will be inserted at places where subelements should be.
[in,out] length LPUINT, at input it is length of the characters array, after function call it is actual amount of characters written.
Returns:
HLDOM_RESULT
parameter characters can be NULL. In this case HTMEngine will just set length equal to number of characters in this element.

Example:
for paragraph defined as
<p>Hello <b>wonderfull</b> <i>world</i>!</p> 
text will be "Hello \\0 \\0" ('\0' is character with code zero)

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetElementType ( HELEMENT  he,
LPCSTR *  p_type 
)

Get element's type.

Parameters:
[in] he HELEMENT
[out] p_type LPCSTR*, receives name of the element type.
Returns:
HLDOM_RESULT
Example:
For <div> tag p_type will be set to "div".

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetElementUID ( HELEMENT  he,
UINT *  puid 
)

Get Element UID.

Parameters:
[in] he HELEMENT
[out] puid UINT*, variable to receive UID of the element.
Returns:
HLDOM_RESULT
This function retrieves element UID by its handle.

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetFocusElement ( HWND  hwnd,
HELEMENT phe 
)

Get focused DOM element of HTML document.

Parameters:
[in] hwnd HWND, HTMLayout window for which you need to get focus element
[out] phe HELEMENT*, variable to receive focus element
Returns:
HLDOM_RESULT
phe can have null value (0).

COMMENT: To set focus on element use HTMLayoutSetElementState(STATE_FOCUS,0)

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetNthAttribute ( HELEMENT  he,
UINT  n,
LPCSTR *  p_name,
LPCWSTR *  p_value 
)

Get value of any element's attribute by attribute's number.

Parameters:
[in] he HELEMENT
[in] n UINT, number of desired attribute
[out] p_name LPCSTR*, will be set to address of the string containing attribute name
[out] p_value LPCWSTR*, will be set to address of the string containing attribute value
Returns:
HLDOM_RESULT

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetNthChild ( HELEMENT  he,
UINT  n,
HELEMENT phe 
)

Get handle of every element's child element.

Parameters:
[in] he HELEMENT
[in] n UINT, number of the child element
[out] phe HELEMENT*, variable to receive handle of the child element
Returns:
HLDOM_RESULT
Example:
for paragraph defined as
<p>Hello <b>wonderfull</b> world!</p> 
*phe will be equal to handle of <b> element:
<b>wonderfull</b> 

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetParentElement ( HELEMENT  he,
HELEMENT p_parent_he 
)

Get parent element.

Parameters:
[in] he HELEMENT, element which parent you need
[out] p_parent_he HELEMENT*, variable to recieve handle of the parent element
Returns:
HLDOM_RESULT

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetRootElement ( HWND  hwnd,
HELEMENT phe 
)

Get root DOM element of HTML document.

Parameters:
[in] hwnd HWND, HTMLayout window for which you need to get root element
[out] phe HELEMENT*, variable to receive root element
Returns:
HLDOM_RESULT
Root DOM object is always a 'HTML' element of the document.

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetScrollInfo ( HELEMENT  he,
LPPOINT  scrollPos,
LPRECT  viewRect,
LPSIZE  contentSize 
)

HTMLayoutGetScrollInfo - get scroll info of element with overflow:scroll or auto.

Parameters:
[in] he HELEMENT, element.
[out] scrollPos LPPOINT, scroll position.
[out] viewRect LPRECT, position of element scrollable area, content box minus scrollbars.
[out] contentSize LPSIZE, size of scrollable element content.

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutGetStyleAttribute ( HELEMENT  he,
LPCSTR  name,
LPCWSTR *  p_value 
)

Get element's style attribute.

Parameters:
[in] he HELEMENT
[in] name LPCSTR, name of the style attribute
[out] p_value LPCWSTR*, variable to receive value of the style attribute.
Style attributes are those that are set using css. E.g. "font-face: arial" or "display: block".

See also:
HTMLayoutSetStyleAttribute()

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutHidePopup ( HELEMENT  he  ) 

Removes popup window.

Parameters:
[in] he HELEMENT, element which belongs to popup window or popup element itself

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutInsertElement ( HELEMENT  he,
HELEMENT  hparent,
UINT  index 
)

Insert element at index position of parent.

It is not an error to insert element which already has parent - it will be disconnected first, but you need to update elements parent in this case.

Parameters:
index UINT, position of the element in parent collection. It is not an error to provide index greater than elements count in parent - it will be appended.

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutIsElementEnabled ( HELEMENT  he,
BOOL *  pEnabled 
)

HTMLayoutIsElementEnabled - deep enable state, determines if element enabled - is not disabled by itself or no one of its parents is disabled.

Parameters:
[in] he HELEMENT, element.
[out] pEnabled LPBOOL, enabled state.

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutIsElementVisible ( HELEMENT  he,
BOOL *  pVisible 
)

HTMLayoutIsElementVisible - deep visibility, determines if element visible - has no visiblity:hidden and no display:none defined for itself or for any its parents.

Parameters:
[in] he HELEMENT, element.
[out] pVisible LPBOOL, visibility state.

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutPostEvent ( HELEMENT  he,
UINT  appEventCode,
HELEMENT  heSource,
UINT  reason 
)

PostEvent - post sinking/bubbling event to the child/parent chain of he element.

Function will return immediately posting event into input queue of the application.

Parameters:
[in] he HELEMENT, element to send this event to.
[in] appEventCode UINT, event ID, see: BEHAVIOR_EVENTS
[in] heSource HELEMENT, optional handle of the source element, e.g. some list item
[in] reason UINT, notification specific event reason code

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutRequestElementData ( HELEMENT  he,
LPCWSTR  url,
UINT  dataType,
HELEMENT  initiator 
)

HTMLayoutRequestElementData - request data download for the element.

Parameters:
[in] he HELEMENT, element to deleiver data to.
[in] url LPCWSTR, url to download data from.
[in] dataType UINT, data type, see HTMLayoutResourceType.
[in] hInitiator HELEMENT, element - initiator, can be NULL.
event handler on the he element (if any) will be notified when data will be ready by receiving HANDLE_DATA_DELIVERY event.

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSelectElements ( HELEMENT  he,
LPCSTR  CSS_selectors,
HTMLayoutElementCallback callback,
LPVOID  param 
)

Call specified function for every element in a DOM that meets specified CSS selectors.

See list of supported selectors: http://terrainformatica.com/htmlayout/selectors.whtm

Parameters:
[in] he HELEMENT
[in] selector LPCSTR, comma separated list of CSS selectors, e.g.: div, id, div[align="right"].
[in] callback HTMLayoutElementCallback*, address of callback function being called on each element found.
[in] param LPVOID, additional parameter to be passed to callback function.
Returns:
HLDOM_RESULT

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSelectParent ( HELEMENT  he,
LPCSTR  selector,
UINT  depth,
HELEMENT heFound 
)

Find parent of the element by CSS selector.

ATTN: function will test first element itself. See list of supported selectors: http://terrainformatica.com/htmlayout/selectors.whtm

Parameters:
[in] he HELEMENT
[in] selector LPCSTR, comma separated list of CSS selectors, e.g.: div, id, div[align="right"].
[out] heFound HELEMENT*, address of result HELEMENT
[in] depth LPVOID, depth of search, if depth == 1 then it will test only element itself. Use depth = 1 if you just want to test he element for matching given CSS selector(s). depth = 0 will scan the whole child parent chain up to the root.
Returns:
HLDOM_RESULT

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSendEvent ( HELEMENT  he,
UINT  appEventCode,
HELEMENT  heSource,
UINT_PTR  reason,
BOOL *  handled 
)

SendEvent - sends sinking/bubbling event to the child/parent chain of he element.

First event will be send in SINKING mode (with SINKING flag) - from root to he element itself. Then from he element to its root on parents chain without SINKING flag (bubbling phase).

Parameters:
[in] he HELEMENT, element to send this event to.
[in] appEventCode UINT, event ID, see: BEHAVIOR_EVENTS
[in] heSource HELEMENT, optional handle of the source element, e.g. some list item
[in] reason UINT, notification specific event reason code
[out] handled BOOL*, variable to receive TRUE if any handler handled it, FALSE otherwise.

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSetAttributeByName ( HELEMENT  he,
LPCSTR  name,
LPCWSTR  value 
)

Set attribute's value.

Parameters:
[in] he HELEMENT
[in] name LPCSTR, attribute name
[in] value LPCWSTR, new attribute value or 0 if you want to remove attribute.
Returns:
HLDOM_RESULT

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSetCapture ( HELEMENT  he  ) 

Set the mouse capture to the specified element.

Parameters:
[in] he HELEMENT
Returns:
HLDOM_RESULT
After call to this function all mouse events will be targeted to the element. To remove mouse capture call ReleaseCapture() function. It is declared somewhere in <windows.h>.

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSetElementHtml ( HELEMENT  he,
LPCBYTE  html,
DWORD  htmlLength,
UINT  where 
)

Set inner or outer html of the element.

Parameters:
[in] he HELEMENT
[in] html LPCBYTE, UTF-8 encoded string containing html text
[in] htmlLength DWORD, length in bytes of html.
[in] where UINT, possible values are:
  • SIH_REPLACE_CONTENT - replace content of the element
  • SIH_INSERT_AT_START - insert html before first child of the element
  • SIH_APPEND_AFTER_LAST - insert html after last child of the element

Returns:
/b HLDOM_RESULT

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSetElementInnerText ( HELEMENT  he,
LPCBYTE  utf8bytes,
UINT  length 
)

Set inner text of the element.

Parameters:
[in] he HELEMENT
[in] utf8bytes pointer, UTF8 encoded plain text
[in] length UINT, number of bytes in utf8bytes sequence
Returns:
HLDOM_RESULT

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSetElementInnerText16 ( HELEMENT  he,
LPCWSTR  utf16words,
UINT  length 
)

Set inner text of the element from LPCWSTR buffer (utf16 words).

Parameters:
[in] he HELEMENT
[in] utf16words pointer, UTF16 encoded plain text
[in] length UINT, number of words in utf16words sequence
Returns:
HLDOM_RESULT

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSetScrollPos ( HELEMENT  he,
POINT  scrollPos,
BOOL  smooth 
)

HTMLayoutSetScrollPos - set scroll position of element with overflow:scroll or auto.

Parameters:
[in] he HELEMENT, element.
[in] scrollPos POINT, new scroll position.
[in] smooth BOOL, TRUE - do smooth scroll.

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSetStyleAttribute ( HELEMENT  he,
LPCSTR  name,
LPCWSTR  value 
)

Get element's style attribute.

Parameters:
[in] he HELEMENT
[in] name LPCSTR, name of the style attribute
[out] value LPCWSTR, value of the style attribute.
Style attributes are those that are set using css. E.g. "font-face: arial" or "display: block".

See also:
HTMLayoutGetStyleAttribute()

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSetTimer ( HELEMENT  he,
UINT  milliseconds 
)

Start Timer for the element.

Element will receive on_timer event To stop timer call HTMLayoutSetTimer( he, 0 );

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutShowPopup ( HELEMENT  hePopup,
HELEMENT  heAnchor,
UINT  placement 
)

Shows block element (DIV) in popup window.

Parameters:
[in] hePopup HELEMENT, element to show as popup
[in] heAnchor HELEMENT, anchor element - hePopup will be shown near this element
[in] placement UINT, values: 2 - popup element below of anchor 8 - popup element above of anchor 4 - popup element on left side of anchor 6 - popup element on right side of anchor ( see numpad on keyboard to get an idea of the numbers)
Returns:
HLDOM_RESULT

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutShowPopupAt ( HELEMENT  hePopup,
POINT  pos,
BOOL  animate 
)

Shows block element (DIV) in popup window at given position.

Parameters:
[in] hePopup HELEMENT, element to show as popup
[in] pos POINT, popup element position, relative to origin of HTMLayout window.
[in] animate BOOL, true if animation is needed.

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSortElements ( HELEMENT  he,
UINT  firstIndex,
UINT  lastIndex,
ELEMENT_COMPARATOR cmpFunc,
LPVOID  cmpFuncParam 
)

HTMLayoutSortElements - sort children of the element.

Parameters:
[in] he HELEMENT, element which children to be sorted.
[in] firstIndex UINT, first child index to start sorting from.
[in] lastIndex UINT, last index of the sorting range, element with this index will not be included in the sorting.
[in] cmpFunc ELEMENT_COMPARATOR, comparator function.
[in] cmpFuncParam LPVOID, parameter to be passed in comparator function.

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutSwapElements ( HELEMENT  he1,
HELEMENT  he2 
)

HTMLayoutSwapElements - swap element positions.

Function changes "insertion points" of two elements. So it swops indexes and parents of two elements.

Parameters:
[in] he1 HELEMENT, first element.
[in] he2 HELEMENT, second element.

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutTraverseUIEvent ( UINT  evt,
LPVOID  eventCtlStruct,
LPBOOL  bOutProcessed 
)

HTMLayoutTraverseUIEvent - traverse (sink-and-bubble) MOUSE or KEY event.

Parameters:
[in] evt EVENT_GROUPS, either HANDLE_MOUSE or HANDLE_KEY code.
[in] eventCtlStruct LPVOID, pointer on either MOUSE_PARAMS or KEY_PARAMS structure.
[out] bOutProcessed LPBOOL, pointer to BOOL receiving TRUE if event was processed by some element and FALSE otherwise.

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutUpdateElement ( HELEMENT  he,
BOOL  renderNow 
)

Apply changes and refresh element area in its window.

Parameters:
[in] he HELEMENT
[in] renderNow BOOL, if TRUE element will be redrawn immediately.
Returns:
HLDOM_RESULT

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutUpdateElementEx ( HELEMENT  he,
UINT  flags 
)

Apply changes and refresh element area in its window.

Parameters:
[in] he HELEMENT
[in] flags UINT, combination of UPDATE_ELEMENT_FLAGS.
Returns:
HLDOM_RESULT
Note HTMLayoutUpdateElement is an equivalent of HTMLayoutUpdateElementEx(,RESET_STYLE_DEEP | REMEASURE [| REDRAW_NOW ])

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutVisitElements ( HELEMENT  he,
LPCSTR  tagName,
LPCSTR  attributeName,
LPCWSTR  attributeValue,
HTMLayoutElementCallback callback,
LPVOID  param,
DWORD  depth 
)

Call specified function for every element in a DOM that meets specified criteria.

Parameters:
[in] he HELEMENT
[in] tagName LPCSTR, comma separated list of tag names to search, e.g. "div", "p", "div,p" etc. Can be NULL.
[in] attributeName LPCSTR, name of attribute, can contain wildcard characters, see below. Can be NULL.
[in] attributeValue LPCWSTR, value of attribute, can contain wildcard characters, see below. Can be NULL.
[in] callback HTMLayoutElementCallback*, address of callback function being called on each element found.
[in] param LPVOID, additional parameter to be passed to callback function.
[in] depth DWORD, depth - depth of search. 0 means all descendants, 1 - direct children only, 2 - children and their children and so on.
Returns:
HLDOM_RESULT
Wildcard characters in attributeName and attributeValue:

Example:
  • [a-z] - all lowercase letters
  • [a-zA-Z] - all letters
  • [abd-z] - all lowercase letters except of 'c'
  • [-a-z] - all lowercase letters and '-'

EXTERN_C HLDOM_RESULT HLAPI HTMLayoutWindowAttachEventHandler ( HWND  hwndLayout,
LPELEMENT_EVENT_PROC  pep,
LPVOID  tag,
UINT  subscription 
)

Attach/Detach ElementEventProc to the htmlayout window.

All events will start first here (in SINKING phase) and if not consumed will end up here. You can install Window EventHandler only once - it will survive all document reloads.


Generated on Fri May 18 22:05:12 2007 for HTMLayout by  doxygen 1.5.1-p1