#include <htmlayout_dom.hpp>
Public Member Functions | |
| element () | |
Construct undefined element . | |
| element (HELEMENT h) | |
Construct element from existing element handle. | |
| element (const element &e) | |
| Copy constructor;. | |
| ~element () | |
| Destructor. | |
| element & | operator= (HELEMENT h) |
Assign element an HELEMENT. | |
| element & | operator= (const element &e) |
Assign element another element. | |
| bool | operator== (const element &rs) const |
Test equality of this and another element's. | |
| bool | operator!= (const element &rs) const |
Test equality of this and another element's. | |
| bool | is_valid () const |
| Test whether element is valid. | |
| unsigned int | children_count () const |
| Get number of child elements. | |
| HELEMENT | child (unsigned int index) const |
| Get Nth child element. | |
| HELEMENT | parent () const |
| Get parent element. | |
| unsigned int | index () const |
| Get index of this element in its parent collection. | |
| unsigned int | get_attribute_count () const |
| Get number of the attributes. | |
| const wchar_t * | get_attribute (unsigned int n) const |
| Get attribute value by its index. | |
| const char * | get_attribute_name (unsigned int n) const |
| Get attribute name by its index. | |
| const wchar_t * | get_attribute (const char *name) const |
| Get attribute value by name. | |
| void | set_attribute (const char *name, const wchar_t *value) |
| Add or replace attribute. | |
| int | get_attribute_int (const char *name, int def_val=0) const |
| Get attribute integer value by name. | |
| void | remove_attribute (const char *name) |
| Remove attribute. | |
| const wchar_t * | get_style_attribute (const char *name) const |
| Get style attribute of the element by its name. | |
| void | set_style_attribute (const char *name, const wchar_t *value) const |
| Set style attribute. | |
| void | set_capture () |
| Set mouse capture. | |
| void | select (callback *pcall, const char *tag_name=0, const char *attr_name=0, const wchar_t *attr_value=0, int depth=0) const |
| Enumerate all descendant elements. | |
| HELEMENT | get_element_by_id (const char *id) const |
| Get element by id. | |
| void | update (bool render_now=false) const |
| Apply changes and refresh element area in its window. | |
| void | update (int mode) const |
| Apply changes and refresh element area in its window. | |
| HELEMENT | next_sibling () const |
| Get next sibling element. | |
| HELEMENT | prev_sibling () const |
| Get previous sibling element. | |
| HELEMENT | first_sibling () const |
| Get first sibling element. | |
| HELEMENT | last_sibling () const |
| Get last sibling element. | |
| HELEMENT | root () const |
| Get root of the element. | |
| RECT | get_location (unsigned int area=ROOT_RELATIVE|CONTENT_BOX) const |
| Get bounding rectangle of the element. | |
| bool | is_inside (POINT client_pt) const |
| Test if point is inside shape rectangle of the element. | |
| void | scroll_to_view (bool toTopOfView=false) |
| Scroll this element to view. | |
| const char * | get_element_type () const |
| Get element's type. | |
| HWND | get_element_hwnd (bool root_window) |
| Get HWND of containing window. | |
| UINT | get_element_uid () |
| Get element UID - identifier suitable for storage. | |
| void | combine_url (LPWSTR inOutURL, UINT bufferSize) |
| Combine given URL with URL of the document element belongs to. | |
| void | set_html (const unsigned char *html, size_t html_length, int where=SIH_REPLACE_CONTENT) |
| Set inner or outer html of the element. | |
| void | destroy () |
| Delete element. | |
| unsigned int | get_state () const |
| Get UI state bits of the element as set of ELEMENT_STATE_BITS. | |
| bool | get_state (unsigned int bits) const |
| Checks if particular UI state bits are set in the element. | |
| void | set_state (unsigned int bitsToSet, unsigned int bitsToClear=0, bool update=true) |
| Set UI state of the element with optional view update. | |
| bool | enabled () |
| "deeply enabled" | |
| bool | visible () |
| "deeply visible" | |
| element | clone () |
| create brand new copy of this element. | |
| void | insert (const element &e, unsigned int index) |
| Insert element e at index position of this element. | |
| void | append (const element &e) |
| Append element e as last child of this element. | |
| void | detach () |
| detach - remove this element from its parent | |
| bool | send_event (unsigned int event_code, UINT_PTR reason=0, HELEMENT heSource=0) |
| traverse event - send it by sinking/bubbling on the parent/child chain of this element | |
| void | post_event (unsigned int event_code, unsigned int reason=0, HELEMENT heSource=0) |
| post event - post it in the queue for later sinking/bubbling on the parent/child chain of this element. | |
| void | attach (event_handler *pevth) |
| attach event handler to the element | |
| void | detach (event_handler *pevth) |
| remove event handler from the list of event handlers of the element. | |
| bool | call_behavior_method (METHOD_PARAMS *p) |
| call method, invokes method in all event handlers attached to the element | |
| void | sort (comparator &cmp, int start=0, int end=-1) |
| reorders children of the element using sorting order defined by cmp | |
Static Public Member Functions | |
| static HELEMENT | root_element (HWND hHTMLayoutWnd) |
| Get root DOM element of the HTMLayout document. | |
| static HELEMENT | focus_element (HWND hHTMLayoutWnd) |
| Get focus DOM element of the HTMLayout document. | |
| static HELEMENT | find_element (HWND hHTMLayoutWnd, POINT clientPt) |
| Find DOM element of the HTMLayout document by coordinates. | |
| static void | release_capture () |
| Release mouse capture. | |
| static HELEMENT | element_by_uid (HWND hHTMLayoutWnd, UINT uid) |
| Get element handle by its UID. | |
| static element | create (const char *tagname, const wchar_t *text=0) |
| create brand new element with text (optional). | |
| htmlayout::dom::element::element | ( | HELEMENT | h | ) | [inline] |
| htmlayout::dom::element::element | ( | const element & | e | ) | [inline] |
| htmlayout::dom::element::~element | ( | ) | [inline] |
Destructor.
| bool htmlayout::dom::element::operator== | ( | const element & | rs | ) | const [inline] |
| bool htmlayout::dom::element::operator!= | ( | const element & | rs | ) | const [inline] |
| bool htmlayout::dom::element::is_valid | ( | ) | const [inline] |
Test whether element is valid.
| unsigned int htmlayout::dom::element::children_count | ( | ) | const [inline] |
Get number of child elements.
| HELEMENT htmlayout::dom::element::child | ( | unsigned int | index | ) | const [inline] |
Get Nth child element.
| index | unsigned int, number of the child element |
| HELEMENT htmlayout::dom::element::parent | ( | ) | const [inline] |
| unsigned int htmlayout::dom::element::index | ( | ) | const [inline] |
Get index of this element in its parent collection.
| unsigned int htmlayout::dom::element::get_attribute_count | ( | ) | const [inline] |
Get number of the attributes.
| const wchar_t* htmlayout::dom::element::get_attribute | ( | unsigned int | n | ) | const [inline] |
Get attribute value by its index.
| n | unsigned int, number of the attribute |
| const char* htmlayout::dom::element::get_attribute_name | ( | unsigned int | n | ) | const [inline] |
Get attribute name by its index.
| n | unsigned int, number of the attribute |
| const wchar_t* htmlayout::dom::element::get_attribute | ( | const char * | name | ) | const [inline] |
Get attribute value by name.
| name | const char*, name of the attribute |
| void htmlayout::dom::element::set_attribute | ( | const char * | name, | |
| const wchar_t * | value | |||
| ) | [inline] |
Add or replace attribute.
| name | const char*, name of the attribute | |
| value | const wchar_t*, name of the attribute |
| int htmlayout::dom::element::get_attribute_int | ( | const char * | name, | |
| int | def_val = 0 | |||
| ) | const [inline] |
Get attribute integer value by name.
| name | const char*, name of the attribute |
| void htmlayout::dom::element::remove_attribute | ( | const char * | name | ) | [inline] |
Remove attribute.
| name | const char*, name of the attribute |
| const wchar_t* htmlayout::dom::element::get_style_attribute | ( | const char * | name | ) | const [inline] |
Get style attribute of the element by its name.
| name | const char*, name of the style attribute, e.g. "background-color" |
| void htmlayout::dom::element::set_style_attribute | ( | const char * | name, | |
| const wchar_t * | value | |||
| ) | const [inline] |
Set style attribute.
| name | const char*, name of the style attribute | |
| value | const wchar_t*, value of the style attribute |
e.set_style_attribute("background-color", L"red");
| static HELEMENT htmlayout::dom::element::root_element | ( | HWND | hHTMLayoutWnd | ) | [inline, static] |
| static HELEMENT htmlayout::dom::element::focus_element | ( | HWND | hHTMLayoutWnd | ) | [inline, static] |
Get focus DOM element of the HTMLayout document.
| hHTMLayoutWnd | HWND, HTMLayout window |
| static HELEMENT htmlayout::dom::element::find_element | ( | HWND | hHTMLayoutWnd, | |
| POINT | clientPt | |||
| ) | [inline, static] |
Find DOM element of the HTMLayout document by coordinates.
| hHTMLayoutWnd | HWND, HTMLayout window | |
| clientPt | POINT, coordinates. |
| void htmlayout::dom::element::set_capture | ( | ) | [inline] |
Set mouse capture.
After call to this function all mouse events will be targeted to this element. To remove mouse capture call htmlayout::dom::element::release_capture().
| static void htmlayout::dom::element::release_capture | ( | ) | [inline, static] |
Release mouse capture.
Mouse capture can be set with element:set_capture()
| void htmlayout::dom::element::select | ( | callback * | pcall, | |
| const char * | tag_name = 0, |
|||
| const char * | attr_name = 0, |
|||
| const wchar_t * | attr_value = 0, |
|||
| int | depth = 0 | |||
| ) | const [inline] |
Enumerate all descendant elements.
| pcall | htmlayout::dom::callback*, callback structure. Its member function htmlayout::dom::callback::on_element() is called for every enumerated element. | |
| tag_name | const char*, comma separated list of tag names to search, e.g. "div", "p", "div,p" etc. Can be NULL. | |
| attr_name | const char*, name of attribute, can contain wildcard characters, see below. Can be NULL. | |
| attr_value | const char*, name of attribute, can contain wildcard characters, see below. Can be NULL. | |
| depth | int, depth - depth of search. 0 means all descendants, 1 - direct children only, 2 - children and their children and so on. |
document.select(mycallback, "a", "href", "http:*.php");
document.select(mycallback);
| HELEMENT htmlayout::dom::element::get_element_by_id | ( | const char * | id | ) | const [inline] |
Get element by id.
| id | char*, value of the "id" attribute. |
| void htmlayout::dom::element::update | ( | bool | render_now = false |
) | const [inline] |
Apply changes and refresh element area in its window.
| [in] | render_now | bool, if true element will be redrawn immediately. |
| void htmlayout::dom::element::update | ( | int | mode | ) | const [inline] |
Apply changes and refresh element area in its window.
| [in] | render_now | bool, if true element will be redrawn immediately. |
| HELEMENT htmlayout::dom::element::next_sibling | ( | ) | const [inline] |
Get next sibling element.
| HELEMENT htmlayout::dom::element::prev_sibling | ( | ) | const [inline] |
Get previous sibling element.
| HELEMENT htmlayout::dom::element::first_sibling | ( | ) | const [inline] |
Get first sibling element.
| HELEMENT htmlayout::dom::element::last_sibling | ( | ) | const [inline] |
Get last sibling element.
| HELEMENT htmlayout::dom::element::root | ( | ) | const [inline] |
| RECT htmlayout::dom::element::get_location | ( | unsigned int | area = ROOT_RELATIVE | CONTENT_BOX |
) | const [inline] |
Get bounding rectangle of the element.
| root_relative | bool, if true function returns location of the element relative to HTMLayout window, otherwise the location is given relative to first scrollable container. |
| bool htmlayout::dom::element::is_inside | ( | POINT | client_pt | ) | const [inline] |
Test if point is inside shape rectangle of the element.
client_pt - client rect relative point
| const char* htmlayout::dom::element::get_element_type | ( | ) | const [inline] |
Get element's type.
| HWND htmlayout::dom::element::get_element_hwnd | ( | bool | root_window | ) | [inline] |
Get HWND of containing window.
| root_window | bool, handle of which window to get:
|
| UINT htmlayout::dom::element::get_element_uid | ( | ) | [inline] |
Get element UID - identifier suitable for storage.
| static HELEMENT htmlayout::dom::element::element_by_uid | ( | HWND | hHTMLayoutWnd, | |
| UINT | uid | |||
| ) | [inline, static] |
Get element handle by its UID.
| hHTMLayoutWnd | HWND, HTMLayout window | |
| uid | UINT, uid of the element |
| void htmlayout::dom::element::combine_url | ( | LPWSTR | inOutURL, | |
| UINT | bufferSize | |||
| ) | [inline] |
Combine given URL with URL of the document element belongs to.
| [in,out] | inOutURL | LPWSTR, at input this buffer contains zero-terminated URL to be combined, after function call it contains zero-terminated combined URL |
| bufferSize | UINT, size of the buffer pointed by inOutURL |
| void htmlayout::dom::element::set_html | ( | const unsigned char * | html, | |
| size_t | html_length, | |||
| int | where = SIH_REPLACE_CONTENT | |||
| ) | [inline] |
Set inner or outer html of the element.
| html | const unsigned char*, UTF-8 encoded string containing html text | |
| html_length | size_t, length in bytes of html | |
| where | int, possible values are:
|
| void htmlayout::dom::element::destroy | ( | ) | [inline] |
Delete element.
This function removes element from the DOM tree and then deletes it.
| static element htmlayout::dom::element::create | ( | const char * | tagname, | |
| const wchar_t * | text = 0 | |||
| ) | [inline, static] |
create brand new element with text (optional).
Example: element div = element::create("div");
| element htmlayout::dom::element::clone | ( | ) | [inline] |
create brand new copy of this element.
Element will be created disconected. You need to call insert to inject it in some container. Example: element select = ...; element option1 = ...; element option2 = option1.clone(); select.insert(option2, option1.index() + 1);
| void htmlayout::dom::element::post_event | ( | unsigned int | event_code, | |
| unsigned int | reason = 0, |
|||
| HELEMENT | heSource = 0 | |||
| ) | [inline] |
post event - post it in the queue for later sinking/bubbling on the parent/child chain of this element.
method returns immediately
1.5.1-p1