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

pub trait HostHandler {
    fn on_data_load(&mut self, pnm: &mut SCN_LOAD_DATA) -> 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_debug_output(&mut self,
                       subsystem: OUTPUT_SUBSYTEMS,
                       severity: OUTPUT_SEVERITY,
                       message: &str) { ... } fn data_ready(&mut self,
                  hwnd: HWINDOW,
                  uri: &str,
                  data: &[u8],
                  request_id: Option<*mut _HREQUEST>) { ... } }

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 on_data_load(SCN_LOAD_DATA) notification to your application using callback handler registered with sciter::Window.sciter_handler() function.

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

Note: This handler should be registere before any load_html call in order to send notifications while loading.

Provided Methods

Notifies that Sciter is about to download a 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 request (data will not be loaded at document) or take care about this request completely (via 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 style.behavior 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 output function will be used for reprting 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_RESULT::LOAD_DELAYED code and provide an request_id here.

Implementors