Struct sciter::host::Host[][src]

pub struct Host { /* fields omitted */ }

Sciter host runtime support.

Implementations

impl Host[src]

pub fn attach(hwnd: HWINDOW) -> Host[src]

Attach Sciter host to an existing window.

Usually Sciter window is created by sciter::Window::create(), but you can attach Sciter to an existing native window. In this case you need to mix-in window events processing with SciterProcND (Windows only). Sciter engine will be initialized either on WM_CREATE or WM_INITDIALOG response or by calling SciterCreateOnDirectXWindow (again, Windows only).

pub fn attach_with<Handler: HostHandler>(
    hwnd: HWINDOW,
    handler: Handler
) -> Host
[src]

Attach Sciter host to an existing window with the given Host handler.

pub fn event_handler<Handler: EventHandler>(&self, handler: Handler)[src]

Attach dom::EventHandler to the Sciter window.

pub fn register_behavior<Factory>(&self, name: &str, factory: Factory) where
    Factory: Fn() -> Box<dyn EventHandler> + 'static, 
[src]

Register a native event handler for the specified behavior name.

See the Window::register_behavior for an example.

pub fn register_archive(&self, resource: &[u8]) -> Result<()>[src]

Register an archive produced by packfolder.

See documentation of the Archive.

pub fn enable_debug(&self, enable: bool)[src]

Set debug mode for this window.

pub fn get_hwnd(&self) -> HWINDOW[src]

Get native window handle.

pub fn get_root(&self) -> Option<Element>[src]

Get window root DOM element.

pub fn load_file(&self, uri: &str) -> bool[src]

Load an HTML document from file.

pub fn load_html(&self, html: &[u8], uri: Option<&str>) -> bool[src]

Load an HTML document from memory.

pub fn data_ready(&self, uri: &str, data: &[u8])[src]

This function is used as response to HostHandler::on_data_load request.

pub fn data_ready_async(
    &self,
    uri: &str,
    data: &[u8],
    request_id: Option<HREQUEST>
)
[src]

Use this function outside of HostHandler::on_data_load request.

It can be used for two purposes:

  1. Asynchronious resource loading in respect of on_data_load requests (you must use request_id in this case).
  2. Refresh of an already loaded resource (for example, dynamic image updates).

pub fn eval_script(&self, script: &str) -> Result<Value, Value>[src]

Evaluate the given script in context of the current document.

This function returns Result<Value,Value> with script function result value or with Sciter script error.

pub fn call_function(&self, name: &str, args: &[Value]) -> Result<Value, Value>[src]

Call a script function defined in the global namespace.

This function returns Result<Value,Value> with script function result value or with Sciter script error.

You can use the &make_args!(args...) macro which helps you to construct script arguments from Rust types.

pub fn set_home_url(&self, url: &str) -> Result<()>[src]

Set home url for Sciter resources.

If you set it like set_home_url("https://sciter.com/modules/") then

<script src="sciter:lib/root-extender.tis"> will load root-extender.tis from

https://sciter.com/modules/lib/root-extender.tis.

pub fn set_media_type(&self, media_type: &str) -> Result<()>[src]

Set media type of this Sciter instance.

For example, media type can be “handheld”, “projection”, “screen”, “screen-hires”, etc. By default, Sciter window has the "screen" media type.

Media type name is used while loading and parsing style sheets in the engine, so you should call this function before loading document in it.

pub fn set_media_vars(&self, media: &Value) -> Result<()>[src]

Set media variables (dictionary) for this Sciter instance.

By default Sciter window has "screen:true" and "desktop:true"/"handheld:true" media variables.

Media variables can be changed in runtime. This will cause styles of the document to be reset.

Example

host.set_media_vars( &vmap! {
  "screen" => true,
  "handheld" => true,
}).unwrap();

pub fn set_master_css(&self, css: &str, append: bool) -> Result<()>[src]

Set or append the master style sheet styles (globally, for all windows).

pub fn set_window_css(
    &self,
    css: &str,
    base_url: &str,
    media_type: &str
) -> Result<()>
[src]

Set (reset) style sheet of the current document.

Will reset styles for all elements according to given CSS.

Auto Trait Implementations

impl !RefUnwindSafe for Host

impl !Send for Host

impl !Sync for Host

impl Unpin for Host

impl !UnwindSafe for Host

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.