Struct sciter::dom::Element
[−]
[src]
pub struct Element { /* fields omitted */ }
DOM element wrapper. See the module-level documentation also.
Methods
impl Element
[src]
pub fn from(he: HELEMENT) -> Element
[src]
Construct Element object from HELEMENT handle.
pub fn create(tag: &str) -> Result<Element>
[src]
Create new element, it is disconnected initially from the DOM.
pub fn with_parent(tag: &str, parent: &mut Element) -> Result<Element>
[src]
Create new element as child of parent
.
pub fn create_at(tag: &str, parent: &mut Element) -> Result<Element>
[src]
: please use Element::with_parent()
instead.
Create new element as child of parent
. Deprecated.
pub fn with_text(tag: &str, text: &str) -> Result<Element>
[src]
Create new element with specified text
, it is disconnected initially from the DOM.
pub fn with_type(tag: &str, el_type: &str) -> Result<Element>
[src]
Create new element with specified type
, which is useful for controls and widgets (initially disconnected).
pub fn from_window(hwnd: HWINDOW) -> Result<Element>
[src]
Get root DOM element of the Sciter document.
pub fn from_focus(hwnd: HWINDOW) -> Result<Element>
[src]
Get focus DOM element of the Sciter document.
pub fn from_highlighted(hwnd: HWINDOW) -> Result<Element>
[src]
Get highlighted element.
pub fn from_point(hwnd: HWINDOW, pt: POINT) -> Result<Element>
[src]
Find DOM element of the Sciter document by coordinates.
pub fn from_uid(hwnd: HWINDOW, uid: u32) -> Result<Element>
[src]
Get element handle by its UID.
pub fn as_ptr(&self) -> HELEMENT
[src]
Access element pointer.
pub fn get_uid(&self) -> u32
[src]
Get element UID - identifier suitable for storage.
pub fn get_tag(&self) -> String
[src]
Return element tag as string (e.g. 'div', 'body').
pub fn get_text(&self) -> String
[src]
Get inner text of the element as string.
pub fn set_text(&mut self, text: &str) -> Result<()>
[src]
Set inner text of the element.
pub fn get_html(&self, with_outer_html: bool) -> Vec<u8>
[src]
Get html representation of the element as utf-8 bytes.
pub fn set_html(
&mut self,
html: &[u8],
how: Option<SET_ELEMENT_HTML>
) -> Result<()>
[src]
&mut self,
html: &[u8],
how: Option<SET_ELEMENT_HTML>
) -> Result<()>
Set inner or outer html of the element.
pub fn get_value(&self) -> Value
[src]
Get value of the element.
pub fn set_value<T: Into<Value>>(&mut self, val: T) -> Result<()>
[src]
Set value of the element.
pub fn get_hwnd(&self, for_root: bool) -> HWINDOW
[src]
Get HWINDOW
of containing window.
pub fn get_location(&self, kind: u32) -> Result<RECT>
[src]
Get bounding rectangle of the element. See the ELEMENT_AREAS
enum for kind
flags.
pub fn send_event(
&self,
code: BEHAVIOR_EVENTS,
reason: Option<CLICK_REASON>,
source: Option<HELEMENT>
) -> Result<bool>
[src]
&self,
code: BEHAVIOR_EVENTS,
reason: Option<CLICK_REASON>,
source: Option<HELEMENT>
) -> Result<bool>
Sends sinking/bubbling event to the child/parent chain of element.
pub fn post_event(
&self,
code: BEHAVIOR_EVENTS,
reason: Option<CLICK_REASON>,
source: Option<HELEMENT>
) -> Result<()>
[src]
&self,
code: BEHAVIOR_EVENTS,
reason: Option<CLICK_REASON>,
source: Option<HELEMENT>
) -> Result<()>
Post asynchronously a sinking/bubbling event to the child/parent chain of element.
pub fn fire_event(
&self,
code: BEHAVIOR_EVENTS,
reason: Option<CLICK_REASON>,
source: Option<HELEMENT>,
post: bool,
data: Option<Value>
) -> Result<bool>
[src]
&self,
code: BEHAVIOR_EVENTS,
reason: Option<CLICK_REASON>,
source: Option<HELEMENT>,
post: bool,
data: Option<Value>
) -> Result<bool>
Send or posts event to the child/parent chain of element.
pub fn fire_event_params(
evt: &BEHAVIOR_EVENT_PARAMS,
post: bool
) -> Result<bool>
[src]
evt: &BEHAVIOR_EVENT_PARAMS,
post: bool
) -> Result<bool>
Send or posts event with specified params to the child/parent chain of element.
pub fn eval_script(&self, script: &str) -> Result<Value>
[src]
Evaluate the given script in context of the element.
pub fn call_function(&self, name: &str, args: &[Value]) -> Result<Value>
[src]
Call scripting function defined in the namespace of the element (a.k.a. global function).
You can use the make_args!(args...)
macro which helps you
to construct script arguments from Rust types.
pub fn call_method(&self, name: &str, args: &[Value]) -> Result<Value>
[src]
Call scripting method defined for the element.
You can use the make_args!(args...)
macro which helps you
to construct script arguments from Rust types.
pub fn attribute_count(&self) -> usize
[src]
Get number of the attributes.
pub fn attribute_name(&self, index: usize) -> String
[src]
Get attribute name by its index.
pub fn attribute(&self, index: usize) -> String
[src]
Get attribute value by its index.
pub fn get_attribute(&self, name: &str) -> Option<String>
[src]
Get attribute value by its name.
pub fn set_attribute(&mut self, name: &str, value: &str) -> Result<()>
[src]
Add or replace attribute.
pub fn remove_attribute(&mut self, name: &str) -> Result<()>
[src]
Remove attribute.
pub fn toggle_attribute(
&mut self,
name: &str,
isset: bool,
value: Option<&str>
) -> Result<()>
[src]
&mut self,
name: &str,
isset: bool,
value: Option<&str>
) -> Result<()>
Toggle attribute.
pub fn clear_attributes(&mut self) -> Result<()>
[src]
Remove all attributes from the element.
pub fn get_style_attribute(&self, name: &str) -> String
[src]
Get style attribute of the element by its name.
pub fn set_style_attribute(&mut self, name: &str, value: &str) -> Result<()>
[src]
Set style attribute.
pub fn index(&self) -> usize
[src]
Get index of this element in its parent collection.
pub fn root(&self) -> Element
[src]
Get root of the element.
pub fn parent(&self) -> Option<Element>
[src]
Get parent element.
pub fn first_sibling(&self) -> Option<Element>
[src]
Get first sibling element.
pub fn last_sibling(&self) -> Option<Element>
[src]
Get last sibling element.
pub fn next_sibling(&self) -> Option<Element>
[src]
Get next sibling element.
pub fn prev_sibling(&self) -> Option<Element>
[src]
Get previous sibling element.
pub fn first_child(&self) -> Option<Element>
[src]
Get first child element.
pub fn last_child(&self) -> Option<Element>
[src]
Get last child element.
pub fn get(&self, index: usize) -> Option<Element>
[src]
Get element's child at specified index.
ⓘImportant traits for Children<'a>pub fn children(&self) -> Children
[src]
An iterator over the direct children of a DOM element.
pub fn child(&self, index: usize) -> Option<Element>
[src]
Get element's child at specified index.
pub fn children_count(&self) -> usize
[src]
Get number of child elements.
pub fn len(&self) -> usize
[src]
Get number of child elements.
pub fn is_empty(&self) -> bool
[src]
Returns true
is self
has zero elements.
pub fn clear(&mut self) -> Result<()>
[src]
Clear content of the element.
pub fn clone_element(&self) -> Element
[src]
Create new element as copy of existing element.
The new element is a full (deep) copy of the element and is initially disconnected from the DOM.
Note that Element.clone()
does not clone DOM element, just increments its reference count.
pub fn insert(&mut self, index: usize, child: &Element) -> Result<()>
[src]
Insert element at index
position of this element.
Note that we cannot follow Rust semantic here
because the newly created Element
is unusable before it will be inserted at DOM.
pub fn append(&mut self, child: &Element) -> Result<()>
[src]
Append element as last child of this element.
pub fn push(&mut self, element: Element)
[src]
Append element as last child of this element.
pub fn pop(&mut self) -> Option<Element>
[src]
Remove the last child from this element and returns it, or None
if this element is empty.
pub fn detach(&mut self) -> Result<()>
[src]
Take element out of its container (and DOM tree).
pub fn destroy(&mut self) -> Result<()>
[src]
Take element out of its container (and DOM tree) and force destruction of all behaviors.
pub fn swap(&mut self, other: &mut Element) -> Result<()>
[src]
Swap element positions.
pub fn test(&self, selector: &str) -> bool
[src]
Test this element against CSS selector(s).
pub fn find_nearest_parent(&self, selector: &str) -> Result<Option<Element>>
[src]
Will find first parent element starting from this satisfying given css selector(s).
pub fn find_first(&self, selector: &str) -> Result<Option<Element>>
[src]
Will find first element starting from this satisfying given css selector(s).
pub fn find_all(&self, selector: &str) -> Result<Option<Vec<Element>>>
[src]
Will find all elements starting from this satisfying given css selector(s).
pub fn update(&self, render_now: bool) -> Result<()>
[src]
Apply changes and refresh element area in its window.
pub fn start_timer(&self, period_ms: u32, timer_id: u64) -> Result<()>
[src]
Start Timer for the element. Element will receive on_timer
event.
Note that timer events are not bubbling, so you need attach handler to the target element directly.
pub fn stop_timer(&self, timer_id: u64) -> Result<()>
[src]
Stop Timer for the element.
pub fn attach_handler<Handler: EventHandler>(
&mut self,
handler: Handler
) -> Result<u64>
[src]
&mut self,
handler: Handler
) -> Result<u64>
Attach the native event handler to this element.
pub fn detach_handler<Handler: EventHandler>(
&mut self,
token: u64
) -> Result<()>
[src]
&mut self,
token: u64
) -> Result<()>
Detach your handler from the element. Handlers identified by token
from attach_handler()
result.
Trait Implementations
impl PartialEq for Element
[src]
fn eq(&self, __arg_0: &Element) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Element) -> bool
[src]
This method tests for !=
.
impl Send for Element
[src]
sciter::Element
can be transferred across thread boundaries.
impl Sync for Element
[src]
It is safe to share sciter::Element
between threads - underlaying API is thread-safe.
impl Drop for Element
[src]
Release element pointer.
impl Clone for Element
[src]
Increment reference count of the dom element.
fn clone(&self) -> Self
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Display for Element
[src]
Human element representation.
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Debug for Element
[src]
Machine-like element visualization.
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<'a> IntoIterator for &'a Element
[src]
Allows for child in &el {}
enumeration.