Struct sciter::dom::Element
[−]
[src]
pub struct Element { /* fields omitted */ }
DOM element wrapper. See the module-level documentation also.
Methods
impl Element
[src]
fn from(he: HELEMENT) -> Element
[src]
Construct Element object from HELEMENT handle.
fn create(tag: &str) -> Result<Element>
[src]
Create new element, it is disconnected initially from the DOM.
fn create_at(tag: &str, parent: &mut Element) -> Result<Element>
[src]
Create new element as child of parent
.
fn with_text(tag: &str, text: &str) -> Result<Element>
[src]
Create new element with specified text
, it is disconnected initially from the DOM.
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).
fn from_window(hwnd: HWINDOW) -> Result<Element>
[src]
Get root DOM element of the Sciter document.
fn from_focus(hwnd: HWINDOW) -> Result<Element>
[src]
Get focus DOM element of the Sciter document.
fn from_highlighted(hwnd: HWINDOW) -> Result<Element>
[src]
Get highlighted element.
fn from_point(hwnd: HWINDOW, pt: POINT) -> Result<Element>
[src]
Find DOM element of the Sciter document by coordinates.
fn from_uid(hwnd: HWINDOW, uid: u32) -> Result<Element>
[src]
Get element handle by its UID.
fn as_ptr(&self) -> HELEMENT
[src]
Access element pointer.
fn get_uid(&self) -> u32
[src]
Get element UID - identifier suitable for storage.
fn get_tag(&self) -> String
[src]
Return element tag as string (e.g. 'div', 'body').
fn get_text(&self) -> String
[src]
Get inner text of the element as string.
fn set_text(&mut self, text: &str) -> Result<()>
[src]
Set inner text of the element.
fn get_html(&self, with_outer_html: bool) -> Vec<u8>
[src]
Get html representation of the element as utf-8 bytes.
fn set_html(&mut self, html: &[u8], how: Option<SET_ELEMENT_HTML>) -> Result<()>
[src]
Set inner or outer html of the element.
fn get_value(&self) -> Value
[src]
Get value of the element.
fn set_value(&mut self, val: Value) -> Result<()>
[src]
Set value of the element.
fn get_hwnd(&self, for_root: bool) -> HWINDOW
[src]
Get HWINDOW of containing window.
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.
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.
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.
fn fire_event_params(evt: &BEHAVIOR_EVENT_PARAMS, post: bool) -> Result<bool>
[src]
Send or posts event with specified params to the child/parent chain of element.
fn eval_script(&self, script: &str) -> Result<Value>
[src]
Evaluate script in element context.
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!(a,b,c)
macro which help you construct script arguments from Rust types.
fn call_method(&self, name: &str, args: &[Value]) -> Result<Value>
[src]
Call scripting method defined for the element.
You can use the make_args!(a,b,c)
macro which help you construct script arguments from Rust types.
fn attribute_count(&self) -> usize
[src]
Get number of the attributes.
fn attribute_name(&self, index: usize) -> String
[src]
Get attribute name by its index.
fn attribute(&self, index: usize) -> String
[src]
Get attribute value by its index.
fn get_attribute(&self, name: &str) -> Option<String>
[src]
Get attribute value by its name.
fn set_attribute(&mut self, name: &str, value: &str) -> Result<()>
[src]
Add or replace attribute.
fn remove_attribute(&mut self, name: &str) -> Result<()>
[src]
Remove attribute.
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.
fn clear_attributes(&mut self) -> Result<()>
[src]
Remove all attributes from the element.
fn get_style_attribute(&self, name: &str) -> String
[src]
Get style attribute of the element by its name.
fn set_style_attribute(&mut self, name: &str, value: &str) -> Result<()>
[src]
Set style attribute.
fn index(&self) -> usize
[src]
Get index of this element in its parent collection.
fn root(&self) -> Element
[src]
Get root of the element.
fn parent(&self) -> Option<Element>
[src]
Get parent element.
fn first_sibling(&self) -> Option<Element>
[src]
Get first sibling element.
fn last_sibling(&self) -> Option<Element>
[src]
Get last sibling element.
fn next_sibling(&self) -> Option<Element>
[src]
Get next sibling element.
fn prev_sibling(&self) -> Option<Element>
[src]
Get previous sibling element.
fn first_child(&self) -> Option<Element>
[src]
Get first child element.
fn last_child(&self) -> Option<Element>
[src]
Get last child element.
fn get(&self, index: usize) -> Option<Element>
[src]
Get element child at specified index.
fn child(&self, index: usize) -> Option<Element>
[src]
Get element child at specified index.
fn children_count(&self) -> usize
[src]
Get number of child elements.
fn len(&self) -> usize
[src]
Get number of child elements.
fn is_empty(&self) -> bool
[src]
Returns true
is self
has zero elements.
fn clear(&mut self) -> Result<()>
[src]
Clear content of the element.
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.
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.
fn append(&mut self, child: &Element) -> Result<()>
[src]
Append element as last child of this element.
fn push(&mut self, element: Element)
[src]
Append element as last child of this element.
fn pop(&mut self) -> Option<Element>
[src]
Remove the last child from this element and returns it, or None
if this element is empty.
fn detach(&mut self) -> Result<()>
[src]
Take element out of its container (and DOM tree).
fn destroy(&mut self) -> Result<()>
[src]
Take element out of its container (and DOM tree) and force destruction of all behaviors.
fn swap(&mut self, other: &mut Element) -> Result<()>
[src]
Swap element positions.
fn test(&self, selector: &str) -> bool
[src]
Test this element against CSS selector(s).
fn find_nearest_parent(&self, selector: &str) -> Result<Option<Element>>
[src]
Will find first parent element starting from this satisfying given css selector(s).
fn find_first(&self, selector: &str) -> Result<Option<Element>>
[src]
Will find first element starting from this satisfying given css selector(s).
fn find_all(&self, selector: &str) -> Result<Option<Vec<Element>>>
[src]
Will find all elements starting from this satisfying given css selector(s).
fn update(&self, render_now: bool) -> Result<()>
[src]
Apply changes and refresh element area in its window.
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.
fn stop_timer(&self, timer_id: u64) -> Result<()>
[src]
Stop Timer for the element.
fn attach_handler<T: EventHandler>(&mut self, handler: T) -> Result<u64>
[src]
Attach the native event handler to this element.
fn detach_handler<T: EventHandler>(&mut self, token: u64) -> Result<()>
[src]
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.