Struct sciter::host::Host
[−]
[src]
pub struct Host { /* fields omitted */ }
Sciter host runtime support.
Methods
impl Host
[src]
fn attach(hwnd: HWINDOW) -> Host
Attach Sciter host to existing window.
Usually Sciter window created by sciter::Window::create()
, but you can attach Sciter to the existing native window.
In this case you need to mix-in window events processing with SciterProcND
.
Sciter engine will be initialized either on WM_CREATE
or WM_INITDIALOG
response
or by calling SciterCreateOnDirectXWindow
.
fn setup_callback<T: HostHandler>(&self, hwnd: HWINDOW, handler: T)
Set callback for Sciter engine events.
fn attach_handler<T: EventHandler>(&self, handler: T)
Attach dom::EventHandler
to the Sciter window.
fn enable_debug(&self, enable: bool)
Set debug mode for specific window or globally.
fn get_hwnd(&self) -> HWINDOW
Get native window handle.
fn get_root(&self) -> Option<Element>
Get window root DOM element.
fn load_file(&self, uri: &str)
Load HTML document from file.
fn load_html(&self, html: &[u8], uri: Option<&str>)
Load HTML document from memory.
fn data_ready(&self, uri: &str, data: &[u8])
This function is used as response to SC_LOAD_DATA
request.
fn data_ready_async(
&self,
uri: &str,
data: &[u8],
request_id: Option<*mut _HREQUEST>
)
&self,
uri: &str,
data: &[u8],
request_id: Option<*mut _HREQUEST>
)
Use this function outside of SCN_LOAD_DATA
request.
It can be used for the two purposes:
- Asynchronious resource loading in respect of
SCN_LOAD_DATA
requests (you must providerequest_id
in this case). - Refresh of already loaded resource (for example, dynamic image updates).
fn eval_script(&self, script: &str) -> Result<Value, Value>
Evaluate script in context of current document.
fn call_function(&self, name: &str, args: &[Value]) -> Result<Value, Value>
Call scripting 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!(a,b,c)
macro which help you construct script arguments from Rust types.
fn set_option(&self, option: SCITER_RT_OPTIONS, value: usize) -> Result<()>
Set various sciter engine options, see the SCITER_RT_OPTIONS
.
fn set_home_url(&self, url: &str) -> Result<()>
Set home url for sciter resources.
If you will set it like set_home_url("http://sciter.com/modules/")
then
<script src="sciter:lib/root-extender.tis">
will load
root-extender.tis from
http://sciter.com/modules/lib/root-extender.tis
.
fn set_media_type(&self, media_type: &str) -> Result<()>
Set media type of this sciter instance.
fn set_media_vars(&self, media: Value) -> Result<()>
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.
fn set_master_css(&self, css: &str, append: bool) -> Result<()>
Set or append the master style sheet styles (globally).
fn set_window_css(
&self,
css: &str,
base_url: &str,
media_type: &str
) -> Result<()>
&self,
css: &str,
base_url: &str,
media_type: &str
) -> Result<()>
Set (reset) style sheet of current document.