HSMILE engine. Integration schema.
 
 
 
HSMILE engine. Inbound interface.
struct hsmile::view
{
 HSMILE  hs;
 view(HSMILE hsmile = 0): hs(hsmile) {}
// methods
 
   void  create(dword tag);
   void  destroy();
   // load html from memory buffer
   bool  load_html( const byte* text, dword text_length, const wchar* source_url);
   // load html from url
   bool  load_url( const wchar* url_to_load);
   bool  discard_loading();
 
   dword get_tag();
 
   bool  data_arrived( const wchar* requested_url, const wchar* act_url,
         const byte* data, dword data_size, dword data_type_requested);
// GUI event relays
   bool  on_mouse( dword event_type, point pt,
                  dword mouse_buttons, dword keyboard_states);
   bool  on_key( dword event_type, dword code, dword keyboard_states );
   bool  on_focus( dword event_type );
   bool  on_paint( HDC hdc, rect rc );
   bool  on_size( size sz );
   bool  on_move( point screen_view_pos );
   bool  on_timer( dword timer_id );
// scripting methods
   bool  start_scripts( csmile_host* pcsh, dword features, bool only_if_needed );
   bool  load_script( const byte* text, dword text_length, const char* name );
   bool  define_function( const char* name );
   bool  eval( const byte* text, dword text_length );
   value call( const char* function_name, value *argv, unsigned int argn );
}
 
HSMILE engine outbound interface.
Methods implemented by the host.
HTML rendering and UI state notifications interface:
struct hsmile::host: public HSMILE_HOST_CALLBACK
{
// host's chance to load data for the engine
 virtual bool cb_load_data(const wchar* url, dword data_type) = 0;
// host's chance to store received data
 virtual void cb_data_loaded(const wchar* url, const byte* data,
             dword data_size, dword data_type) = 0;
 virtual bool cb_start_timer(dword timer_id, dword millis) = 0;
 virtual bool cb_stop_timer(dword timer_id) = 0;
 virtual bool cb_refresh_area(rect rc) = 0;
 virtual bool cb_scroll_area(rect rc, size delta) = 0;
 virtual bool cb_request_capture(bool onoff) = 0;
 virtual bool cb_request_focus() = 0;
 virtual bool cb_document_complete() = 0;
 virtual bool cb_set_cursor(dword cursor_type) = 0;
 virtual bool cb_element_notification( dword notification_code , HELEMENT he) = 0;
}
Scripting engine notifications interface:
struct csmile::host: public CSMILE_HOST_CALLBACK
{
 // implementation of scripting stdin, stdout and stderr
 virtual bool  cb_stdin_getc(wchar& c) = 0;
 virtual bool  cb_stdout_putc(wchar c) = 0;
 virtual bool  cb_stderr_putc(wchar c) = 0;
 // call of user defined function from script
 virtual value cb_function_call(const char* name,
         const value *argv, unsigned int argn) = 0;
}