[−][src]Struct sciter::dom::Element
DOM element wrapper. See the module-level documentation also.
Implementations
impl Element
[src]
pub fn create(tag: &str) -> Result<Element>
[src]
Create a 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_state(&self) -> ELEMENT_STATE_BITS
[src]
Checks if particular UI state bits are set in the element.
pub fn set_state(
&mut self,
set: ELEMENT_STATE_BITS,
clear: Option<ELEMENT_STATE_BITS>,
update: bool
) -> Result<()>
[src]
&mut self,
set: ELEMENT_STATE_BITS,
clear: Option<ELEMENT_STATE_BITS>,
update: bool
) -> Result<()>
Set UI state of the element with optional view update.
pub fn get_hwnd(&self, for_root: bool) -> HWINDOW
[src]
Get HWINDOW
of containing window.
pub fn attach_hwnd(&mut self, child: HWINDOW) -> Result<()>
[src]
Attach a native window to the element as a child.
pub fn detach_hwnd(&mut self) -> Result<()>
[src]
Detach a child native window (if any) from the element.
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 request_data(
&self,
url: &str,
data_type: RESOURCE_TYPE,
initiator: Option<HELEMENT>
) -> Result<()>
[src]
&self,
url: &str,
data_type: RESOURCE_TYPE,
initiator: Option<HELEMENT>
) -> Result<()>
Request data download for this element.
pub fn request_html(&self, url: &str, initiator: Option<HELEMENT>) -> Result<()>
[src]
Request HTML data download for this element.
pub fn send_get_request(&self, url: &str) -> Result<()>
[src]
Send an asynchronous HTTP GET request for the element.
The contents of this element is replaced with the HTTP response (in text or html form).
pub fn send_request(
&self,
url: &str,
params: Option<&[(&str, &str)]>,
method: Option<REQUEST_TYPE>,
data_type: Option<RESOURCE_TYPE>
) -> Result<()>
[src]
&self,
url: &str,
params: Option<&[(&str, &str)]>,
method: Option<REQUEST_TYPE>,
data_type: Option<RESOURCE_TYPE>
) -> Result<()>
Send an HTTP GET or POST request for the element.
GET params (if any) are appended to the url to form the request.
HTTP POST params are serialized as Content-Type: application/x-www-form-urlencoded;charset=utf-8;
.
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 the 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 the 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 the 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 the 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 call_behavior_method(&self, params: MethodParams<'_>) -> Result<()>
[src]
Call behavior specific method.
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.
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 the 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 refresh(&self) -> Result<()>
[src]
Refresh element area in its window.
If the element has drawing behavior attached it will receive on_draw
call after that.
pub fn start_timer(&self, period_ms: u32, timer_id: u64) -> Result<()>
[src]
Start Timer for the element.
Element will receive on_timer
events.
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 Clone for Element
[src]
Increment reference count of the dom element.
pub fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Element
[src]
Machine-like element visualization ({:?}
and {:#?}
).
impl Display for Element
[src]
Human element representation.
impl Drop for Element
[src]
Release element pointer.
impl From<*mut _HELEMENT> for Element
[src]
impl FromValue for Element
[src]
Get an Element
object contained in the Value
.
pub fn from_value(v: &Value) -> Option<Element>
[src]
impl<'a> IntoIterator for &'a Element
[src]
Allows for child in &el {}
enumeration.
type Item = Element
The type of the elements being iterated over.
type IntoIter = Children<'a>
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> Children<'a>ⓘ
[src]
impl PartialEq<Element> for Element
[src]
impl Send for Element
[src]
sciter::Element
can be transferred across thread boundaries.
impl StructuralPartialEq for Element
[src]
impl Sync for Element
[src]
It is safe to share sciter::Element
between threads - underlaying API is thread-safe.
impl TryFrom<Element> for Value
[src]
Store the DOM element as a Value
.
Since 4.4.3.26, perhaps.
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,