logo
pub trait HostHandler {
    fn on_data_load(&mut self, pnm: &mut SCN_LOAD_DATA) -> Option<LOAD_RESULT> { ... }
fn on_data_loaded(&mut self, pnm: &SCN_DATA_LOADED) { ... }
fn on_attach_behavior(&mut self, pnm: &mut SCN_ATTACH_BEHAVIOR) -> bool { ... }
fn on_engine_destroyed(&mut self) { ... }
fn on_graphics_critical_failure(&mut self) { ... }
fn on_invalidate(&mut self, pnm: &SCN_INVALIDATE_RECT) { ... }
fn on_debug_output(
        &mut self,
        subsystem: OUTPUT_SUBSYTEMS,
        severity: OUTPUT_SEVERITY,
        message: &str
    ) { ... }
fn data_ready(
        &self,
        hwnd: HWINDOW,
        uri: &str,
        data: &[u8],
        request_id: Option<HREQUEST>
    ) { ... }
fn attach_behavior<Handler: EventHandler>(
        &self,
        pnm: &mut SCN_ATTACH_BEHAVIOR,
        handler: Handler
    ) { ... } }
Expand description

Sciter notification handler for Window.sciter_handler().

Resource handling and custom resource loader

HTML loaded into Sciter may contain external resources: CSS (Cascading Style Sheets), images, fonts, cursors and scripts. To get any of such resources Sciter will first send a on_data_load(SCN_LOAD_DATA) notification to your application using the callback handler registered with sciter::Window.sciter_handler() function.

Your application can provide your own data for such resources (for example, from the resource section, database or other storage of your choice) or delegate the resource loading to the built-in HTTP client or file loader, or discard the loading at all.

Note: This handler should be registered before any load_html() or load_file() calls in order to send notifications while loading.

Provided methods

Notifies that Sciter is about to download the referred resource.

You can load or overload data immediately by calling self.data_ready() with parameters provided by SCN_LOAD_DATA, or save them (including request_id) for later usage and answer here with LOAD_RESULT::LOAD_DELAYED code.

Also you can discard the request (data will not be loaded at the document) or take care about this request completely by yourself (via the request API).

This notification indicates that external data (for example, image) download process completed.

This notification is sent on parsing the document and while processing elements having non empty behavior: style attribute value.

This notification is sent when instance of the engine is destroyed.

This notification is sent when the engine encounters critical rendering error: e.g. DirectX gfx driver error. Most probably bad gfx drivers.

This notification is sent when the engine needs some area to be redrawn.

This output function will be used for reporting problems found while loading html and css documents.

This function is used as response to on_data_load request.

Parameters here must be taken from SCN_LOAD_DATA structure. You can store them for later usage, but you must answer as LOAD_DELAYED code and provide an request_id here.

This function is used as a response to the on_attach_behavior request to attach a newly created behavior handler to the requested element.

Implementors