[][src]Trait sciter::host::HostHandler

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

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

pub fn on_data_load(&mut self, pnm: &mut SCN_LOAD_DATA) -> Option<LOAD_RESULT>[src]

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).

pub fn on_data_loaded(&mut self, pnm: &SCN_DATA_LOADED)[src]

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

pub fn on_attach_behavior(&mut self, pnm: &mut SCN_ATTACH_BEHAVIOR) -> bool[src]

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

pub fn on_engine_destroyed(&mut self)[src]

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

pub fn on_graphics_critical_failure(&mut self)[src]

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

pub fn on_invalidate(&mut self, pnm: &SCN_INVALIDATE_RECT)[src]

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

pub fn on_debug_output(
    &mut self,
    subsystem: OUTPUT_SUBSYTEMS,
    severity: OUTPUT_SEVERITY,
    message: &str
)
[src]

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

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

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.

pub fn attach_behavior<Handler: EventHandler>(
    &self,
    pnm: &mut SCN_ATTACH_BEHAVIOR,
    handler: Handler
)
[src]

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

Loading content...

Implementors

Loading content...