diff --git a/README.md b/README.md index 60a1ccf..2cffb7d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Go bindings for Sciter -[![Build status](https://ci.appveyor.com/api/projects/status/rphv883klffw9em9/branch/master?svg=true)](https://ci.appveyor.com/project/pravic/go-sciter) -[![Build Status](https://img.shields.io/travis/sciter-sdk/go-sciter/master.svg)](https://travis-ci.org/sciter-sdk/go-sciter) +[![AppVeyor status](https://ci.appveyor.com/api/projects/status/rphv883klffw9em9/branch/master?svg=true)](https://ci.appveyor.com/project/pravic/go-sciter) +[![Travis Status](https://travis-ci.com/sciter-sdk/go-sciter.svg?branch=master)](https://travis-ci.com/sciter-sdk/go-sciter) [![License](https://img.shields.io/github/license/sciter-sdk/go-sciter.svg)](https://github.com/sciter-sdk/go-sciter) [![Join the forums at https://sciter.com/forums](https://img.shields.io/badge/forum-sciter.com-orange.svg)](https://sciter.com/forums) diff --git a/callbacks.c b/callbacks.c index 28aad0d..de6df5b 100644 --- a/callbacks.c +++ b/callbacks.c @@ -1,9 +1,9 @@ #include "sciter-x.h" #include "_cgo_export.h" -// typedef BOOL SC_CALLBACK SciterElementCallback(HELEMENT he, LPVOID param); +// typedef SBOOL SC_CALLBACK SciterElementCallback(HELEMENT he, LPVOID param); -BOOL SC_CALLBACK SciterElementCallback_cgo(HELEMENT he, LPVOID param) +SBOOL SC_CALLBACK SciterElementCallback_cgo(HELEMENT he, LPVOID param) { return goSciterElementCallback(he, param); } @@ -26,8 +26,8 @@ VOID SC_CALLBACK LPCSTR_RECEIVER_cgo(LPCSTR str, UINT str_length, LPVOID param) goLPCSTR_RECEIVER(str, str_length, param); } -// typedef BOOL SC_CALLBACK ElementEventProc(LPVOID tag, HELEMENT he, UINT evtg, LPVOID prms); -BOOL SC_CALLBACK ElementEventProc_cgo(LPVOID tag, HELEMENT he, UINT evtg, LPVOID prms) +// typedef SBOOL SC_CALLBACK ElementEventProc(LPVOID tag, HELEMENT he, UINT evtg, LPVOID prms); +SBOOL SC_CALLBACK ElementEventProc_cgo(LPVOID tag, HELEMENT he, UINT evtg, LPVOID prms) { return goElementEventProc(tag, he, evtg, prms); } @@ -57,9 +57,9 @@ INT SC_CALLBACK ELEMENT_COMPARATOR_cgo(HELEMENT he1, HELEMENT he2, LPVOID param) return goELEMENT_COMPARATOR(he1, he2, param); } -// typedef BOOL SC_CALLBACK KeyValueCallback(LPVOID param, const VALUE* pkey, const VALUE* pval); +// typedef SBOOL SC_CALLBACK KeyValueCallback(LPVOID param, const VALUE* pkey, const VALUE* pval); -BOOL SC_CALLBACK KeyValueCallback_cgo(LPVOID param, const VALUE* pkey, const VALUE* pval) +SBOOL SC_CALLBACK KeyValueCallback_cgo(LPVOID param, const VALUE* pkey, const VALUE* pval) { return goKeyValueCallback(param, (VALUE*)pkey, (VALUE*)pval); } \ No newline at end of file diff --git a/examples/callback/callback.go b/examples/callback/callback.go index 00018c5..0d26507 100644 --- a/examples/callback/callback.go +++ b/examples/callback/callback.go @@ -3,7 +3,7 @@ package main import ( "log" "path/filepath" - + "github.com/sciter-sdk/go-sciter" "github.com/sciter-sdk/go-sciter/window" ) diff --git a/examples/demoes/01/demo1.go b/examples/demoes/01/demo1.go index b2f3228..3b93cfd 100644 --- a/examples/demoes/01/demo1.go +++ b/examples/demoes/01/demo1.go @@ -3,7 +3,7 @@ package main import ( "log" "path/filepath" - + "github.com/sciter-sdk/go-sciter" "github.com/sciter-sdk/go-sciter/window" ) diff --git a/examples/demoes/05/demo5.go b/examples/demoes/05/demo5.go index d9135d8..1d7c912 100644 --- a/examples/demoes/05/demo5.go +++ b/examples/demoes/05/demo5.go @@ -3,7 +3,7 @@ package main import ( "log" "path/filepath" - + "github.com/sciter-sdk/go-sciter" "github.com/sciter-sdk/go-sciter/window" ) diff --git a/examples/handlers/handlers.go b/examples/handlers/handlers.go index b508444..454a484 100644 --- a/examples/handlers/handlers.go +++ b/examples/handlers/handlers.go @@ -4,7 +4,7 @@ import ( "flag" "log" "path/filepath" - + "github.com/sciter-sdk/go-sciter" "github.com/sciter-sdk/go-sciter/rice" "github.com/sciter-sdk/go-sciter/window" diff --git a/examples/textHtml/textHtml.go b/examples/textHtml/textHtml.go index b41d4b3..ed729a6 100644 --- a/examples/textHtml/textHtml.go +++ b/examples/textHtml/textHtml.go @@ -24,7 +24,7 @@ const (
- +
diff --git a/include/sciter-om-def.h b/include/sciter-om-def.h index 1b511a0..79cafb7 100644 --- a/include/sciter-om-def.h +++ b/include/sciter-om-def.h @@ -19,14 +19,14 @@ UINT64 SCAPI SciterAtomValue(const char* name); UINT64 SCAPI SciterAtomNameCB(UINT64 atomv, LPCSTR_RECEIVER* rcv, LPVOID rcv_param); -typedef BOOL(*som_prop_getter_t)(som_asset_t* thing, SOM_VALUE* p_value); -typedef BOOL(*som_prop_setter_t)(som_asset_t* thing, const SOM_VALUE* p_value); -typedef BOOL(*som_item_getter_t)(som_asset_t* thing, const SOM_VALUE* p_key, SOM_VALUE* p_value); -typedef BOOL(*som_item_setter_t)(som_asset_t* thing, const SOM_VALUE* p_key, const SOM_VALUE* p_value); -typedef BOOL(*som_item_next_t)(som_asset_t* thing, SOM_VALUE* p_idx /*in/out*/, SOM_VALUE* p_value); -typedef BOOL(*som_any_prop_getter_t)(som_asset_t* thing, UINT64 propSymbol, SOM_VALUE* p_value); -typedef BOOL(*som_any_prop_setter_t)(som_asset_t* thing, UINT64 propSymbol, const SOM_VALUE* p_value); -typedef BOOL(*som_method_t)(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result); +typedef SBOOL(*som_prop_getter_t)(som_asset_t* thing, SOM_VALUE* p_value); +typedef SBOOL(*som_prop_setter_t)(som_asset_t* thing, const SOM_VALUE* p_value); +typedef SBOOL(*som_item_getter_t)(som_asset_t* thing, const SOM_VALUE* p_key, SOM_VALUE* p_value); +typedef SBOOL(*som_item_setter_t)(som_asset_t* thing, const SOM_VALUE* p_key, const SOM_VALUE* p_value); +typedef SBOOL(*som_item_next_t)(som_asset_t* thing, SOM_VALUE* p_idx /*in/out*/, SOM_VALUE* p_value); +typedef SBOOL(*som_any_prop_getter_t)(som_asset_t* thing, UINT64 propSymbol, SOM_VALUE* p_value); +typedef SBOOL(*som_any_prop_setter_t)(som_asset_t* thing, UINT64 propSymbol, const SOM_VALUE* p_value); +typedef SBOOL(*som_method_t)(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result); typedef void(*som_dispose_t)(som_asset_t* thing); typedef struct som_property_def_t { @@ -49,10 +49,10 @@ typedef struct som_method_def_t { #endif } som_method_def_t; -typedef enum som_passport_flags { +enum som_passport_flags { SOM_SEALED_OBJECT = 0x00, // not extendable SOM_EXTENDABLE_OBJECT = 0x01 // extendable, asset may have new properties added -} som_passport_flags; +}; // definiton of object (the thing) access interface // this structure should be statically allocated - at least survive last instance of the engine @@ -148,9 +148,9 @@ namespace sciter { template struct member_property { - static BOOL getter(som_asset_t* thing, SOM_VALUE* p_value) + static SBOOL getter(som_asset_t* thing, SOM_VALUE* p_value) { *p_value = SOM_VALUE((static_cast(thing)->*M)); return TRUE; } - static BOOL setter(som_asset_t* thing, const SOM_VALUE* p_value) + static SBOOL setter(som_asset_t* thing, const SOM_VALUE* p_value) { static_cast(thing)->*M = p_value->get(); return TRUE; } }; @@ -159,111 +159,271 @@ namespace sciter { template struct member_function { enum { n_params = 0 }; - template static BOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) { try { *p_result = SOM_VALUE((static_cast(thing)->*Func)()); return TRUE; } catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } } }; + template + struct member_function { + enum { n_params = 0 }; + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + { + try { (static_cast(thing)->*Func)(); *p_result = SOM_VALUE(); return TRUE; } + catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } + } + }; + template struct member_function { enum { n_params = 1 }; - template static BOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) { try { *p_result = SOM_VALUE((static_cast(thing)->*Func)(argv[0].get())); return TRUE; } catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } } }; + template + struct member_function { + enum { n_params = 1 }; + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + { + try { (static_cast(thing)->*Func)(argv[0].get()); *p_result = SOM_VALUE(); return TRUE; } + catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } + } + }; + template struct member_function { enum { n_params = 2 }; - template static BOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) { try { *p_result = SOM_VALUE((static_cast(thing)->*Func)(argv[0].get(), argv[1].get())); return TRUE; } catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } } }; + template + struct member_function { + enum { n_params = 2 }; + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + { + try { (static_cast(thing)->*Func)(argv[0].get(), argv[1].get()); *p_result = SOM_VALUE(); return TRUE; } + catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } + } + }; + template struct member_function { enum { n_params = 3 }; - template static BOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) { try { *p_result = SOM_VALUE((static_cast(thing)->*Func)(argv[0].get(), argv[1].get(), argv[2].get())); return TRUE; } catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } } }; + template + struct member_function { + enum { n_params = 3 }; + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + { + try { (static_cast(thing)->*Func)(argv[0].get(), argv[1].get(), argv[2].get()); *p_result = SOM_VALUE(); return TRUE; } + catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } + } + }; + template struct member_function { enum { n_params = 4 }; - template static BOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) { try { *p_result = SOM_VALUE((static_cast(thing)->*Func)(argv[0].get(), argv[1].get(), argv[2].get(), argv[3].get())); return TRUE; } catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } } }; - // func() const variants of the above - template + template + struct member_function { + enum { n_params = 4 }; + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + { + try { (static_cast(thing)->*Func)(argv[0].get(), argv[1].get(), argv[2].get(), argv[3].get()); *p_result = SOM_VALUE(); return TRUE; } + catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } + } + }; + + template + struct member_function { + enum { n_params = 5 }; + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + { + try { *p_result = SOM_VALUE((static_cast(thing)->*Func)(argv[0].get(), argv[1].get(), argv[2].get(), argv[3].get(), argv[4].get())); return TRUE; } + catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } + } + }; + + template + struct member_function { + enum { n_params = 5 }; + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + { + try { (static_cast(thing)->*Func)(argv[0].get(), argv[1].get(), argv[2].get(), argv[3].get(), argv[4].get()); *p_result = SOM_VALUE(); return TRUE; } + catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } + } + }; + + template + struct member_function { + enum { n_params = 6 }; + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + { + try { *p_result = SOM_VALUE((static_cast(thing)->*Func)(argv[0].get(), argv[1].get(), argv[2].get(), argv[3].get(), argv[4].get(), argv[5].get())); return TRUE; } + catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } + } + }; + + template + struct member_function { + enum { n_params = 6 }; + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + { + try { (static_cast(thing)->*Func)(argv[0].get(), argv[1].get(), argv[2].get(), argv[3].get(), argv[4].get(), argv[5].get()); *p_result = SOM_VALUE(); return TRUE; } + catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } + } + }; + + + // func() const variants of the above + template struct member_function { enum { n_params = 0 }; - template static BOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) { try { *p_result = SOM_VALUE((static_cast(thing)->*Func)()); return TRUE; } catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } } }; - template + template + struct member_function { + enum { n_params = 0 }; + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + { + try { (static_cast(thing)->*Func)(); *p_result = SOM_VALUE(); return TRUE; } + catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } + } + }; + + template struct member_function { enum { n_params = 1 }; - template static BOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) { try { *p_result = SOM_VALUE((static_cast(thing)->*Func)(argv[0].get())); return TRUE; } catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } } }; - template + template + struct member_function { + enum { n_params = 1 }; + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + { + try { (static_cast(thing)->*Func)(argv[0].get()); *p_result = SOM_VALUE(); return TRUE; } + catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } + } + }; + + template struct member_function { enum { n_params = 2 }; - template static BOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) { try { *p_result = SOM_VALUE((static_cast(thing)->*Func)(argv[0].get(), argv[1].get())); return TRUE; } catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } } }; - template + template + struct member_function { + enum { n_params = 2 }; + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + { + try { (static_cast(thing)->*Func)(argv[0].get(), argv[1].get()); *p_result = SOM_VALUE(); return TRUE; } + catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } + } + }; + + template struct member_function { enum { n_params = 3 }; - template static BOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) { try { *p_result = SOM_VALUE((static_cast(thing)->*Func)(argv[0].get(), argv[1].get(), argv[2].get())); return TRUE; } catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } } }; - template + template + struct member_function { + enum { n_params = 3 }; + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + { + try { (static_cast(thing)->*Func)(argv[0].get(), argv[1].get(), argv[2].get()); *p_result = SOM_VALUE(); return TRUE; } + catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } + } + }; + + template struct member_function { enum { n_params = 4 }; - template static BOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) { try { *p_result = SOM_VALUE((static_cast(thing)->*Func)(argv[0].get(), argv[1].get(), argv[2].get(), argv[3].get())); return TRUE; } catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } } }; + template + struct member_function { + enum { n_params = 4 }; + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + { + try { (static_cast(thing)->*Func)(argv[0].get(), argv[1].get(), argv[2].get(), argv[3].get()); *p_result = SOM_VALUE(); return TRUE; } + catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } + } + }; + + template + struct member_function { + enum { n_params = 5 }; + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + { + try { *p_result = SOM_VALUE((static_cast(thing)->*Func)(argv[0].get(), argv[1].get(), argv[2].get(), argv[3].get(), argv[4].get())); return TRUE; } + catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } + } + }; + + template + struct member_function { + enum { n_params = 5 }; + template static SBOOL thunk(som_asset_t* thing, UINT argc, const SOM_VALUE* argv, SOM_VALUE* p_result) + { + try { (static_cast(thing)->*Func)(argv[0].get(), argv[1].get(), argv[2].get(), argv[3].get(), argv[4].get()); *p_result = SOM_VALUE(); return TRUE; } + catch (exception& e) { *p_result = SOM_VALUE::make_error(e.what()); return TRUE; } + } + }; template struct item_set_accessor; template struct item_set_accessor { template - static BOOL thunk(som_asset_t* thing, const SOM_VALUE* p_key, const SOM_VALUE* p_value) + static SBOOL thunk(som_asset_t* thing, const SOM_VALUE* p_key, const SOM_VALUE* p_value) { return (static_cast(thing)->*Func)(p_key->get(), p_value->get()) ? TRUE : FALSE; }}; template struct item_get_accessor; @@ -272,7 +432,7 @@ namespace sciter { template struct item_get_accessor { template - static BOOL thunk(som_asset_t* thing, const SOM_VALUE* p_key, SOM_VALUE* p_value) + static SBOOL thunk(som_asset_t* thing, const SOM_VALUE* p_key, SOM_VALUE* p_value) { typename std::remove_reference::type val; if ((static_cast(thing)->*Func)(p_key->get(), val)) { @@ -287,7 +447,7 @@ namespace sciter { template struct item_get_accessor { template - static BOOL thunk(som_asset_t* thing, const SOM_VALUE* p_key, SOM_VALUE* p_value) + static SBOOL thunk(som_asset_t* thing, const SOM_VALUE* p_key, SOM_VALUE* p_value) { typename std::remove_reference::type val; if ((static_cast(thing)->*Func)(p_key->get(), val)) { @@ -304,7 +464,7 @@ namespace sciter { struct item_next_accessor { template - static BOOL thunk(som_asset_t* thing, SOM_VALUE* p_index, SOM_VALUE* p_value) + static SBOOL thunk(som_asset_t* thing, SOM_VALUE* p_index, SOM_VALUE* p_value) { typedef typename std::remove_reference::type TIndex; typedef typename std::remove_reference::type TVal; @@ -324,7 +484,7 @@ namespace sciter { template struct member_getter_function { - template static BOOL thunk(som_asset_t* thing, SOM_VALUE* p_value) + template static SBOOL thunk(som_asset_t* thing, SOM_VALUE* p_value) { try { *p_value = SOM_VALUE((static_cast(thing)->*Func)()); return TRUE; } catch (exception& e) { *p_value = SOM_VALUE::make_error(e.what()); return TRUE; } @@ -333,7 +493,7 @@ namespace sciter { template struct member_getter_function { - template static BOOL thunk(som_asset_t* thing, SOM_VALUE* p_value) + template static SBOOL thunk(som_asset_t* thing, SOM_VALUE* p_value) { //try { *p_value = SOM_VALUE((static_cast(thing)->*Func)()); return TRUE; } //catch (exception& e) { *p_value = SOM_VALUE::make_error(e.what()); return TRUE; } @@ -344,7 +504,7 @@ namespace sciter { template struct member_setter_function { - template static BOOL thunk(som_asset_t* thing, const SOM_VALUE* p_value) + template static SBOOL thunk(som_asset_t* thing, const SOM_VALUE* p_value) { //try { bool r = (static_cast(thing)->*Func)(p_value->get()); return r; } //catch (exception& e) { *p_value = SOM_VALUE::make_error(e.what()); return TRUE; } @@ -361,21 +521,12 @@ namespace sciter { template struct prop_set_accessor; - // bool set_any_prop(som_atom_t name, TV val); - template - struct prop_set_accessor { - template - static BOOL thunk(som_asset_t* thing, som_atom_t name, const SOM_VALUE* p_value) - { - return (static_cast(thing)->*Func)(name, p_value->get()) ? TRUE : FALSE; - } - }; // bool set_any_prop(const std::string& name, TV val); template struct prop_set_accessor { template - static BOOL thunk(som_asset_t* thing, UINT64 name, const SOM_VALUE* p_value) + static SBOOL thunk(som_asset_t* thing, som_atom_t name, const SOM_VALUE* p_value) { return (static_cast(thing)->*Func)(atom_name(name), p_value->get()) ? TRUE : FALSE; } @@ -383,26 +534,12 @@ namespace sciter { template struct prop_get_accessor; - // bool get_any_prop(som_atom_t name, TV& val); - template - struct prop_get_accessor { - template - static BOOL thunk(som_asset_t* thing, som_atom_t name, SOM_VALUE* p_value) - { - typename std::remove_reference::type val; - if ((static_cast(thing)->*Func)(name, val)) { - *p_value = SOM_VALUE(val); - return TRUE; - } - return FALSE; - } - }; // bool get_any_prop(const std::string& name, TV& val); template struct prop_get_accessor { template - static BOOL thunk(som_asset_t* thing, som_atom_t name, SOM_VALUE* p_value) + static SBOOL thunk(som_asset_t* thing, som_atom_t name, SOM_VALUE* p_value) { typename std::remove_reference::type val; if ((static_cast(thing)->*Func)(atom_name(name), val)) { diff --git a/include/sciter-om.h b/include/sciter-om.h index b7eb619..791acf5 100644 --- a/include/sciter-om.h +++ b/include/sciter-om.h @@ -1,37 +1,55 @@ #pragma once -#include -#include +#ifndef __SCITER_OM_H__ +#define __SCITER_OM_H__ + struct som_passport_t; +struct som_asset_class_t; typedef UINT64 som_atom_t; - -struct som_asset_class_t; - typedef struct som_asset_t { struct som_asset_class_t* isa; } som_asset_t; -struct som_asset_class_t { +typedef struct som_asset_class_t { long(*asset_add_ref)(som_asset_t* thing); long(*asset_release)(som_asset_t* thing); long(*asset_get_interface)(som_asset_t* thing, const char* name, void** out); struct som_passport_t* (*asset_get_passport)(som_asset_t* thing); -}; +} som_asset_class_t; +inline som_asset_class_t* som_asset_get_class(const som_asset_t* pass) +{ + return pass ? pass->isa : 0; +} + +som_atom_t SCAPI SciterAtomValue(const char* name); + #ifdef CPP11 +#include +#include #include namespace sciter { + class atom { + som_atom_t _atom; + public: + atom(const char* name) { _atom = SciterAtomValue(name); } + atom(const atom& other) { _atom = other._atom; } + operator som_atom_t() const { return _atom; } + }; + namespace om { template class hasset; + // implementation of som_asset_t ISA + // note: does not define asset_add_ref()/asset_release() as they shall be defined in specializations template class iasset : public som_asset_t { @@ -70,7 +88,6 @@ namespace sciter { //template hasset interface_of() { hasset p; get_interface(C::interface_name(), p.target()); return p; } }; - inline long asset_add_ref(som_asset_t *ptr) { assert(ptr); assert(ptr->isa); @@ -97,8 +114,13 @@ namespace sciter { return ptr->isa->asset_get_passport(ptr); } + inline som_asset_class_t* asset_get_class(som_asset_t *ptr) { + assert(ptr); + return ptr->isa; + } + //hasset - yet another shared_ptr - // R here is something derived from the iasset (om::iasset) above + // R here is an entity derived from som_asset_t template class hasset { protected: @@ -108,10 +130,10 @@ namespace sciter { typedef R asset_t; hasset() :p(nullptr) {} - hasset(R* lp) :p(nullptr) { if (lp) (p = lp)->asset_add_ref(); } - hasset(const hasset& cp) :p(nullptr) { if (cp.p) (p = cp.p)->asset_add_ref(); } + hasset(R* lp) :p(nullptr) { if (lp) asset_add_ref(p = lp); } + hasset(const hasset& cp) :p(nullptr) { if (cp.p) asset_add_ref(p = cp.p); } - ~hasset() { if (p) p->asset_release(); } + ~hasset() { if (p) asset_release(p); } operator R*() const { return p; } R* operator->() const { assert(p != 0); return p; } @@ -121,7 +143,7 @@ namespace sciter { bool operator==(R* pR) const { return p == pR; } // release the interface and set it to NULL - void release() { if (p) { R* pt = p; p = 0; pt->asset_release(); } } + void release() { if (p) { R* pt = p; p = 0; asset_release(pt); } } // attach to an existing interface (does not AddRef) void attach(R* p2) { asset_release(p); p = p2; } @@ -130,8 +152,8 @@ namespace sciter { static R* assign(R* &pp, R* lp) { - if (lp != 0) lp->asset_add_ref(); - if (pp) pp->asset_release(); + if (lp != 0) asset_add_ref(lp); + if (pp) asset_release(pp); pp = lp; return lp; } @@ -143,10 +165,8 @@ namespace sciter { }; - - // intrusive add_ref/release counter - - template + // reference counted asset, uses intrusive add_ref/release counter + template class asset : public iasset> { std::atomic _ref_cntr; @@ -179,11 +199,20 @@ namespace sciter { delete static_cast(this); } }; + } - + template + inline AT* value::get_asset() const { + som_asset_t* pass = get_asset(); + if (pass && (som_asset_get_class(pass) == AT::get_asset_class())) + return static_cast(pass); + return nullptr; } + } #endif #include "sciter-om-def.h" + +#endif diff --git a/include/sciter-x-api.h b/include/sciter-x-api.h index d80801e..d92d28a 100644 --- a/include/sciter-x-api.h +++ b/include/sciter-x-api.h @@ -7,7 +7,7 @@ * * (C) 2003-2015, Terra Informatica Software, Inc. */ - +#pragma once #ifndef __SCITER_API_X__ #define __SCITER_API_X__ @@ -18,7 +18,6 @@ #include "sciter-x-request.h" #include "sciter-x-msg.h" #include "value.h" -#include "tiscript.h" #if !defined(WINDOWS) #include @@ -43,59 +42,71 @@ struct SciterGraphicsAPI; struct SCITER_X_MSG; #ifdef WINDOWLESS - #define SCITER_API_VERSION 0x10005 -#else - #define SCITER_API_VERSION 5 -#endif // !WINDOWLESS + #define SCITER_API_VERSION 0x10009 +#else + #define SCITER_API_VERSION 9 +#endif typedef struct _ISciterAPI { UINT version; // API_VERSION LPCWSTR SCFN( SciterClassName )(void); - UINT SCFN( SciterVersion )(BOOL major); - BOOL SCFN( SciterDataReady )(HWINDOW hwnd,LPCWSTR uri,LPCBYTE data, UINT dataLength); - BOOL SCFN( SciterDataReadyAsync )(HWINDOW hwnd,LPCWSTR uri, LPCBYTE data, UINT dataLength, LPVOID requestId); -#if defined(WINDOWS) && !defined(WINDOWLESS) + UINT SCFN( SciterVersion )(SBOOL major); + SBOOL SCFN( SciterDataReady )(HWINDOW hwnd,LPCWSTR uri,LPCBYTE data, UINT dataLength); + SBOOL SCFN( SciterDataReadyAsync )(HWINDOW hwnd,LPCWSTR uri, LPCBYTE data, UINT dataLength, LPVOID requestId); +#if defined(WINDOWS) LRESULT SCFN( SciterProc )(HWINDOW hwnd, UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT SCFN( SciterProcND )(HWINDOW hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL* pbHandled); + LRESULT SCFN( SciterProcND )(HWINDOW hwnd, UINT msg, WPARAM wParam, LPARAM lParam, SBOOL* pbHandled); +#else + LPVOID SciterProc; // NULL + LPVOID SciterProcND; // NULL #endif - BOOL SCFN( SciterLoadFile )(HWINDOW hWndSciter, LPCWSTR filename); + SBOOL SCFN( SciterLoadFile )(HWINDOW hWndSciter, LPCWSTR filename); - BOOL SCFN( SciterLoadHtml )(HWINDOW hWndSciter, LPCBYTE html, UINT htmlSize, LPCWSTR baseUrl); - VOID SCFN( SciterSetCallback )(HWINDOW hWndSciter, LPSciterHostCallback cb, LPVOID cbParam); - BOOL SCFN( SciterSetMasterCSS )(LPCBYTE utf8, UINT numBytes); - BOOL SCFN( SciterAppendMasterCSS )(LPCBYTE utf8, UINT numBytes); - BOOL SCFN( SciterSetCSS )(HWINDOW hWndSciter, LPCBYTE utf8, UINT numBytes, LPCWSTR baseUrl, LPCWSTR mediaType); - BOOL SCFN( SciterSetMediaType )(HWINDOW hWndSciter, LPCWSTR mediaType); - BOOL SCFN( SciterSetMediaVars )(HWINDOW hWndSciter, const SCITER_VALUE *mediaVars); - UINT SCFN( SciterGetMinWidth )(HWINDOW hWndSciter); - UINT SCFN( SciterGetMinHeight )(HWINDOW hWndSciter, UINT width); - BOOL SCFN( SciterCall )(HWINDOW hWnd, LPCSTR functionName, UINT argc, const SCITER_VALUE* argv, SCITER_VALUE* retval); - BOOL SCFN( SciterEval )( HWINDOW hwnd, LPCWSTR script, UINT scriptLength, SCITER_VALUE* pretval); - VOID SCFN( SciterUpdateWindow)(HWINDOW hwnd); -#if defined(WINDOWS) && !defined(WINDOWLESS) - BOOL SCFN( SciterTranslateMessage )(MSG* lpMsg); + SBOOL SCFN( SciterLoadHtml )(HWINDOW hWndSciter, LPCBYTE html, UINT htmlSize, LPCWSTR baseUrl); + VOID SCFN( SciterSetCallback )(HWINDOW hWndSciter, LPSciterHostCallback cb, LPVOID cbParam); + SBOOL SCFN( SciterSetMasterCSS )(LPCBYTE utf8, UINT numBytes); + SBOOL SCFN( SciterAppendMasterCSS )(LPCBYTE utf8, UINT numBytes); + SBOOL SCFN( SciterSetCSS )(HWINDOW hWndSciter, LPCBYTE utf8, UINT numBytes, LPCWSTR baseUrl, LPCWSTR mediaType); + SBOOL SCFN( SciterSetMediaType )(HWINDOW hWndSciter, LPCWSTR mediaType); + SBOOL SCFN( SciterSetMediaVars )(HWINDOW hWndSciter, const SCITER_VALUE *mediaVars); + UINT SCFN( SciterGetMinWidth )(HWINDOW hWndSciter); + UINT SCFN( SciterGetMinHeight )(HWINDOW hWndSciter, UINT width); + SBOOL SCFN( SciterCall )(HWINDOW hWnd, LPCSTR functionName, UINT argc, const SCITER_VALUE* argv, SCITER_VALUE* retval); + SBOOL SCFN( SciterEval )( HWINDOW hwnd, LPCWSTR script, UINT scriptLength, SCITER_VALUE* pretval); + VOID SCFN( SciterUpdateWindow)(HWINDOW hwnd); +#if defined(WINDOWS) + SBOOL SCFN(SciterTranslateMessage)(MSG* lpMsg); +#else + LPVOID SciterTranslateMessage; // NULL #endif - BOOL SCFN( SciterSetOption )(HWINDOW hWnd, UINT option, UINT_PTR value ); - VOID SCFN( SciterGetPPI )(HWINDOW hWndSciter, UINT* px, UINT* py); - BOOL SCFN( SciterGetViewExpando )( HWINDOW hwnd, VALUE* pval ); -#if defined(WINDOWS) && !defined(WINDOWLESS) - BOOL SCFN( SciterRenderD2D )(HWINDOW hWndSciter, IUnknown* /*ID2D1RenderTarget**/ prt); - BOOL SCFN( SciterD2DFactory )(void** /*ID2D1Factory ***/ ppf); - BOOL SCFN( SciterDWFactory )(void** /*IDWriteFactory ***/ ppf); + SBOOL SCFN( SciterSetOption )(HWINDOW hWnd, UINT option, UINT_PTR value ); + VOID SCFN( SciterGetPPI )(HWINDOW hWndSciter, UINT* px, UINT* py); + SBOOL SCFN( SciterGetViewExpando )( HWINDOW hwnd, VALUE* pval ); +#if defined(WINDOWS) + SBOOL SCFN( SciterRenderD2D )(HWINDOW hWndSciter, IUnknown* /*ID2D1RenderTarget**/ prt); + SBOOL SCFN( SciterD2DFactory )(IUnknown** /*ID2D1Factory ***/ ppf); + SBOOL SCFN( SciterDWFactory )(IUnknown** /*IDWriteFactory ***/ ppf); +#else + LPVOID SciterRenderD2D; + LPVOID SciterD2DFactory; + LPVOID SciterDWFactory; #endif - BOOL SCFN( SciterGraphicsCaps )(LPUINT pcaps); - BOOL SCFN( SciterSetHomeURL )(HWINDOW hWndSciter, LPCWSTR baseUrl); -#if defined(OSX) && !defined(WINDOWLESS) + SBOOL SCFN( SciterGraphicsCaps )(LPUINT pcaps); + SBOOL SCFN( SciterSetHomeURL )(HWINDOW hWndSciter, LPCWSTR baseUrl); +#if defined(OSX) HWINDOW SCFN( SciterCreateNSView )( LPRECT frame ); // returns NSView* +#else + LPVOID SciterCreateNSView; // NULL #endif -#if defined(LINUX) && !defined(WINDOWLESS) +#if defined(LINUX) HWINDOW SCFN( SciterCreateWidget )( LPRECT frame ); // returns GtkWidget +#else + LPVOID SciterCreateWidget; // NULL #endif -#if !defined(WINDOWLESS) HWINDOW SCFN( SciterCreateWindow )( UINT creationFlags,LPRECT frame, SciterWindowDelegate* delegate, LPVOID delegateParam, HWINDOW parent); -#endif + VOID SCFN( SciterSetupDebugOutput )( HWINDOW hwndOrNull,// HWINDOW or null if this is global output handler LPVOID param, // param to be passed "as is" to the pfOutput @@ -112,7 +123,7 @@ typedef struct _ISciterAPI { SCDOM_RESULT SCFN( SciterGetChildrenCount)(HELEMENT he, UINT* count); SCDOM_RESULT SCFN( SciterGetNthChild)(HELEMENT he, UINT n, HELEMENT* phe); SCDOM_RESULT SCFN( SciterGetParentElement)(HELEMENT he, HELEMENT* p_parent_he); - SCDOM_RESULT SCFN( SciterGetElementHtmlCB)(HELEMENT he, BOOL outer, LPCBYTE_RECEIVER* rcv, LPVOID rcv_param); + SCDOM_RESULT SCFN( SciterGetElementHtmlCB)(HELEMENT he, SBOOL outer, LPCBYTE_RECEIVER* rcv, LPVOID rcv_param); SCDOM_RESULT SCFN( SciterGetElementTextCB)(HELEMENT he, LPCWSTR_RECEIVER* rcv, LPVOID rcv_param); SCDOM_RESULT SCFN( SciterSetElementText)(HELEMENT he, LPCWSTR utf16, UINT length); SCDOM_RESULT SCFN( SciterGetAttributeCount)(HELEMENT he, LPUINT p_count); @@ -128,11 +139,11 @@ typedef struct _ISciterAPI { SCDOM_RESULT SCFN( SciterSetStyleAttribute)(HELEMENT he, LPCSTR name, LPCWSTR value); SCDOM_RESULT SCFN( SciterGetElementLocation)(HELEMENT he, LPRECT p_location, UINT areas /*ELEMENT_AREAS*/); SCDOM_RESULT SCFN( SciterScrollToView)(HELEMENT he, UINT SciterScrollFlags); - SCDOM_RESULT SCFN( SciterUpdateElement)(HELEMENT he, BOOL andForceRender); + SCDOM_RESULT SCFN( SciterUpdateElement)(HELEMENT he, SBOOL andForceRender); SCDOM_RESULT SCFN( SciterRefreshElementArea)(HELEMENT he, RECT rc); SCDOM_RESULT SCFN( SciterSetCapture)(HELEMENT he); SCDOM_RESULT SCFN( SciterReleaseCapture)(HELEMENT he); - SCDOM_RESULT SCFN( SciterGetElementHwnd)(HELEMENT he, HWINDOW* p_hwnd, BOOL rootWindow); + SCDOM_RESULT SCFN( SciterGetElementHwnd)(HELEMENT he, HWINDOW* p_hwnd, SBOOL rootWindow); SCDOM_RESULT SCFN( SciterCombineURL)(HELEMENT he, LPWSTR szUrlBuffer, UINT UrlBufferSize); SCDOM_RESULT SCFN( SciterSelectElements)(HELEMENT he, LPCSTR CSS_selectors, SciterElementCallback* callback, LPVOID param); SCDOM_RESULT SCFN( SciterSelectElementsW)(HELEMENT he, LPCWSTR CSS_selectors, SciterElementCallback* callback, LPVOID param); @@ -145,7 +156,7 @@ typedef struct _ISciterAPI { SCDOM_RESULT SCFN( SciterShowPopupAt)(HELEMENT hePopup, POINT pos, UINT placement); SCDOM_RESULT SCFN( SciterHidePopup)(HELEMENT he); SCDOM_RESULT SCFN( SciterGetElementState)( HELEMENT he, UINT* pstateBits); - SCDOM_RESULT SCFN( SciterSetElementState)( HELEMENT he, UINT stateBitsToSet, UINT stateBitsToClear, BOOL updateView); + SCDOM_RESULT SCFN( SciterSetElementState)( HELEMENT he, UINT stateBitsToSet, UINT stateBitsToClear, SBOOL updateView); SCDOM_RESULT SCFN( SciterCreateElement)( LPCSTR tagname, LPCWSTR textOrNull, /*out*/ HELEMENT *phe ); SCDOM_RESULT SCFN( SciterCloneElement)( HELEMENT he, /*out*/ HELEMENT *phe ); SCDOM_RESULT SCFN( SciterInsertElement)( HELEMENT he, HELEMENT hparent, UINT index ); @@ -156,7 +167,7 @@ typedef struct _ISciterAPI { SCDOM_RESULT SCFN( SciterAttachEventHandler)( HELEMENT he, LPELEMENT_EVENT_PROC pep, LPVOID tag ); SCDOM_RESULT SCFN( SciterWindowAttachEventHandler)( HWINDOW hwndLayout, LPELEMENT_EVENT_PROC pep, LPVOID tag, UINT subscription ); SCDOM_RESULT SCFN( SciterWindowDetachEventHandler)( HWINDOW hwndLayout, LPELEMENT_EVENT_PROC pep, LPVOID tag ); - SCDOM_RESULT SCFN( SciterSendEvent)( HELEMENT he, UINT appEventCode, HELEMENT heSource, UINT_PTR reason, /*out*/ BOOL* handled); + SCDOM_RESULT SCFN( SciterSendEvent)( HELEMENT he, UINT appEventCode, HELEMENT heSource, UINT_PTR reason, /*out*/ SBOOL* handled); SCDOM_RESULT SCFN( SciterPostEvent)( HELEMENT he, UINT appEventCode, HELEMENT heSource, UINT_PTR reason); SCDOM_RESULT SCFN( SciterCallBehaviorMethod)(HELEMENT he, struct METHOD_PARAMS* params); SCDOM_RESULT SCFN( SciterRequestElementData)( HELEMENT he, LPCWSTR url, UINT dataType, HELEMENT initiator ); @@ -168,14 +179,14 @@ typedef struct _ISciterAPI { UINT nParams // number of parameters ); SCDOM_RESULT SCFN( SciterGetScrollInfo)( HELEMENT he, LPPOINT scrollPos, LPRECT viewRect, LPSIZE contentSize ); - SCDOM_RESULT SCFN( SciterSetScrollPos)( HELEMENT he, POINT scrollPos, BOOL smooth ); + SCDOM_RESULT SCFN( SciterSetScrollPos)( HELEMENT he, POINT scrollPos, SBOOL smooth ); SCDOM_RESULT SCFN( SciterGetElementIntrinsicWidths)( HELEMENT he, INT* pMinWidth, INT* pMaxWidth ); SCDOM_RESULT SCFN( SciterGetElementIntrinsicHeight)( HELEMENT he, INT forWidth, INT* pHeight ); - SCDOM_RESULT SCFN( SciterIsElementVisible)( HELEMENT he, BOOL* pVisible); - SCDOM_RESULT SCFN( SciterIsElementEnabled)( HELEMENT he, BOOL* pEnabled ); + SCDOM_RESULT SCFN( SciterIsElementVisible)( HELEMENT he, SBOOL* pVisible); + SCDOM_RESULT SCFN( SciterIsElementEnabled)( HELEMENT he, SBOOL* pEnabled ); SCDOM_RESULT SCFN( SciterSortElements)( HELEMENT he, UINT firstIndex, UINT lastIndex, ELEMENT_COMPARATOR* cmpFunc, LPVOID cmpFuncParam ); SCDOM_RESULT SCFN( SciterSwapElements)( HELEMENT he1, HELEMENT he2 ); - SCDOM_RESULT SCFN( SciterTraverseUIEvent)( UINT evt, LPVOID eventCtlStruct, BOOL* bOutProcessed ); + SCDOM_RESULT SCFN( SciterTraverseUIEvent)( UINT evt, LPVOID eventCtlStruct, SBOOL* bOutProcessed ); SCDOM_RESULT SCFN( SciterCallScriptingMethod)( HELEMENT he, LPCSTR name, const VALUE* argv, UINT argc, VALUE* retval ); SCDOM_RESULT SCFN( SciterCallScriptingFunction)( HELEMENT he, LPCSTR name, const VALUE* argv, UINT argc, VALUE* retval ); SCDOM_RESULT SCFN( SciterEvalElementScript)( HELEMENT he, LPCWSTR script, UINT scriptLength, VALUE* retval ); @@ -183,9 +194,9 @@ typedef struct _ISciterAPI { SCDOM_RESULT SCFN( SciterControlGetType)( HELEMENT he, /*CTL_TYPE*/ UINT *pType ); SCDOM_RESULT SCFN( SciterGetValue)( HELEMENT he, VALUE* pval ); SCDOM_RESULT SCFN( SciterSetValue)( HELEMENT he, const VALUE* pval ); - SCDOM_RESULT SCFN( SciterGetExpando)( HELEMENT he, VALUE* pval, BOOL forceCreation ); - SCDOM_RESULT SCFN( SciterGetObject)( HELEMENT he, tiscript_value* pval, BOOL forceCreation ); - SCDOM_RESULT SCFN( SciterGetElementNamespace)( HELEMENT he, tiscript_value* pval); + SCDOM_RESULT SCFN( SciterGetExpando)( HELEMENT he, VALUE* pval, SBOOL forceCreation ); + SCDOM_RESULT SCFN( SciterGetObject)( HELEMENT he, void* pval, SBOOL forceCreation ); + SCDOM_RESULT SCFN( SciterGetElementNamespace)( HELEMENT he, void* pval); SCDOM_RESULT SCFN( SciterGetHighlightedElement)(HWINDOW hwnd, HELEMENT* phe); SCDOM_RESULT SCFN( SciterSetHighlightedElement)(HWINDOW hwnd, HELEMENT he); //| @@ -206,7 +217,7 @@ typedef struct _ISciterAPI { SCDOM_RESULT SCFN( SciterNodeGetText)(HNODE hnode, LPCWSTR_RECEIVER* rcv, LPVOID rcv_param); SCDOM_RESULT SCFN( SciterNodeSetText)(HNODE hnode, LPCWSTR text, UINT textLength); SCDOM_RESULT SCFN( SciterNodeInsert)(HNODE hnode, UINT where /*NODE_INS_TARGET*/, HNODE what); - SCDOM_RESULT SCFN( SciterNodeRemove)(HNODE hnode, BOOL finalize); + SCDOM_RESULT SCFN( SciterNodeRemove)(HNODE hnode, SBOOL finalize); SCDOM_RESULT SCFN( SciterCreateTextNode)(LPCWSTR text, UINT textLength, HNODE* phnode); SCDOM_RESULT SCFN( SciterCreateCommentNode)(LPCWSTR text, UINT textLength, HNODE* phnode); //| @@ -239,21 +250,18 @@ typedef struct _ISciterAPI { UINT SCFN( ValueFromString )( VALUE* pval, LPCWSTR str, UINT strLength, /*VALUE_STRING_CVT_TYPE*/ UINT how ); UINT SCFN( ValueInvoke )( const VALUE* pval, VALUE* pthis, UINT argc, const VALUE* argv, VALUE* pretval, LPCWSTR url); UINT SCFN( ValueNativeFunctorSet )( VALUE* pval, NATIVE_FUNCTOR_INVOKE* pinvoke, NATIVE_FUNCTOR_RELEASE* prelease, VOID* tag ); - BOOL SCFN( ValueIsNativeFunctor )( const VALUE* pval); - - // tiscript VM API - tiscript_native_interface* SCFN(TIScriptAPI)(); - - HVM SCFN( SciterGetVM )( HWINDOW hwnd ); - - BOOL SCFN( Sciter_v2V ) (HVM vm, tiscript_value script_value, VALUE* value, BOOL isolate); - BOOL SCFN( Sciter_V2v ) (HVM vm, const VALUE* valuev, tiscript_value* script_value); + SBOOL SCFN( ValueIsNativeFunctor )( const VALUE* pval); + // used to be script VM API + LPVOID reserved1; + LPVOID reserved2; + LPVOID reserved3; + LPVOID reserved4; HSARCHIVE SCFN( SciterOpenArchive ) (LPCBYTE archiveData, UINT archiveDataLength); - BOOL SCFN( SciterGetArchiveItem ) (HSARCHIVE harc, LPCWSTR path, LPCBYTE* pdata, UINT* pdataLength); - BOOL SCFN( SciterCloseArchive ) (HSARCHIVE harc); + SBOOL SCFN( SciterGetArchiveItem ) (HSARCHIVE harc, LPCWSTR path, LPCBYTE* pdata, UINT* pdataLength); + SBOOL SCFN( SciterCloseArchive ) (HSARCHIVE harc); - SCDOM_RESULT SCFN( SciterFireEvent)( const BEHAVIOR_EVENT_PARAMS* evt, BOOL post, BOOL *handled ); + SCDOM_RESULT SCFN( SciterFireEvent)( const BEHAVIOR_EVENT_PARAMS* evt, SBOOL post, SBOOL *handled ); LPVOID SCFN( SciterGetCallbackParam )(HWINDOW hwnd); UINT_PTR SCFN( SciterPostCallback )(HWINDOW hwnd, UINT_PTR wparam, UINT_PTR lparam, UINT timeoutms); @@ -261,20 +269,35 @@ typedef struct _ISciterAPI { LPSciterGraphicsAPI SCFN( GetSciterGraphicsAPI )(); LPSciterRequestAPI SCFN( GetSciterRequestAPI )(); -#if defined(WINDOWS) && !defined(WINDOWLESS) - BOOL SCFN( SciterCreateOnDirectXWindow ) (HWINDOW hwnd, IUnknown* pSwapChain); // IDXGISwapChain - BOOL SCFN( SciterRenderOnDirectXWindow ) (HWINDOW hwnd, HELEMENT elementToRenderOrNull, BOOL frontLayer); - BOOL SCFN( SciterRenderOnDirectXTexture ) (HWINDOW hwnd, HELEMENT elementToRenderOrNull, IUnknown* surface); // IDXGISurface +#if defined(WINDOWS) + SBOOL SCFN( SciterCreateOnDirectXWindow ) (HWINDOW hwnd, IUnknown* pSwapChain); // IDXGISwapChain + SBOOL SCFN( SciterRenderOnDirectXWindow ) (HWINDOW hwnd, HELEMENT elementToRenderOrNull, SBOOL frontLayer); + SBOOL SCFN( SciterRenderOnDirectXTexture ) (HWINDOW hwnd, HELEMENT elementToRenderOrNull, IUnknown* surface); // IDXGISurface +#else + LPVOID SciterCreateOnDirectXWindow; + LPVOID SciterRenderOnDirectXWindow; + LPVOID SciterRenderOnDirectXTexture; #endif - BOOL SCFN(SciterProcX)(HWINDOW hwnd, SCITER_X_MSG* pMsg ); // returns TRUE if handled + SBOOL SCFN(SciterProcX)(HWINDOW hwnd, SCITER_X_MSG* pMsg ); // returns TRUE if handled + + UINT64 SCFN(SciterAtomValue)(const char* name); // + SBOOL SCFN(SciterAtomNameCB)(UINT64 atomv, LPCSTR_RECEIVER* rcv, LPVOID rcv_param); + SBOOL SCFN(SciterSetGlobalAsset)(som_asset_t* pass); + + SCDOM_RESULT SCFN(SciterGetElementAsset)(HELEMENT el, UINT64 nameAtom, som_asset_t** ppass); + + UINT SCFN(SciterSetVariable)(HWINDOW hwndOrNull, LPCWSTR path, const VALUE* pvalToSet); + UINT SCFN(SciterGetVariable)(HWINDOW hwndOrNull, LPCWSTR path, VALUE* pvalToGet); + + UINT SCFN(SciterElementUnwrap)(const VALUE* pval, HELEMENT* ppElement); + UINT SCFN(SciterElementWrap)(VALUE* pval, HELEMENT pElement); + + UINT SCFN(SciterNodeUnwrap)(const VALUE* pval, HNODE* ppNode); + UINT SCFN(SciterNodeWrap)(VALUE* pval, HNODE pNode); - UINT64 SCFN(SciterAtomValue)(const char* name); // - BOOL SCFN(SciterAtomNameCB)(UINT64 atomv, LPCSTR_RECEIVER* rcv, LPVOID rcv_param); - BOOL SCFN(SciterSetGlobalAsset)(som_asset_t* pass); } ISciterAPI; -typedef ISciterAPI* (SCAPI *SciterAPI_ptr)(); #endif diff --git a/include/sciter-x-behavior.h b/include/sciter-x-behavior.h index 5841eaf..691926e 100644 --- a/include/sciter-x-behavior.h +++ b/include/sciter-x-behavior.h @@ -45,7 +45,7 @@ a.k.a. notifications from intrinsic behaviors */ HANDLE_METHOD_CALL = 0x0200, /**< behavior specific methods */ HANDLE_SCRIPTING_METHOD_CALL = 0x0400, /**< behavior specific methods */ - HANDLE_TISCRIPT_METHOD_CALL = 0x0800, /**< behavior specific methods using direct tiscript::value's */ + //HANDLE_TISCRIPT_METHOD_CALL = 0x0800, /**< behavior specific methods using direct tiscript::value's */ HANDLE_EXCHANGE = 0x1000, /**< system drag-n-drop */ HANDLE_GESTURE = 0x2000, /**< touch input events */ @@ -65,10 +65,10 @@ * \return true if event was handled, false otherwise. **/ -typedef BOOL SC_CALLBACK ElementEventProc(LPVOID tag, HELEMENT he, UINT evtg, LPVOID prms ); +typedef SBOOL SC_CALLBACK ElementEventProc(LPVOID tag, HELEMENT he, UINT evtg, LPVOID prms ); typedef ElementEventProc * LPElementEventProc; // signature of the function exported from external behavior/dll. -typedef BOOL SC_CALLBACK SciterBehaviorFactory( LPCSTR, HELEMENT, LPElementEventProc*, LPVOID* ); +typedef SBOOL SC_CALLBACK SciterBehaviorFactory( LPCSTR, HELEMENT, LPElementEventProc*, LPVOID* ); enum PHASE_MASK { @@ -139,20 +139,28 @@ typedef BOOL SC_CALLBACK SciterBehaviorFactory( LPCSTR, HELEMENT, LPElementEvent MOUSE_MOVE, MOUSE_UP, MOUSE_DOWN, - MOUSE_DCLICK, + MOUSE_DCLICK, // double click MOUSE_WHEEL, MOUSE_TICK, // mouse pressed ticks MOUSE_IDLE, // mouse stay idle for some time - DROP = 9, // item dropped, target is that dropped item - DRAG_ENTER = 0xA, // drag arrived to the target element that is one of current drop targets. - DRAG_LEAVE = 0xB, // drag left one of current drop targets. target is the drop target element. - DRAG_REQUEST = 0xC, // drag src notification before drag start. To cancel - return true from handler. + /*OBSOLETE*/ DROP = 9, // item dropped, target is that dropped item + /*OBSOLETE*/ DRAG_ENTER = 0xA, // drag arrived to the target element that is one of current drop targets. + /*OBSOLETE*/ DRAG_LEAVE = 0xB, // drag left one of current drop targets. target is the drop target element. + /*OBSOLETE*/ DRAG_REQUEST = 0xC, // drag src notification before drag start. To cancel - return true from handler. - MOUSE_CLICK = 0xFF, // mouse click event + MOUSE_TCLICK = 0xF, // tripple click - DRAGGING = 0x100, // This flag is 'ORed' with MOUSE_ENTER..MOUSE_DOWN codes if dragging operation is in effect. - // E.g. event DRAGGING | MOUSE_MOVE is sent to underlying DOM elements while dragging. + MOUSE_TOUCH_START = 0xFC, // touch device pressed somehow + MOUSE_TOUCH_END = 0xFD, // touch device depressed - clear, nothing on it + + MOUSE_DRAG_REQUEST = 0xFE, // mouse drag start detected event + + MOUSE_CLICK = 0xFF, // mouse click event + + /*OBSOLETE*/ DRAGGING = 0x100, // ORed with MOUSE_ENTER...MOUSE_DOWN codes above + + MOUSE_HIT_TEST = 0xFFE, // sent to element, allows to handle elements with non-trivial shapes. }; @@ -165,7 +173,7 @@ typedef BOOL SC_CALLBACK SciterBehaviorFactory( LPCSTR, HELEMENT, LPElementEvent UINT button_state; // MOUSE_BUTTONS UINT alt_state; // KEYBOARD_STATES UINT cursor_type; // CURSOR_TYPE to set, see CURSOR_TYPE - BOOL is_on_icon; // mouse is over icon (foreground-image, foreground-repeat:no-repeat) + SBOOL is_on_icon; // mouse is over icon (foreground-image, foreground-repeat:no-repeat) HELEMENT dragging; // element that is being dragged over, this field is not NULL if (cmd & DRAGGING) != 0 UINT dragging_mode;// see DRAGGING_TYPE. @@ -243,7 +251,7 @@ typedef BOOL SC_CALLBACK SciterBehaviorFactory( LPCSTR, HELEMENT, LPElementEvent HELEMENT target; /**< target element, for #FOCUS_LOST it is a handle of new focus element and for #FOCUS_GOT it is a handle of old focus element, can be NULL */ UINT cause; /**< focus cause params or FOCUS_CMD_TYPE for FOCUS_ADVANCE_REQUEST */ - BOOL cancel; /**< in #FOCUS_REQUEST and #FOCUS_LOST phase setting this field to true will cancel transfer focus from old element to the new one. */ + SBOOL cancel; /**< in #FOCUS_REQUEST and #FOCUS_LOST phase setting this field to true will cancel transfer focus from old element to the new one. */ }; // parameters of evtg == HANDLE_SCROLL @@ -261,6 +269,9 @@ typedef BOOL SC_CALLBACK SciterBehaviorFactory( LPCSTR, HELEMENT, LPElementEvent SCROLL_CORNER_PRESSED, SCROLL_CORNER_RELEASED, SCROLL_SLIDER_PRESSED, + + SCROLL_ANIMATION_START, + SCROLL_ANIMATION_END, }; enum SCROLL_SOURCE { @@ -287,19 +298,24 @@ typedef BOOL SC_CALLBACK SciterBehaviorFactory( LPCSTR, HELEMENT, LPElementEvent UINT cmd; // SCROLL_EVENTS HELEMENT target; // target element INT pos; // scroll position if SCROLL_POS - BOOL vertical; // true if from vertical scrollbar + SBOOL vertical; // true if from vertical scrollbar UINT source; // SCROLL_SOURCE UINT reason; // key or scrollbar part }; enum GESTURE_CMD { - GESTURE_REQUEST = 0, // return true and fill flags if it will handle gestures. - GESTURE_ZOOM, // The zoom gesture. - GESTURE_PAN, // The pan gesture. - GESTURE_ROTATE, // The rotation gesture. - GESTURE_TAP1, // The tap gesture. - GESTURE_TAP2, // The two-finger tap gesture. + GESTURE_START = 0, + GESTURE_MOVE = 1, + GESTURE_END = 2, + + // logical events + GESTURE_PAN, // The pan gesture. + GESTURE_ZOOM, // The zoom gesture. + GESTURE_ROTATE, // The rotation gesture. + GESTURE_TAP1, // The tap gesture, a.k.a. click + GESTURE_TAP2, // The two-finger tap gesture, a.k.a. right-click + GESTURE_DOUBLE_TAP }; enum GESTURE_STATE { @@ -399,7 +415,8 @@ typedef BOOL SC_CALLBACK SciterBehaviorFactory( LPCSTR, HELEMENT, LPElementEvent EDIT_VALUE_CHANGING = 3, // before text change EDIT_VALUE_CHANGED = 4, // after text change SELECT_SELECTION_CHANGED = 5, // selection in changed + SELECT_STATE_CHANGED = SELECT_VALUE_CHANGED, // OBSOLETE, alias of SELECT_VALUE_CHANGED POPUP_REQUEST = 7, // request to show popup just received, // here DOM of popup element can be modifed. @@ -435,30 +452,12 @@ typedef BOOL SC_CALLBACK SciterBehaviorFactory( LPCSTR, HELEMENT, LPElementEvent // "grey" event codes - notfications from behaviors from this SDK HYPERLINK_CLICK = 0x80, // hyperlink click - //TABLE_HEADER_CLICK, // click on some cell in table header, - // // target = the cell, - // // reason = index of the cell (column number, 0..n) - //TABLE_ROW_CLICK, // click on data row in the table, target is the row - // // target = the row, - // // reason = index of the row (fixed_rows..n) - //TABLE_ROW_DBL_CLICK, // mouse dbl click on data row in the table, target is the row - // // target = the row, - // // reason = index of the row (fixed_rows..n) - ELEMENT_COLLAPSED = 0x90, // element was collapsed, so far only behavior:tabs is sending these two to the panels ELEMENT_EXPANDED = 0x91, // element was expanded, ACTIVATE_CHILD = 0x92, // activate (select) child, // used for example by accesskeys behaviors to send activation request, e.g. tab on behavior:tabs. - //DO_SWITCH_TAB = ACTIVATE_CHILD,// command to switch tab programmatically, handled by behavior:tabs - // // use it as SciterPostEvent(tabsElementOrItsChild, DO_SWITCH_TAB, tabElementToShow, 0); - - //INIT_DATA_VIEW, // request to virtual grid to initialize its view - - //ROWS_DATA_REQUEST, // request from virtual grid to data source behavior to fill data in the table - // // parameters passed throug DATA_ROWS_PARAMS structure. - UI_STATE_CHANGED = 0x95, // ui state changed, observers shall update their visual states. // is sent for example by behavior:richtext when caret position/selection has changed. @@ -597,20 +596,12 @@ typedef BOOL SC_CALLBACK SciterBehaviorFactory( LPCSTR, HELEMENT, LPElementEvent typedef struct SCRIPTING_METHOD_PARAMS { - LPCSTR name; ///< method name + LPCSTR name; ///< method name const SCITER_VALUE* argv; ///< vector of arguments - UINT argc; ///< argument count - SCITER_VALUE result; ///< return value + UINT argc; ///< argument count + SCITER_VALUE result; ///< return value } SCRIPTING_METHOD_PARAMS; - typedef struct TISCRIPT_METHOD_PARAMS - { - tiscript_VM* vm; - tiscript_value tag; ///< method id (symbol) - tiscript_value result; ///< return value - // parameters are accessible through tiscript::args. - } TISCRIPT_METHOD_PARAMS; - // GET_VALUE/SET_VALUE methods params struct VALUE_PARAMS { @@ -656,23 +647,12 @@ typedef BOOL SC_CALLBACK SciterBehaviorFactory( LPCSTR, HELEMENT, LPElementEvent namespace sciter { - - // event handler which can be attached to any DOM element. - // event handler can be attached to the element as a "behavior" (see below) - // or by sciter::dom::element::attach( event_handler* eh ) - -#ifdef CPP11 - struct event_handler : public sciter::om::asset -#else - struct event_handler -#endif + struct event_handler_raw // "raw", non-reference counted event handler { - event_handler() // EVENT_GROUPS flags - { - } + event_handler_raw() {} virtual void detached (HELEMENT /*he*/ ) { } - virtual void attached (HELEMENT /*he*/ ) { } + virtual void attached(HELEMENT /*he*/) { } // defines list of event groups this event_handler is subscribed to virtual bool subscription( HELEMENT he, UINT& event_groups ) @@ -681,12 +661,6 @@ typedef BOOL SC_CALLBACK SciterBehaviorFactory( LPCSTR, HELEMENT, LPElementEvent return true; } - // lifecycle of the event handler is determined by owner element, so: - virtual long asset_add_ref() { return 0; } - virtual long asset_release() { return 0; } - - virtual som_passport_t* asset_get_passport() const { return nullptr; } - // handlers with extended interface // by default they are calling old set of handlers (for compatibility with legacy code) @@ -753,6 +727,8 @@ typedef BOOL SC_CALLBACK SciterBehaviorFactory( LPCSTR, HELEMENT, LPElementEvent return on_method_call(he, UINT(params.methodID), ¶ms ); } + virtual bool handle_som(HELEMENT he, SOM_PARAMS& params) { return false; } + // notification events from builtin behaviors - synthesized events: BUTTON_CLICK, VALUE_CHANGED // see enum BEHAVIOR_EVENTS virtual bool handle_event (HELEMENT he, BEHAVIOR_EVENT_PARAMS& params ) @@ -771,11 +747,6 @@ typedef BOOL SC_CALLBACK SciterBehaviorFactory( LPCSTR, HELEMENT, LPElementEvent return on_script_call(he, params.name, params.argc, params.argv, params.result); } - virtual bool handle_scripting_call(HELEMENT he, TISCRIPT_METHOD_PARAMS& params ) - { - return on_script_call(he, params.vm, params.tag, params.result); - } - // // alternative set of event handlers (aka old set). @@ -799,10 +770,6 @@ typedef BOOL SC_CALLBACK SciterBehaviorFactory( LPCSTR, HELEMENT, LPElementEvent // where argv[0] will be 1 and argv[1] will be "one". virtual bool on_script_call(HELEMENT he, LPCSTR name, UINT argc, const SCITER_VALUE* argv, SCITER_VALUE& retval) { return false; } - // Calls from TIScript. Override this if you want your own methods accessible directly from tiscript engine. - // Use tiscript::args to access parameters. - virtual bool on_script_call(HELEMENT he, tiscript_VM* pvm, tiscript_value tag, tiscript_value& retval) { return false; } - // notification events from builtin behaviors - synthesized events: BUTTON_CLICK, VALUE_CHANGED // see enum BEHAVIOR_EVENTS virtual bool on_event (HELEMENT he, HELEMENT target, BEHAVIOR_EVENTS type, UINT_PTR reason ) { return false; } @@ -810,14 +777,14 @@ typedef BOOL SC_CALLBACK SciterBehaviorFactory( LPCSTR, HELEMENT, LPElementEvent // notification event: data requested by SciterRequestElementData just delivered virtual bool on_data_arrived (HELEMENT he, HELEMENT initiator, LPCBYTE data, UINT dataSize, UINT dataType ) { return false; } - virtual bool on_scroll( HELEMENT he, HELEMENT target, SCROLL_EVENTS cmd, INT pos, BOOL isVertical ) { return false; } + virtual bool on_scroll( HELEMENT he, HELEMENT target, SCROLL_EVENTS cmd, INT pos, SBOOL isVertical ) { return false; } // ElementEventProc implementeation - static BOOL SC_CALLBACK element_proc(LPVOID tag, HELEMENT he, UINT evtg, LPVOID prms ) + static SBOOL SC_CALLBACK element_proc(LPVOID tag, HELEMENT he, UINT evtg, LPVOID prms ) { - event_handler* pThis = static_cast(tag); + event_handler_raw* pThis = static_cast(tag); if( pThis ) switch( evtg ) - { + { case SUBSCRIPTIONS_REQUEST: { UINT *p = (UINT *)prms; @@ -834,16 +801,7 @@ typedef BOOL SC_CALLBACK SciterBehaviorFactory( LPCSTR, HELEMENT, LPElementEvent } return true; } - case HANDLE_SOM: - { - SOM_PARAMS *p = (SOM_PARAMS *)prms; - if (p->cmd == SOM_GET_PASSPORT) - p->data.passport = pThis->asset_get_passport(); - else if (p->cmd == SOM_GET_ASSET) - p->data.asset = static_cast(pThis); // note: no add_ref - return true; - } - + case HANDLE_SOM: { SOM_PARAMS *p = (SOM_PARAMS *)prms; return pThis->handle_som(he, *p); } case HANDLE_MOUSE: { MOUSE_PARAMS *p = (MOUSE_PARAMS *)prms; return pThis->handle_mouse( he, *p ); } case HANDLE_KEY: { KEY_PARAMS *p = (KEY_PARAMS *)prms; return pThis->handle_key( he, *p ); } case HANDLE_FOCUS: { FOCUS_PARAMS *p = (FOCUS_PARAMS *)prms; return pThis->handle_focus( he, *p ); } @@ -856,17 +814,39 @@ typedef BOOL SC_CALLBACK SciterBehaviorFactory( LPCSTR, HELEMENT, LPElementEvent case HANDLE_SIZE: { pThis->handle_size(he); return false; } // call using sciter::value's (from CSSS!) case HANDLE_SCRIPTING_METHOD_CALL: { SCRIPTING_METHOD_PARAMS* p = (SCRIPTING_METHOD_PARAMS *)prms; return pThis->handle_scripting_call(he, *p ); } - // call using tiscript::value's (from the script) - case HANDLE_TISCRIPT_METHOD_CALL: { TISCRIPT_METHOD_PARAMS* p = (TISCRIPT_METHOD_PARAMS *)prms; return pThis->handle_scripting_call(he, *p ); } + //OBSOLETE: case HANDLE_TISCRIPT_METHOD_CALL: { TISCRIPT_METHOD_PARAMS* p = (TISCRIPT_METHOD_PARAMS *)prms; return pThis->handle_scripting_call(he, *p ); } case HANDLE_GESTURE : { GESTURE_PARAMS *p = (GESTURE_PARAMS *)prms; return pThis->handle_gesture(he, *p ); } case HANDLE_EXCHANGE: { EXCHANGE_PARAMS *p = (EXCHANGE_PARAMS *)prms; return pThis->handle_exchange(he, *p); } - default: + default: assert(false); - } + } return false; } }; +#ifdef CPP11 + // reference counted event handler + struct event_handler : public event_handler_raw, public sciter::om::asset + { + event_handler() { asset_add_ref(); } + virtual void detached(HELEMENT /*he*/) override { asset_release(); } + + virtual som_passport_t* asset_get_passport() const override { return nullptr; } + + virtual bool handle_som(HELEMENT he, SOM_PARAMS& params) + { + if (params.cmd == SOM_GET_PASSPORT) + params.data.passport = asset_get_passport(); + else if (params.cmd == SOM_GET_ASSET) + params.data.asset = static_cast(this); // note: no add_ref + else + return false; + return true; + } + }; +#else + typedef event_handler event_handler_raw; +#endif // // "behavior" is a named event_handler @@ -911,14 +891,14 @@ typedef BOOL SC_CALLBACK SciterBehaviorFactory( LPCSTR, HELEMENT, LPElementEvent }; - inline void attach_dom_event_handler(HWINDOW hwnd, event_handler* ph) + inline void attach_dom_event_handler(HWINDOW hwnd, event_handler_raw* ph) { - int r = SciterWindowAttachEventHandler( hwnd, &event_handler::element_proc, ph, HANDLE_ALL ); + int r = SciterWindowAttachEventHandler( hwnd, &event_handler_raw::element_proc, static_cast(ph), HANDLE_ALL ); assert(r == SCDOM_OK); (void)r; } - inline void detach_dom_event_handler(HWINDOW hwnd, event_handler* ph) + inline void detach_dom_event_handler(HWINDOW hwnd, event_handler_raw* ph) { - int r = SciterWindowDetachEventHandler( hwnd, &event_handler::element_proc, ph ); + int r = SciterWindowDetachEventHandler( hwnd, &event_handler_raw::element_proc, static_cast(ph)); assert(r == SCDOM_OK); (void)r; } diff --git a/include/sciter-x-debug.h b/include/sciter-x-debug.h index b898e09..65d8788 100644 --- a/include/sciter-x-debug.h +++ b/include/sciter-x-debug.h @@ -1,10 +1,10 @@ /* * The Sciter Engine of Terra Informatica Software, Inc. * http://sciter.com - * + * * The code and information provided "as-is" without * warranty of any kind, either expressed or implied. - * + * * (C) 2003-2015, Terra Informatica Software, Inc. */ @@ -43,7 +43,7 @@ inline VOID SCAPI SciterSetupDebugOutput ( HWINDOW hwndOrNull, LPVOID param, if (pi) _instance = pi; return _instance; } - + static VOID SC_CALLBACK _output_debug(LPVOID param, UINT subsystem, UINT severity, LPCWSTR text, UINT text_length) { static_cast(param)->output((OUTPUT_SUBSYTEMS)subsystem,(OUTPUT_SEVERITY)severity, (const WCHAR*)text,text_length); @@ -147,6 +147,13 @@ inline VOID SCAPI SciterSetupDebugOutput ( HWINDOW hwndOrNull, LPVOID param, freopen("conin$", "r", stdin); freopen("conout$", "w", stdout); freopen("conout$", "w", stderr); +#if 0 + DWORD cm; + if(GetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE),&cm)) + SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), cm | ENABLE_VIRTUAL_TERMINAL_INPUT); + if (GetConsoleMode(GetStdHandle(STD_ERROR_HANDLE), &cm)) + SetConsoleMode(GetStdHandle(STD_ERROR_HANDLE), cm | ENABLE_VIRTUAL_TERMINAL_INPUT); +#endif #pragma warning( pop ) initialized = true; } @@ -173,7 +180,9 @@ inline VOID SCAPI SciterSetupDebugOutput ( HWINDOW hwndOrNull, LPVOID param, fputs(text, f); } #endif + }; + } #endif diff --git a/include/sciter-x-def.h b/include/sciter-x-def.h index fa9d905..5403912 100644 --- a/include/sciter-x-def.h +++ b/include/sciter-x-def.h @@ -1,18 +1,18 @@ -/* - * The Sciter Engine of Terra Informatica Software, Inc. - * http://sciter.com - * +/* + * The Sciter Engine of Terra Informatica Software, Inc. + * http://sciter.com + * * The code and information provided "as-is" without * warranty of any kind, either expressed or implied. - * - * (C) 2003-2015, Terra Informatica Software, Inc. - */ + * + * (C) 2003-2015, Terra Informatica Software, Inc. + */ -#ifndef __SCITER_X_DEF__ -#define __SCITER_X_DEF__ +#ifndef __SCITER_X_DEF__ +#define __SCITER_X_DEF__ #include "sciter-x-types.h" -#include "sciter-x-request.h" +#include "sciter-x-request.h" #include "value.h" #ifdef __cplusplus #include "aux-cvt.h" @@ -46,25 +46,25 @@ LPCWSTR SCAPI SciterClassName(void); /**Returns major and minor version of Sciter engine. - * \return UINT, hiword (16-bit) contains major number and loword contains minor number; + * \return UINT, hiword (16-bit) contains major number and loword contains minor number; **/ - UINT SCAPI SciterVersion(BOOL major); + UINT SCAPI SciterVersion(SBOOL major); -/** #SC_LOAD_DATA notification return codes */ -enum SC_LOAD_DATA_RETURN_CODES +/** #SC_LOAD_DATA notification return codes */ +enum SC_LOAD_DATA_RETURN_CODES { - LOAD_OK = 0, /**< do default loading if data not set */ - LOAD_DISCARD = 1, /**< discard request completely */ - LOAD_DELAYED = 2, /**< data will be delivered later by the host application. - Host application must call SciterDataReadyAsync(,,, requestId) on each LOAD_DELAYED request to avoid memory leaks. */ - LOAD_MYSELF = 3, /**< you return LOAD_MYSELF result to indicate that your (the host) application took or will take care about HREQUEST in your code completely. - Use sciter-x-request.h[pp] API functions with SCN_LOAD_DATA::requestId handle . */ + LOAD_OK = 0, /**< do default loading if data not set */ + LOAD_DISCARD = 1, /**< discard request completely */ + LOAD_DELAYED = 2, /**< data will be delivered later by the host application. + Host application must call SciterDataReadyAsync(,,, requestId) on each LOAD_DELAYED request to avoid memory leaks. */ + LOAD_MYSELF = 3, /**< you return LOAD_MYSELF result to indicate that your (the host) application took or will take care about HREQUEST in your code completely. + Use sciter-x-request.h[pp] API functions with SCN_LOAD_DATA::requestId handle . */ }; /**Notifies that Sciter is about to download a referred resource. * * \param lParam #LPSCN_LOAD_DATA. - * \return #SC_LOAD_DATA_RETURN_CODES + * \return #SC_LOAD_DATA_RETURN_CODES * * This notification gives application a chance to override built-in loader and * implement loading of resources in its own way (for example images can be loaded from @@ -117,22 +117,22 @@ enum SC_LOAD_DATA_RETURN_CODES #define SC_ENGINE_DESTROYED 0x05 /**Posted notification. - + * \param lParam #LPSCN_POSTED_NOTIFICATION * **/ #define SC_POSTED_NOTIFICATION 0x06 -/**This notification is sent when the engine encounters critical rendering error: e.g. DirectX gfx driver error. - Most probably bad gfx drivers. - - * \param lParam #LPSCN_GRAPHICS_CRITICAL_FAILURE - * - **/ -#define SC_GRAPHICS_CRITICAL_FAILURE 0x07 - - +/**This notification is sent when the engine encounters critical rendering error: e.g. DirectX gfx driver error. + Most probably bad gfx drivers. + + * \param lParam #LPSCN_GRAPHICS_CRITICAL_FAILURE + * + **/ +#define SC_GRAPHICS_CRITICAL_FAILURE 0x07 + + /**This notification is sent when the engine needs keyboard to be present on screen E.g. when gets focus @@ -164,14 +164,14 @@ typedef UINT SC_CALLBACK SciterHostCallback( LPSCITER_CALLBACK_NOTIFICATION pns, typedef SciterHostCallback * LPSciterHostCallback; -/**This structure is used by #SC_LOAD_DATA notification. - *\copydoc SC_LOAD_DATA +/**This structure is used by #SC_LOAD_DATA notification. + *\copydoc SC_LOAD_DATA **/ typedef struct SCN_LOAD_DATA { - UINT code; /**< [in] one of the codes above.*/ - HWINDOW hwnd; /**< [in] HWINDOW of the window this callback was attached to.*/ + UINT code; /**< [in] one of the codes above.*/ + HWINDOW hwnd; /**< [in] HWINDOW of the window this callback was attached to.*/ LPCWSTR uri; /**< [in] Zero terminated string, fully qualified uri, for example "http://server/folder/file.ext".*/ @@ -179,7 +179,7 @@ typedef struct SCN_LOAD_DATA UINT outDataSize; /**< [in,out] loaded data size to return.*/ UINT dataType; /**< [in] SciterResourceType */ - HREQUEST requestId; /**< [in] request handle that can be used with sciter-x-request API */ + HREQUEST requestId; /**< [in] request handle that can be used with sciter-x-request API */ HELEMENT principal; HELEMENT initiator; @@ -187,17 +187,17 @@ typedef struct SCN_LOAD_DATA typedef SCN_LOAD_DATA* LPSCN_LOAD_DATA; -/**This structure is used by #SC_DATA_LOADED notification. - *\copydoc SC_DATA_LOADED +/**This structure is used by #SC_DATA_LOADED notification. + *\copydoc SC_DATA_LOADED **/ typedef struct SCN_DATA_LOADED { - UINT code; /**< [in] one of the codes above.*/ - HWINDOW hwnd; /**< [in] HWINDOW of the window this callback was attached to.*/ + UINT code; /**< [in] one of the codes above.*/ + HWINDOW hwnd; /**< [in] HWINDOW of the window this callback was attached to.*/ LPCWSTR uri; /**< [in] zero terminated string, fully qualified uri, for example "http://server/folder/file.ext".*/ LPCBYTE data; /**< [in] pointer to loaded data.*/ - UINT dataSize; /**< [in] loaded data size (in bytes).*/ + UINT dataSize; /**< [in] loaded data size (in bytes).*/ UINT dataType; /**< [in] SciterResourceType */ UINT status; /**< [in] status = 0 (dataSize == 0) - unknown error. @@ -208,15 +208,15 @@ typedef struct SCN_DATA_LOADED typedef SCN_DATA_LOADED * LPSCN_DATA_LOADED; -/**This structure is used by #SC_ATTACH_BEHAVIOR notification. - *\copydoc SC_ATTACH_BEHAVIOR **/ +/**This structure is used by #SC_ATTACH_BEHAVIOR notification. + *\copydoc SC_ATTACH_BEHAVIOR **/ typedef struct SCN_ATTACH_BEHAVIOR { - UINT code; /**< [in] one of the codes above.*/ - HWINDOW hwnd; /**< [in] HWINDOW of the window this callback was attached to.*/ + UINT code; /**< [in] one of the codes above.*/ + HWINDOW hwnd; /**< [in] HWINDOW of the window this callback was attached to.*/ - HELEMENT element; /**< [in] target DOM element handle*/ - LPCSTR behaviorName; /**< [in] zero terminated string, string appears as value of CSS behavior:"???" attribute.*/ + HELEMENT element; /**< [in] target DOM element handle*/ + LPCSTR behaviorName; /**< [in] zero terminated string, string appears as value of CSS behavior:"???" attribute.*/ ElementEventProc* elementProc; /**< [out] pointer to ElementEventProc function.*/ LPVOID elementTag; /**< [out] tag value, passed as is into pointer ElementEventProc function.*/ @@ -225,7 +225,7 @@ typedef struct SCN_ATTACH_BEHAVIOR typedef SCN_ATTACH_BEHAVIOR* LPSCN_ATTACH_BEHAVIOR; /**This structure is used by #SC_ENGINE_DESTROYED notification. - *\copydoc SC_ENGINE_DESTROYED **/ + *\copydoc SC_ENGINE_DESTROYED **/ typedef struct SCN_ENGINE_DESTROYED { UINT code; /**< [in] one of the codes above.*/ @@ -235,7 +235,7 @@ typedef struct SCN_ENGINE_DESTROYED typedef SCN_ENGINE_DESTROYED* LPSCN_ENGINE_DESTROYED; /**This structure is used by #SC_ENGINE_DESTROYED notification. - *\copydoc SC_ENGINE_DESTROYED **/ + *\copydoc SC_ENGINE_DESTROYED **/ typedef struct SCN_POSTED_NOTIFICATION { UINT code; /**< [in] one of the codes above.*/ @@ -247,16 +247,16 @@ typedef struct SCN_POSTED_NOTIFICATION typedef SCN_POSTED_NOTIFICATION* LPSCN_POSTED_NOTIFICATION; -/**This structure is used by #SC_GRAPHICS_CRITICAL_FAILURE notification. - *\copydoc SC_GRAPHICS_CRITICAL_FAILURE **/ -typedef struct SCN_GRAPHICS_CRITICAL_FAILURE -{ - UINT code; /**< [in] = SC_GRAPHICS_CRITICAL_FAILURE */ - HWINDOW hwnd; /**< [in] HWINDOW of the window this callback was attached to.*/ -} SCN_GRAPHICS_CRITICAL_FAILURE; - -typedef SCN_GRAPHICS_CRITICAL_FAILURE* LPSCN_GRAPHICS_CRITICAL_FAILURE; - +/**This structure is used by #SC_GRAPHICS_CRITICAL_FAILURE notification. + *\copydoc SC_GRAPHICS_CRITICAL_FAILURE **/ +typedef struct SCN_GRAPHICS_CRITICAL_FAILURE +{ + UINT code; /**< [in] = SC_GRAPHICS_CRITICAL_FAILURE */ + HWINDOW hwnd; /**< [in] HWINDOW of the window this callback was attached to.*/ +} SCN_GRAPHICS_CRITICAL_FAILURE; + +typedef SCN_GRAPHICS_CRITICAL_FAILURE* LPSCN_GRAPHICS_CRITICAL_FAILURE; + /**This structure is used by #SC_KEYBOARD_REQUEST notification. *\copydoc SC_KEYBOARD_REQUEST **/ typedef struct SCN_KEYBOARD_REQUEST { @@ -277,7 +277,7 @@ typedef struct SCN_INVALIDATE_RECT { typedef SCN_INVALIDATE_RECT *LPSCN_INVALIDATE_RECT; - + #include "sciter-x-behavior.h" /**This function is used in response to SCN_LOAD_DATA request. @@ -286,14 +286,14 @@ typedef SCN_INVALIDATE_RECT *LPSCN_INVALIDATE_RECT; * \param[in] uri \b LPCWSTR, URI of the data requested by Sciter. * \param[in] data \b LPBYTE, pointer to data buffer. * \param[in] dataLength \b UINT, length of the data in bytes. - * \return \b BOOL, TRUE if Sciter accepts the data or \c FALSE if error occured + * \return \b SBOOL, TRUE if Sciter accepts the data or \c FALSE if error occured * (for example this function was called outside of #SCN_LOAD_DATA request). * * \warning If used, call of this function MUST be done ONLY while handling * SCN_LOAD_DATA request and in the same thread. For asynchronous resource loading * use SciterDataReadyAsync **/ - BOOL SCAPI SciterDataReady(HWINDOW hwnd,LPCWSTR uri,LPCBYTE data, UINT dataLength); + SBOOL SCAPI SciterDataReady(HWINDOW hwnd,LPCWSTR uri,LPCBYTE data, UINT dataLength); /**Use this function outside of SCN_LOAD_DATA request. This function is needed when you * you have your own http client implemented in your application. @@ -302,11 +302,11 @@ typedef SCN_INVALIDATE_RECT *LPSCN_INVALIDATE_RECT; * \param[in] uri \b LPCWSTR, URI of the data requested by Sciter. * \param[in] data \b LPBYTE, pointer to data buffer. * \param[in] dataLength \b UINT, length of the data in bytes. - * \param[in] requestId \b LPVOID, SCN_LOAD_DATA requestId, can be NULL. - * \return \b BOOL, TRUE if Sciter accepts the data or \c FALSE if error occured + * \param[in] requestId \b LPVOID, SCN_LOAD_DATA requestId, can be NULL. + * \return \b SBOOL, TRUE if Sciter accepts the data or \c FALSE if error occured **/ - BOOL SCAPI SciterDataReadyAsync(HWINDOW hwnd,LPCWSTR uri, LPCBYTE data, UINT dataLength, + SBOOL SCAPI SciterDataReadyAsync(HWINDOW hwnd,LPCWSTR uri, LPCBYTE data, UINT dataLength, LPVOID requestId); #ifdef WINDOWS @@ -315,7 +315,7 @@ typedef SCN_INVALIDATE_RECT *LPSCN_INVALIDATE_RECT; LRESULT SCAPI SciterProc(HWINDOW hwnd, UINT msg, WPARAM wParam, LPARAM lParam); /**Sciter Window Proc without call of DefWindowProc.*/ - LRESULT SCAPI SciterProcND(HWINDOW hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL* pbHandled); + LRESULT SCAPI SciterProcND(HWINDOW hwnd, UINT msg, WPARAM wParam, LPARAM lParam, SBOOL* pbHandled); #endif @@ -324,9 +324,9 @@ typedef SCN_INVALIDATE_RECT *LPSCN_INVALIDATE_RECT; * * \param[in] hWndSciter \b HWINDOW, Sciter window handle. * \param[in] url \b LPCWSTR, either absolute URL of HTML file to load. "file://...", "http://...", "res:...", "this://app/..." or absolute file path. - * \return \b BOOL, \c TRUE if the text was parsed and loaded successfully, \c FALSE otherwise. + * \return \b SBOOL, \c TRUE if the text was parsed and loaded successfully, \c FALSE otherwise. **/ - BOOL SCAPI SciterLoadFile(HWINDOW hWndSciter, LPCWSTR url); + SBOOL SCAPI SciterLoadFile(HWINDOW hWndSciter, LPCWSTR url); /**Load HTML from in memory buffer with base. * @@ -335,9 +335,9 @@ typedef SCN_INVALIDATE_RECT *LPSCN_INVALIDATE_RECT; * \param[in] htmlSize \b UINT, Length of the array pointed by html parameter. * \param[in] baseUrl \b LPCWSTR, base URL. All relative links will be resolved against * this URL. - * \return \b BOOL, \c TRUE if the text was parsed and loaded successfully, FALSE otherwise. + * \return \b SBOOL, \c TRUE if the text was parsed and loaded successfully, FALSE otherwise. **/ - BOOL SCAPI SciterLoadHtml(HWINDOW hWndSciter, LPCBYTE html, UINT htmlSize, LPCWSTR baseUrl); + SBOOL SCAPI SciterLoadHtml(HWINDOW hWndSciter, LPCBYTE html, UINT htmlSize, LPCWSTR baseUrl); /**Set \link #SCITER_NOTIFY() notification callback function \endlink. * @@ -345,7 +345,7 @@ typedef SCN_INVALIDATE_RECT *LPSCN_INVALIDATE_RECT; * \param[in] cb \b SCITER_NOTIFY*, \link #SCITER_NOTIFY() callback function \endlink. * \param[in] cbParam \b LPVOID, parameter that will be passed to \link #SCITER_NOTIFY() callback function \endlink as vParam paramter. **/ - VOID SCAPI SciterSetCallback(HWINDOW hWndSciter, LPSciterHostCallback cb, LPVOID cbParam); + VOID SCAPI SciterSetCallback(HWINDOW hWndSciter, LPSciterHostCallback cb, LPVOID cbParam); /**Set Master style sheet. * @@ -353,7 +353,7 @@ typedef SCN_INVALIDATE_RECT *LPSCN_INVALIDATE_RECT; * \param[in] numBytes \b UINT, number of bytes in utf8. **/ - BOOL SCAPI SciterSetMasterCSS(LPCBYTE utf8, UINT numBytes); + SBOOL SCAPI SciterSetMasterCSS(LPCBYTE utf8, UINT numBytes); /**Append Master style sheet. * @@ -362,7 +362,7 @@ typedef SCN_INVALIDATE_RECT *LPSCN_INVALIDATE_RECT; * **/ - BOOL SCAPI SciterAppendMasterCSS(LPCBYTE utf8, UINT numBytes); + SBOOL SCAPI SciterAppendMasterCSS(LPCBYTE utf8, UINT numBytes); /**Set (reset) style sheet of current document. Will reset styles for all elements according to given CSS (utf8) @@ -372,7 +372,7 @@ typedef SCN_INVALIDATE_RECT *LPSCN_INVALIDATE_RECT; * \param[in] numBytes \b UINT, number of bytes in utf8. **/ - BOOL SCAPI SciterSetCSS(HWINDOW hWndSciter, LPCBYTE utf8, UINT numBytes, LPCWSTR baseUrl, LPCWSTR mediaType); + SBOOL SCAPI SciterSetCSS(HWINDOW hWndSciter, LPCBYTE utf8, UINT numBytes, LPCWSTR baseUrl, LPCWSTR mediaType); /**Set media type of this sciter instance. * @@ -387,7 +387,7 @@ typedef SCN_INVALIDATE_RECT *LPSCN_INVALIDATE_RECT; * **/ - BOOL SCAPI SciterSetMediaType(HWINDOW hWndSciter, LPCWSTR mediaType); + SBOOL SCAPI SciterSetMediaType(HWINDOW hWndSciter, LPCWSTR mediaType); /**Set media variables of this sciter instance. * @@ -401,21 +401,21 @@ typedef SCN_INVALIDATE_RECT *LPSCN_INVALIDATE_RECT; * **/ - BOOL SCAPI SciterSetMediaVars(HWINDOW hWndSciter, const SCITER_VALUE *mediaVars); + SBOOL SCAPI SciterSetMediaVars(HWINDOW hWndSciter, const SCITER_VALUE *mediaVars); UINT SCAPI SciterGetMinWidth(HWINDOW hWndSciter); UINT SCAPI SciterGetMinHeight(HWINDOW hWndSciter, UINT width); - BOOL SCAPI SciterCall(HWINDOW hWnd, LPCSTR functionName, UINT argc, const SCITER_VALUE* argv, SCITER_VALUE* retval); + SBOOL SCAPI SciterCall(HWINDOW hWnd, LPCSTR functionName, UINT argc, const SCITER_VALUE* argv, SCITER_VALUE* retval); // evalue script in context of current document - BOOL SCAPI SciterEval( HWINDOW hwnd, LPCWSTR script, UINT scriptLength, SCITER_VALUE* pretval); + SBOOL SCAPI SciterEval( HWINDOW hwnd, LPCWSTR script, UINT scriptLength, SCITER_VALUE* pretval); /**Update pending changes in Sciter window. * * \param[in] hwnd \b HWINDOW, Sciter window handle. * **/ - VOID SCAPI SciterUpdateWindow(HWINDOW hwnd); + VOID SCAPI SciterUpdateWindow(HWINDOW hwnd); /** Try to translate message that sciter window is interested in. * @@ -433,7 +433,7 @@ typedef SCN_INVALIDATE_RECT *LPSCN_INVALIDATE_RECT; **/ #ifdef WINDOWS - BOOL SCAPI SciterTranslateMessage(MSG* lpMsg); + SBOOL SCAPI SciterTranslateMessage(MSG* lpMsg); #endif /**Set various options. @@ -467,7 +467,7 @@ enum SCITER_RT_OPTIONS SCITER_SET_SCRIPT_RUNTIME_FEATURES = 8, // value - combination of SCRIPT_RUNTIME_FEATURES flags. SCITER_SET_GFX_LAYER = 9, // hWnd = NULL, value - GFX_LAYER SCITER_SET_DEBUG_MODE = 10, // hWnd, value - TRUE/FALSE - SCITER_SET_UX_THEMING = 11, // hWnd = NULL, value - BOOL, TRUE - the engine will use "unisex" theme that is common for all platforms. + SCITER_SET_UX_THEMING = 11, // hWnd = NULL, value - SBOOL, TRUE - the engine will use "unisex" theme that is common for all platforms. // That UX theme is not using OS primitives for rendering input elements. Use it if you want exactly // the same (modulo fonts) look-n-feel on all platforms. @@ -480,9 +480,11 @@ enum SCITER_RT_OPTIONS SCITER_SET_MAX_HTTP_DATA_LENGTH = 15, // hWnd - N/A , value - max request length in megabytes (1024*1024 bytes) + SCITER_SET_PX_AS_DIP = 16, // value 1 - 1px in CSS is treated as 1dip, value 0 - default behavior - 1px is a physical pixel + }; - BOOL SCAPI SciterSetOption(HWINDOW hWnd, UINT option, UINT_PTR value ); + SBOOL SCAPI SciterSetOption(HWINDOW hWnd, UINT option, UINT_PTR value ); /**Get current pixels-per-inch metrics of the Sciter window * @@ -501,7 +503,7 @@ enum SCITER_RT_OPTIONS * **/ - BOOL SCAPI SciterGetViewExpando( HWINDOW hwnd, VALUE* pval ); + SBOOL SCAPI SciterGetViewExpando( HWINDOW hwnd, VALUE* pval ); typedef struct URL_DATA { @@ -525,95 +527,95 @@ typedef VOID SC_CALLBACK URL_DATA_RECEIVER( const URL_DATA* pUrlData, LPVOID par * \param[in] receiver \b URL_DATA_RECEIVER, address of reciver callback. * \param[in] param \b LPVOID, param passed to callback as it is. * \param[in] url \b LPCSTR, optional, url of the data. If not provided the engine will list all loaded resources - * \return \b BOOL, \c TRUE if receiver is called at least once, FALSE otherwise. + * \return \b SBOOL, \c TRUE if receiver is called at least once, FALSE otherwise. * **/ - BOOL SCAPI SciterEnumUrlData(HWINDOW hWndSciter, URL_DATA_RECEIVER* receiver, LPVOID param, LPCSTR url); + SBOOL SCAPI SciterEnumUrlData(HWINDOW hWndSciter, URL_DATA_RECEIVER* receiver, LPVOID param, LPCSTR url); #ifdef WINDOWS -/**Creates instance of Sciter Engine on window controlled by DirectX -* -* \param[in] hwnd \b HWINDOW, window handle to create Sciter on. -* \param[in] IDXGISwapChain \b pSwapChain, reference of IDXGISwapChain created on the window. -* \return \b BOOL, \c TRUE if engine instance is created, FALSE otherwise. -* -**/ - -BOOL SCAPI SciterCreateOnDirectXWindow(HWINDOW hwnd, IUnknown* pSwapChain); // IDXGISwapChain - -/**Renders content of the document loaded into the window -* Optionally allows to render parts of document (separate DOM elements) as layers -* -* \param[in] hwnd \b HWINDOW, window handle to create Sciter on. -* \param[in] HELEMENT \b elementToRenderOrNull, html element to render. If NULL then the engine renders whole document. -* \param[in] BOOL \b frontLayer, TRUE if elementToRenderOrNull is not NULL and this is the topmost layer. -* \return \b BOOL, \c TRUE if layer was rendered successfully. -* -**/ -BOOL SCAPI SciterRenderOnDirectXWindow(HWINDOW hwnd, HELEMENT elementToRenderOrNull /* = NULL*/, BOOL frontLayer /* = FALSE*/); - -/**Renders content of the document loaded to DXGI texture -* Optionally allows to render parts of document (separate DOM elements) as layers -* -* \param[in] HWINDOW \b hwnd, window handle to create Sciter on. -* \param[in] HELEMENT \b elementToRenderOrNull, html element to render. If NULL then the engine renders whole document. -* \param[in] IDXGISurface \b surface, DirectX 2D texture to render in. -* \return \b BOOL, \c TRUE if layer was rendered successfully. -* -**/ -BOOL SCAPI SciterRenderOnDirectXTexture(HWINDOW hwnd, HELEMENT elementToRenderOrNull, IUnknown* surface); // IDXGISurface - - +/**Creates instance of Sciter Engine on window controlled by DirectX +* +* \param[in] hwnd \b HWINDOW, window handle to create Sciter on. +* \param[in] IDXGISwapChain \b pSwapChain, reference of IDXGISwapChain created on the window. +* \return \b SBOOL, \c TRUE if engine instance is created, FALSE otherwise. +* +**/ + +SBOOL SCAPI SciterCreateOnDirectXWindow(HWINDOW hwnd, IUnknown* pSwapChain); // IDXGISwapChain + +/**Renders content of the document loaded into the window +* Optionally allows to render parts of document (separate DOM elements) as layers +* +* \param[in] hwnd \b HWINDOW, window handle to create Sciter on. +* \param[in] HELEMENT \b elementToRenderOrNull, html element to render. If NULL then the engine renders whole document. +* \param[in] SBOOL \b frontLayer, TRUE if elementToRenderOrNull is not NULL and this is the topmost layer. +* \return \b SBOOL, \c TRUE if layer was rendered successfully. +* +**/ +SBOOL SCAPI SciterRenderOnDirectXWindow(HWINDOW hwnd, HELEMENT elementToRenderOrNull /* = NULL*/, SBOOL frontLayer /* = FALSE*/); + +/**Renders content of the document loaded to DXGI texture +* Optionally allows to render parts of document (separate DOM elements) as layers +* +* \param[in] HWINDOW \b hwnd, window handle to create Sciter on. +* \param[in] HELEMENT \b elementToRenderOrNull, html element to render. If NULL then the engine renders whole document. +* \param[in] IDXGISurface \b surface, DirectX 2D texture to render in. +* \return \b SBOOL, \c TRUE if layer was rendered successfully. +* +**/ +SBOOL SCAPI SciterRenderOnDirectXTexture(HWINDOW hwnd, HELEMENT elementToRenderOrNull, IUnknown* surface); // IDXGISurface + + /**Render document to ID2D1RenderTarget * * \param[in] hWndSciter \b HWINDOW, Sciter window handle. * \param[in] ID2D1RenderTarget \b prt, Direct2D render target. - * \return \b BOOL, \c TRUE if hBmp is 24bpp or 32bpp, FALSE otherwise. + * \return \b SBOOL, \c TRUE if hBmp is 24bpp or 32bpp, FALSE otherwise. * **/ - BOOL SCAPI SciterRenderD2D(HWINDOW hWndSciter, IUnknown* /*ID2D1RenderTarget**/ prt); + SBOOL SCAPI SciterRenderD2D(HWINDOW hWndSciter, IUnknown* /*ID2D1RenderTarget**/ prt); /** Obtain pointer to ID2D1Factory instance used by the engine: * * \param[in] ID2D1Factory \b **ppf, address of variable receiving pointer of ID2D1Factory. - * \return \b BOOL, \c TRUE if parameters are valid and *ppf was set by valid pointer. + * \return \b SBOOL, \c TRUE if parameters are valid and *ppf was set by valid pointer. * * NOTE 1: ID2D1Factory returned by the function is "add-refed" - it is your responsibility to call Release() on it. * NOTE 2: *ppf variable shall be initialized to NULL before calling the function. * **/ - BOOL SCAPI SciterD2DFactory(void** /*ID2D1Factory ***/ ppf); + SBOOL SCAPI SciterD2DFactory(IUnknown** /*ID2D1Factory ***/ ppf); /** Obtain pointer to IDWriteFactory instance used by the engine: * * \param[in] IDWriteFactory \b **ppf, address of variable receiving pointer of IDWriteFactory. - * \return \b BOOL, \c TRUE if parameters are valid and *ppf was set by valid pointer. + * \return \b SBOOL, \c TRUE if parameters are valid and *ppf was set by valid pointer. * * NOTE 1: IDWriteFactory returned by the function is "add-refed" - it is your responsibility to call Release() on it. * NOTE 2: *ppf variable shall be initialized to NULL before calling the function. * **/ - BOOL SCAPI SciterDWFactory(void** /*IDWriteFactory ***/ ppf); + SBOOL SCAPI SciterDWFactory(IUnknown** /*IDWriteFactory ***/ ppf); + +#endif -#endif - /** Get graphics capabilities of the system * * \pcaps[in] LPUINT \b pcaps, address of variable receiving: * 0 - no compatible graphics found; * 1 - compatible graphics found but Direct2D will use WARP driver (software emulation); * 2 - Direct2D will use hardware backend (best performance); - * \return \b BOOL, \c TRUE if pcaps is valid pointer. + * \return \b SBOOL, \c TRUE if pcaps is valid pointer. * **/ - BOOL SCAPI SciterGraphicsCaps(LPUINT pcaps); + SBOOL SCAPI SciterGraphicsCaps(LPUINT pcaps); /** Set sciter home url. @@ -627,13 +629,13 @@ BOOL SCAPI SciterRenderOnDirectXTexture(HWINDOW hwnd, HELEMENT elementToRenderOr * **/ - BOOL SCAPI SciterSetHomeURL(HWINDOW hWndSciter, LPCWSTR baseUrl); + SBOOL SCAPI SciterSetHomeURL(HWINDOW hWndSciter, LPCWSTR baseUrl); #if defined(OSX) HWINDOW SCAPI SciterCreateNSView( LPRECT frame ); // returns NSView* typedef LPVOID SciterWindowDelegate; // Obj-C id, NSWindowDelegate and NSResponder #elif defined(WINDOWS) - typedef LRESULT SC_CALLBACK SciterWindowDelegate(HWINDOW hwnd, UINT msg, WPARAM wParam, LPARAM lParam, LPVOID pParam, BOOL* handled); + typedef LRESULT SC_CALLBACK SciterWindowDelegate(HWINDOW hwnd, UINT msg, WPARAM wParam, LPARAM lParam, LPVOID pParam, SBOOL* handled); #elif defined(LINUX) typedef LPVOID SciterWindowDelegate; #endif @@ -652,6 +654,7 @@ enum SCITER_CREATE_WINDOW_FLAGS { SW_OWNS_VM = (1 << 10), // it has its own script VM }; +#if !defined(WINDOWLESS) /** Create sciter window. * On Windows returns HWND of either top-level or child window created. * On OS X returns NSView* of either top-level window or child view . @@ -669,7 +672,8 @@ enum SCITER_CREATE_WINDOW_FLAGS { LPVOID delegateParam, HWINDOW parent); - +#endif + /** SciterSetupDebugOutput - setup debug output function. * * This output function will be used for reprting problems diff --git a/include/sciter-x-dom.h b/include/sciter-x-dom.h index 38ff6fb..4f2ae1b 100644 --- a/include/sciter-x-dom.h +++ b/include/sciter-x-dom.h @@ -1,10 +1,10 @@ /* * The Sciter Engine of Terra Informatica Software, Inc. * http://sciter.com - * + * * The code and information provided "as-is" without * warranty of any kind, either expressed or implied. - * + * * (C) 2003-2015, Terra Informatica Software, Inc. */ @@ -49,7 +49,7 @@ #endif //#include -#include "tiscript.h" +//#include "tiscript.h" #pragma warning(disable:4786) //identifier was truncated... #pragma warning(disable:4100) //unreferenced formal parameter @@ -81,9 +81,9 @@ struct METHOD_PARAMS { UINT methodID; }; - struct REQUEST_PARAM { - LPCWSTR name; - LPCWSTR value; + struct REQUEST_PARAM { + LPCWSTR name; + LPCWSTR value; }; typedef struct METHOD_PARAMS METHOD_PARAMS; @@ -173,12 +173,12 @@ SCDOM_RESULT SCAPI SciterGetParentElement(HELEMENT he, HELEMENT* p_parent_he); /** Get html representation of the element. * \param[in] he \b #HELEMENT - * \param[in] outer \b BOOL, if TRUE will return outer HTML otherwise inner. + * \param[in] outer \b SBOOL, if TRUE will return outer HTML otherwise inner. * \param[in] rcv \b pointer to function receiving UTF8 encoded HTML. * \param[in] rcv_param \b parameter that passed to rcv as it is. * \return \b #SCDOM_RESULT SCAPI */ -SCDOM_RESULT SCAPI SciterGetElementHtmlCB(HELEMENT he, BOOL outer, LPCBYTE_RECEIVER* rcv, LPVOID rcv_param); +SCDOM_RESULT SCAPI SciterGetElementHtmlCB(HELEMENT he, SBOOL outer, LPCBYTE_RECEIVER* rcv, LPVOID rcv_param); /**Get inner text of the element as LPWSTR (utf16 words). * \param[in] he \b #HELEMENT @@ -307,7 +307,7 @@ SCDOM_RESULT SCAPI SciterSetStyleAttribute(HELEMENT he, LPCSTR name, LPCWSTR val /*Get bounding rectangle of the element. * \param[in] he \b #HELEMENT * \param[out] p_location \b LPRECT, receives bounding rectangle of the element - * \param[in] rootRelative \b BOOL, if TRUE function returns location of the + * \param[in] rootRelative \b SBOOL, if TRUE function returns location of the * element relative to Sciter window, otherwise the location is given * relative to first scrollable container. * \return \b #SCDOM_RESULT SCAPI @@ -352,10 +352,10 @@ SCDOM_RESULT SCAPI SciterScrollToView(HELEMENT he, UINT SciterScrollFlags); /**Apply changes and refresh element area in its window. * \param[in] he \b #HELEMENT - * \param[in] andForceRender \b BOOL, TRUE to force UpdateWindow() call. + * \param[in] andForceRender \b SBOOL, TRUE to force UpdateWindow() call. * \return \b #SCDOM_RESULT SCAPI **/ -SCDOM_RESULT SCAPI SciterUpdateElement(HELEMENT he, BOOL andForceRender); +SCDOM_RESULT SCAPI SciterUpdateElement(HELEMENT he, SBOOL andForceRender); /**refresh element area in its window. * \param[in] he \b #HELEMENT @@ -377,12 +377,12 @@ SCDOM_RESULT SCAPI SciterReleaseCapture(HELEMENT he); /**Get HWINDOW of containing window. * \param[in] he \b #HELEMENT * \param[out] p_hwnd \b HWINDOW*, variable to receive window handle - * \param[in] rootWindow \b BOOL, handle of which window to get: + * \param[in] rootWindow \b SBOOL, handle of which window to get: * - TRUE - Sciter window * - FALSE - nearest parent element having overflow:auto or :scroll * \return \b #SCDOM_RESULT SCAPI **/ -SCDOM_RESULT SCAPI SciterGetElementHwnd(HELEMENT he, HWINDOW* p_hwnd, BOOL rootWindow); +SCDOM_RESULT SCAPI SciterGetElementHwnd(HELEMENT he, HWINDOW* p_hwnd, SBOOL rootWindow); @@ -400,7 +400,7 @@ SCDOM_RESULT SCAPI SciterGetElementHwnd(HELEMENT he, HWINDOW* p_hwnd, BOOL rootW SCDOM_RESULT SCAPI SciterCombineURL(HELEMENT he, LPWSTR szUrlBuffer, UINT UrlBufferSize); /**Callback function used with #SciterVisitElement().*/ -typedef BOOL SC_CALLBACK SciterElementCallback( HELEMENT he, LPVOID param ); +typedef SBOOL SC_CALLBACK SciterElementCallback( HELEMENT he, LPVOID param ); /**Call specified function for every element in a DOM that meets specified * CSS selectors. @@ -555,32 +555,32 @@ SCDOM_RESULT SCAPI SciterHidePopup(HELEMENT he); * \return TRUE if event was handled, FALSE otherwise. **/ -typedef BOOL SC_CALLBACK ElementEventProc(LPVOID tag, HELEMENT he, UINT evtg, LPVOID prms ); +typedef SBOOL SC_CALLBACK ElementEventProc(LPVOID tag, HELEMENT he, UINT evtg, LPVOID prms ); typedef ElementEventProc* LPELEMENT_EVENT_PROC; enum ELEMENT_STATE_BITS { - STATE_LINK = 0x00000001, - STATE_HOVER = 0x00000002, - STATE_ACTIVE = 0x00000004, - STATE_FOCUS = 0x00000008, - STATE_VISITED = 0x00000010, - STATE_CURRENT = 0x00000020, // current (hot) item - STATE_CHECKED = 0x00000040, // element is checked (or selected) - STATE_DISABLED = 0x00000080, // element is disabled - STATE_READONLY = 0x00000100, // readonly input element - STATE_EXPANDED = 0x00000200, // expanded state - nodes in tree view - STATE_COLLAPSED = 0x00000400, // collapsed state - nodes in tree view - mutually exclusive with - STATE_INCOMPLETE = 0x00000800, // one of fore/back images requested but not delivered - STATE_ANIMATING = 0x00001000, // is animating currently - STATE_FOCUSABLE = 0x00002000, // will accept focus - STATE_ANCHOR = 0x00004000, // anchor in selection (used with current in selects) - STATE_SYNTHETIC = 0x00008000, // this is a synthetic element - don't emit it's head/tail - STATE_OWNS_POPUP = 0x00010000, // this is a synthetic element - don't emit it's head/tail - STATE_TABFOCUS = 0x00020000, // focus gained by tab traversal - STATE_EMPTY = 0x00040000, // empty - element is empty (text.size() == 0 && subs.size() == 0) + STATE_LINK = 0x00000001, // :link pseudo-class in CSS + STATE_HOVER = 0x00000002, // :hover pseudo-class in CSS + STATE_ACTIVE = 0x00000004, // :active pseudo-class in CSS + STATE_FOCUS = 0x00000008, // :focus pseudo-class in CSS + STATE_VISITED = 0x00000010, // :visited pseudo-class in CSS + STATE_CURRENT = 0x00000020, // :current, current (hot) item + STATE_CHECKED = 0x00000040, // :checked, element is checked (or selected) + STATE_DISABLED = 0x00000080, // :disabled, element is disabled + STATE_READONLY = 0x00000100, // :read-only, readonly input element + STATE_EXPANDED = 0x00000200, // :expanded, expanded state - nodes in tree view + STATE_COLLAPSED = 0x00000400, // :collapsed, collapsed state - nodes in tree view - mutually exclusive with + STATE_INCOMPLETE = 0x00000800, // :incomplete, fore (content) image was requested but not delivered + STATE_ANIMATING = 0x00001000, // :animating, is animating currently + STATE_FOCUSABLE = 0x00002000, // :focusable, will accept focus + STATE_ANCHOR = 0x00004000, // :anchor, anchor in selection (used with current in selects) + STATE_SYNTHETIC = 0x00008000, // :synthetic, this is a synthetic element - don't emit it's head/tail + STATE_OWNS_POPUP = 0x00010000, // :owns-popup, has visible popup element (tooltip, menu, etc.) + STATE_TABFOCUS = 0x00020000, // :tab-focus, focus gained by tab traversal + STATE_EMPTY = 0x00040000, // :empty, empty - element is empty (text.size() == 0 && subs.size() == 0) // if element has behavior attached then the behavior is responsible for the value of this flag. - STATE_BUSY = 0x00080000, // busy; loading + STATE_BUSY = 0x00080000, // :busy, busy doing something (e.g. loading data) STATE_DRAG_OVER = 0x00100000, // drag over the block that can accept it (so is current drop target). Flag is set for the drop target block STATE_DROP_TARGET = 0x00200000, // active drop target. @@ -591,7 +591,7 @@ enum ELEMENT_STATE_BITS STATE_PRESSED = 0x04000000, // pressed - close to active but has wider life span - e.g. in MOUSE_UP it // is still on; so behavior can check it in MOUSE_UP to discover CLICK condition. - STATE_POPUP = 0x08000000, // this element is out of flow - popup + STATE_POPUP = 0x08000000, // :popup, this element is out of flow - shown as popup STATE_IS_LTR = 0x10000000, // the element or one of its containers has dir=ltr declared STATE_IS_RTL = 0x20000000, // the element or one of its containers has dir=rtl declared @@ -604,7 +604,7 @@ SCDOM_RESULT SCAPI SciterGetElementState( HELEMENT he, UINT* pstateBits); /** **/ -SCDOM_RESULT SCAPI SciterSetElementState( HELEMENT he, UINT stateBitsToSet, UINT stateBitsToClear, BOOL updateView); +SCDOM_RESULT SCAPI SciterSetElementState( HELEMENT he, UINT stateBitsToSet, UINT stateBitsToClear, SBOOL updateView); /** Create new element, the element is disconnected initially from the DOM. Element created with ref_count = 1 thus you \b must call Sciter_UnuseElement on returned handler. @@ -675,12 +675,12 @@ SCDOM_RESULT SCAPI SciterWindowDetachEventHandler( HWINDOW hwndLayout, LPELEMENT * \param[in] appEventCode \b UINT, event ID, see: #BEHAVIOR_EVENTS * \param[in] heSource \b HELEMENT, optional handle of the source element, e.g. some list item * \param[in] reason \b UINT, notification specific event reason code - * \param[out] handled \b BOOL*, variable to receive TRUE if any handler handled it, FALSE otherwise. + * \param[out] handled \b SBOOL*, variable to receive TRUE if any handler handled it, FALSE otherwise. **/ SCDOM_RESULT SCAPI SciterSendEvent( - HELEMENT he, UINT appEventCode, HELEMENT heSource, UINT_PTR reason, /*out*/ BOOL* handled); + HELEMENT he, UINT appEventCode, HELEMENT heSource, UINT_PTR reason, /*out*/ SBOOL* handled); /** SciterPostEvent - post sinking/bubbling event to the child/parent chain of he element. * Function will return immediately posting event into input queue of the application. @@ -700,12 +700,12 @@ SCDOM_RESULT SCAPI SciterPostEvent( HELEMENT he, UINT appEventCode, HELEMENT heS Then from element to its root on parents chain without SINKING flag (bubbling phase). * \param[in] evt \b BEHAVIOR_EVENT_PARAMS, pointer to event param block - * \param[in] post \b BOOL, \c TRUE to post event asynchronously, \c FALSE otherwise - * \param[out] handled \b BOOL*, variable to receive TRUE if any handler handled it, FALSE otherwise. + * \param[in] post \b SBOOL, \c TRUE to post event asynchronously, \c FALSE otherwise + * \param[out] handled \b SBOOL*, variable to receive TRUE if any handler handled it, FALSE otherwise. **/ -SCDOM_RESULT SCAPI SciterFireEvent( const struct BEHAVIOR_EVENT_PARAMS* evt, BOOL post, BOOL *handled); +SCDOM_RESULT SCAPI SciterFireEvent( const struct BEHAVIOR_EVENT_PARAMS* evt, SBOOL post, SBOOL *handled); /** SciterCallMethod - calls behavior specific method. * \param[in] he \b HELEMENT, element - source of the event. @@ -768,11 +768,11 @@ SCDOM_RESULT SCAPI SciterGetScrollInfo( /** SciterSetScrollPos - set scroll position of element with overflow:scroll or auto. * \param[in] he \b HELEMENT, element. * \param[in] scrollPos \b POINT, new scroll position. - * \param[in] smooth \b BOOL, TRUE - do smooth scroll. + * \param[in] smooth \b SBOOL, TRUE - do smooth scroll. **/ SCDOM_RESULT SCAPI SciterSetScrollPos( - HELEMENT he, POINT scrollPos, BOOL smooth ); + HELEMENT he, POINT scrollPos, SBOOL smooth ); /** SciterGetElementIntrinsicWidths - get min-intrinsic and max-intrinsic widths of the element. * \param[in] he \b HELEMENT, element. @@ -794,7 +794,7 @@ SCDOM_RESULT SCAPI SciterGetElementIntrinsicHeight( HELEMENT he, INT forWidth, I * \param[out] pVisible \b LPBOOL, visibility state. **/ -SCDOM_RESULT SCAPI SciterIsElementVisible( HELEMENT he, BOOL* pVisible); +SCDOM_RESULT SCAPI SciterIsElementVisible( HELEMENT he, SBOOL* pVisible); /** SciterIsElementEnabled - deep enable state, determines if element enabled - is not disabled by itself or no one of its parents is disabled. @@ -802,7 +802,7 @@ SCDOM_RESULT SCAPI SciterIsElementVisible( HELEMENT he, BOOL* pVisible); * \param[out] pEnabled \b LPBOOL, enabled state. **/ -SCDOM_RESULT SCAPI SciterIsElementEnabled( HELEMENT he, BOOL* pEnabled ); +SCDOM_RESULT SCAPI SciterIsElementEnabled( HELEMENT he, SBOOL* pEnabled ); /**Callback comparator function used with #SciterSortElements(). Shall return -1,0,+1 values to indicate result of comparison of two elements @@ -834,11 +834,11 @@ SCDOM_RESULT SCAPI SciterSwapElements( /** SciterTraverseUIEvent - traverse (sink-and-bubble) MOUSE or KEY event. * \param[in] evt \b EVENT_GROUPS, either HANDLE_MOUSE or HANDLE_KEY code. * \param[in] eventCtlStruct \b LPVOID, pointer on either MOUSE_PARAMS or KEY_PARAMS structure. - * \param[out] bOutProcessed \b LPBOOL, pointer to BOOL receiving TRUE if event was processed by some element and FALSE otherwise. + * \param[out] bOutProcessed \b LPBOOL, pointer to SBOOL receiving TRUE if event was processed by some element and FALSE otherwise. **/ SCDOM_RESULT SCAPI SciterTraverseUIEvent( - UINT evt, LPVOID eventCtlStruct, BOOL* bOutProcessed ); + UINT evt, LPVOID eventCtlStruct, SBOOL* bOutProcessed ); /** CallScriptingMethod - calls scripting method defined for the element. * \param[in] he \b HELEMENT, element which method will be callled. @@ -879,7 +879,7 @@ SCDOM_RESULT SCAPI SciterAttachHwndToElement(HELEMENT he, HWINDOW hwnd); enum CTL_TYPE { CTL_NO = 0, ///< This dom element has no behavior at all. - CTL_UNKNOWN = 1, ///< This dom element has behavior but its type is unknown. + CTL_UNKNOWN = 1, ///< This dom element has behavior but its type is unknown. CTL_EDIT = 2, ///< Single line edit box. CTL_NUMERIC = 3, ///< Numeric input with optional spin buttons. @@ -894,7 +894,7 @@ enum CTL_TYPE CTL_HTMLAREA = 12, ///< HTML selection behavior. CTL_PASSWORD = 13, ///< Password input element. CTL_PROGRESS = 14, ///< Progress element. - CTL_SLIDER = 15, ///< Slider input element. + CTL_SLIDER = 15, ///< Slider input element. CTL_DECIMAL = 16, ///< Decimal number input element. CTL_CURRENCY = 17, ///< Currency input element. CTL_SCROLLBAR = 18, @@ -927,7 +927,7 @@ enum CTL_TYPE CTL_WINDOW = 37, ///< has HWND attached to it CTL_LABEL = 38, - CTL_IMAGE = 39, ///< image/video object. + CTL_IMAGE = 39, ///< image/video object. CTL_PLAINTEXT = 40, ///< Multiline TextBox + colorizer. }; @@ -958,22 +958,22 @@ SCDOM_RESULT SCAPI SciterSetValue( HELEMENT he, const VALUE* pval ); * that is assigned to the DOM element. 'expando' could be null as they are created on demand by script. * \param[in] he \b HELEMENT, element which expando will be retrieved. * \param[out] pval \b VALUE*, pointer to VALUE that will get value of type T_OBJECT/UT_OBJECT_NATIVE or null. - * \param[in] forceCreation \b BOOL, if there is no expando then when forceCreation==TRUE the function will create it. + * \param[in] forceCreation \b SBOOL, if there is no expando then when forceCreation==TRUE the function will create it. * ATTN: if you are not using json::value wrapper then you shall call ValueClear aginst the returned value * otherwise it will leak memory. **/ -SCDOM_RESULT SCAPI SciterGetExpando( HELEMENT he, VALUE* pval, BOOL forceCreation ); +SCDOM_RESULT SCAPI SciterGetExpando( HELEMENT he, VALUE* pval, SBOOL forceCreation ); /** SciterGetObject - get 'expando' object of the element. 'expando' is a scripting object (of class Element) * that is assigned to the DOM element. 'expando' could be null as they are created on demand by script. * \param[in] he \b HELEMENT, element which expando will be retrieved. * \param[out] pval \b tiscript::value*, pointer to tiscript::value that will get reference to the scripting object associated wuth the element or null. - * \param[in] forceCreation \b BOOL, if there is no expando then when forceCreation==TRUE the function will create it. + * \param[in] forceCreation \b SBOOL, if there is no expando then when forceCreation==TRUE the function will create it. * * ATTN!: if you plan to store the reference or use it inside code that calls script VM functions * then you should use tiscript::pinned holder for the value. **/ -SCDOM_RESULT SCAPI SciterGetObject( HELEMENT he, tiscript_value* pval, BOOL forceCreation ); +SCDOM_RESULT SCAPI SciterGetObject( HELEMENT he, void* pval, SBOOL forceCreation ); /** SciterGetElementNamespace - get namespace of document of the DOM element. * \param[in] he \b HELEMENT, element which expando will be retrieved. @@ -983,7 +983,7 @@ SCDOM_RESULT SCAPI SciterGetObject( HELEMENT he, tiscript_value* pval, BOOL forc * then you should use tiscript::pinned holder for the value. **/ -SCDOM_RESULT SCAPI SciterGetElementNamespace( HELEMENT he, tiscript_value* pval); +SCDOM_RESULT SCAPI SciterGetElementNamespace( HELEMENT he, void* pval); // get/set highlighted element. Used for debugging purposes. SCDOM_RESULT SCAPI SciterGetHighlightedElement(HWINDOW hwnd, HELEMENT* phe); @@ -1034,7 +1034,7 @@ enum NODE_INS_TARGET SCDOM_RESULT SCAPI SciterNodeInsert(HNODE hnode, UINT where /*NODE_INS_TARGET*/, HNODE what); // remove the node from the DOM, use finalize=FALSE if you plan to attach the node to the DOM later. -SCDOM_RESULT SCAPI SciterNodeRemove(HNODE hnode, BOOL finalize); +SCDOM_RESULT SCAPI SciterNodeRemove(HNODE hnode, SBOOL finalize); // ATTENTION: node handles returned by these two functions are AddRef'ed SCDOM_RESULT SCAPI SciterCreateTextNode(LPCWSTR text, UINT textLength, HNODE* phnode); diff --git a/include/sciter-x-graphics.h b/include/sciter-x-graphics.h index ddc5d61..4f29f49 100644 --- a/include/sciter-x-graphics.h +++ b/include/sciter-x-graphics.h @@ -55,7 +55,7 @@ typedef struct SC_COLOR_STOP { SC_COLOR color; float offset; // 0.0 ... 1.0 -}SC_COLOR_STOP; +} SC_COLOR_STOP; typedef enum GRAPHIN_RESULT { @@ -64,14 +64,14 @@ typedef enum GRAPHIN_RESULT GRAPHIN_BAD_PARAM = 1, // bad parameter GRAPHIN_FAILURE = 2, // operation failed, e.g. restore() without save() GRAPHIN_NOTSUPPORTED = 3 // the platform does not support requested feature -}GRAPHIN_RESULT; +} GRAPHIN_RESULT; typedef enum DRAW_PATH_MODE { DRAW_FILL_ONLY = 1, DRAW_STROKE_ONLY = 2, DRAW_FILL_AND_STROKE = 3, -}DRAW_PATH_MODE; +} DRAW_PATH_MODE; typedef enum SCITER_LINE_JOIN_TYPE { @@ -79,14 +79,14 @@ typedef enum SCITER_LINE_JOIN_TYPE SCITER_JOIN_ROUND = 1, SCITER_JOIN_BEVEL = 2, SCITER_JOIN_MITER_OR_BEVEL = 3, -}SCITER_LINE_JOIN_TYPE; +} SCITER_LINE_JOIN_TYPE; typedef enum SCITER_LINE_CAP_TYPE { SCITER_LINE_CAP_BUTT = 0, SCITER_LINE_CAP_SQUARE = 1, SCITER_LINE_CAP_ROUND = 2, -}SCITER_LINE_CAP_TYPE; +} SCITER_LINE_CAP_TYPE; /*typedef enum SCITER_TEXT_ALIGNMENT { @@ -94,7 +94,7 @@ typedef enum SCITER_LINE_CAP_TYPE TEXT_ALIGN_START, TEXT_ALIGN_END, TEXT_ALIGN_CENTER, -}SCITER_TEXT_ALIGNMENT; +} SCITER_TEXT_ALIGNMENT; typedef enum SCITER_TEXT_DIRECTION { @@ -116,7 +116,7 @@ typedef enum SCITER_IMAGE_ENCODING { LPWSTR fontFamily; UINT fontWeight; // 100...900, 400 - normal, 700 - bold - BOOL fontItalic; + SBOOL fontItalic; float fontSize; // dips float lineHeight; // dips SCITER_TEXT_DIRECTION textDirection; @@ -126,7 +126,7 @@ typedef enum SCITER_IMAGE_ENCODING } SCITER_TEXT_FORMAT; */ // imageSave callback: -typedef BOOL SCAPI image_write_function(LPVOID prm, const BYTE* data, UINT data_length); +typedef SBOOL SCAPI image_write_function(LPVOID prm, const BYTE* data, UINT data_length); // imagePaint callback: typedef VOID SCAPI image_paint_function(LPVOID prm, HGFX hgfx, UINT width, UINT height); @@ -134,12 +134,12 @@ struct SciterGraphicsAPI { // image primitives GRAPHIN_RESULT - SCFN(imageCreate)( HIMG* poutImg, UINT width, UINT height, BOOL withAlpha ); + SCFN(imageCreate)( HIMG* poutImg, UINT width, UINT height, SBOOL withAlpha ); // construct image from B[n+0],G[n+1],R[n+2],A[n+3] data. // Size of pixmap data is pixmapWidth*pixmapHeight*4 GRAPHIN_RESULT - SCFN(imageCreateFromPixmap)( HIMG* poutImg, UINT pixmapWidth, UINT pixmapHeight, BOOL withAlpha, const BYTE* pixmap ); + SCFN(imageCreateFromPixmap)( HIMG* poutImg, UINT pixmapWidth, UINT pixmapHeight, SBOOL withAlpha, const BYTE* pixmap ); GRAPHIN_RESULT SCFN(imageAddRef)( HIMG himg ); @@ -151,7 +151,7 @@ struct SciterGraphicsAPI SCFN(imageGetInfo)( HIMG himg, UINT* width, UINT* height, - BOOL* usesAlpha ); + SBOOL* usesAlpha ); //GRAPHIN_RESULT // SCFN(imageGetPixels)( HIMG himg, @@ -169,7 +169,7 @@ struct SciterGraphicsAPI image_write_function* pfn, void* prm, /* function and its param passed "as is" */ UINT encoding, // SCITER_IMAGE_ENCODING UINT quality /* if webp or jpeg:, 10 - 100 */ ); - + // SECTION: graphics primitives and drawing operations // create SC_COLOR value @@ -229,19 +229,19 @@ struct SciterGraphicsAPI SCFN(pathRelease) ( HPATH path ); GRAPHIN_RESULT - SCFN(pathMoveTo) ( HPATH path, SC_POS x, SC_POS y, BOOL relative ); + SCFN(pathMoveTo) ( HPATH path, SC_POS x, SC_POS y, SBOOL relative ); GRAPHIN_RESULT - SCFN(pathLineTo) ( HPATH path, SC_POS x, SC_POS y, BOOL relative ); + SCFN(pathLineTo) ( HPATH path, SC_POS x, SC_POS y, SBOOL relative ); GRAPHIN_RESULT - SCFN(pathArcTo) ( HPATH path, SC_POS x, SC_POS y, SC_ANGLE angle, SC_DIM rx, SC_DIM ry, BOOL is_large_arc, BOOL clockwise, BOOL relative ); + SCFN(pathArcTo) ( HPATH path, SC_POS x, SC_POS y, SC_ANGLE angle, SC_DIM rx, SC_DIM ry, SBOOL is_large_arc, SBOOL clockwise, SBOOL relative ); GRAPHIN_RESULT - SCFN(pathQuadraticCurveTo) ( HPATH path, SC_POS xc, SC_POS yc, SC_POS x, SC_POS y, BOOL relative ); + SCFN(pathQuadraticCurveTo) ( HPATH path, SC_POS xc, SC_POS yc, SC_POS x, SC_POS y, SBOOL relative ); GRAPHIN_RESULT - SCFN(pathBezierCurveTo) ( HPATH path, SC_POS xc1, SC_POS yc1, SC_POS xc2, SC_POS yc2, SC_POS x, SC_POS y, BOOL relative ); + SCFN(pathBezierCurveTo) ( HPATH path, SC_POS xc1, SC_POS yc1, SC_POS xc2, SC_POS yc2, SC_POS x, SC_POS y, SBOOL relative ); GRAPHIN_RESULT SCFN(pathClosePath) ( HPATH path ); @@ -324,7 +324,7 @@ struct SciterGraphicsAPI SCFN(gFillGradientRadial)( HGFX hgfx, SC_POS x, SC_POS y, SC_DIM rx, SC_DIM ry, const SC_COLOR_STOP* stops, UINT nstops ); GRAPHIN_RESULT - SCFN(gFillMode) ( HGFX hgfx, BOOL even_odd /* false - fill_non_zero */ ); + SCFN(gFillMode) ( HGFX hgfx, SBOOL even_odd /* false - fill_non_zero */ ); // SECTION: text @@ -382,7 +382,7 @@ struct SciterGraphicsAPI // pop clip layer previously set by gPushClipBox or gPushClipPath GRAPHIN_RESULT SCFN(gPopClip) ( HGFX hgfx); - + // image painter GRAPHIN_RESULT @@ -395,7 +395,7 @@ struct SciterGraphicsAPI GRAPHIN_RESULT SCFN(vWrapImage) ( HIMG himg, VALUE* toValue); - + GRAPHIN_RESULT SCFN(vWrapPath) ( HPATH hpath, VALUE* toValue); @@ -407,7 +407,7 @@ struct SciterGraphicsAPI GRAPHIN_RESULT SCFN(vUnWrapImage) ( const VALUE* fromValue, HIMG *phimg ); - + GRAPHIN_RESULT SCFN(vUnWrapPath) ( const VALUE* fromValue, HPATH *phpath); diff --git a/include/sciter-x-msg.h b/include/sciter-x-msg.h index 1304cad..0e0a37f 100644 --- a/include/sciter-x-msg.h +++ b/include/sciter-x-msg.h @@ -18,8 +18,6 @@ #include "sciter-x-types.h" #include "sciter-x-def.h" -#include "sciter-x-behavior.h" - /** #SCITER_X_MSG_CODE message/function identifier */ typedef enum SCITER_X_MSG_CODE { @@ -32,34 +30,34 @@ typedef enum SCITER_X_MSG_CODE { SXM_MOUSE = 6, SXM_KEY = 7, SXM_FOCUS = 8, -}SCITER_X_MSG_CODE; +} SCITER_X_MSG_CODE; /** #SCITER_X_MSG common header of message structures passed to SciterProcX */ typedef struct SCITER_X_MSG { - UINT msg; /**< [in] one of the codes of #SCITER_X_MSG_CODE.*/ + UINT msg; /**< [in] one of the codes of #SCITER_X_MSG_CODE.*/ #ifdef __cplusplus SCITER_X_MSG(UINT m) : msg(m) {} #endif -}SCITER_X_MSG; +} SCITER_X_MSG; typedef struct SCITER_X_MSG_CREATE { SCITER_X_MSG header; UINT backend; - BOOL transparent; + SBOOL transparent; #ifdef __cplusplus - SCITER_X_MSG_CREATE(UINT backendType = GFX_LAYER_SKIA_OPENGL, BOOL isTransparent = TRUE ) + SCITER_X_MSG_CREATE(UINT backendType = GFX_LAYER_SKIA_OPENGL, SBOOL isTransparent = TRUE ) : header(SXM_CREATE), backend(backendType), transparent(isTransparent) {} #endif -}SCITER_X_MSG_CREATE; +} SCITER_X_MSG_CREATE; typedef struct SCITER_X_MSG_DESTROY { SCITER_X_MSG header; #ifdef __cplusplus SCITER_X_MSG_DESTROY() : header(SXM_DESTROY) {} #endif -}SCITER_X_MSG_DESTROY; +} SCITER_X_MSG_DESTROY; typedef struct SCITER_X_MSG_SIZE { SCITER_X_MSG header; @@ -68,7 +66,7 @@ typedef struct SCITER_X_MSG_SIZE { #ifdef __cplusplus SCITER_X_MSG_SIZE(UINT w, UINT h) : header(SXM_SIZE), width(w), height(h) {} #endif -}SCITER_X_MSG_SIZE; +} SCITER_X_MSG_SIZE; typedef struct SCITER_X_MSG_RESOLUTION { SCITER_X_MSG header; @@ -101,9 +99,9 @@ typedef struct SCITER_X_MSG_KEY { typedef struct SCITER_X_MSG_FOCUS { SCITER_X_MSG header; - BOOL got; // true - got, false - lost + SBOOL got; // true - got, false - lost #ifdef __cplusplus - SCITER_X_MSG_FOCUS(BOOL g) : header(SXM_FOCUS), got(g) {} + SCITER_X_MSG_FOCUS(SBOOL g) : header(SXM_FOCUS), got(g) {} #endif } SCITER_X_MSG_FOCUS; @@ -131,18 +129,19 @@ typedef VOID SC_CALLBACK ELEMENT_BITMAP_RECEIVER(LPCBYTE rgba, INT x, INT y, UIN typedef enum SCITER_PAINT_TARGET_TYPE { SPT_DEFAULT = 0, /**< default rendering target - window surface */ SPT_RECEIVER = 1, /**< target::receiver fields are valid */ - SPT_DC = 2, /**< target::dc is valid */ - SPT_OPENGL = 3, /**< target is not used - caller shall set current context on its side */ - SPT_OPENGLES = 4, /**< target is not used - caller shall set current context on its side */ -}SCITER_PAINT_TARGET_TYPE; + SPT_SURFACE = 2, /**< target::pSurface is valid */ + //SPT_OPENGL = 3, /**< target is not used - caller shall set current context on its side */ + //SPT_OPENGLES = 4, /**< target is not used - caller shall set current context on its side */ + //SPT_ +} SCITER_PAINT_TARGET_TYPE; typedef struct SCITER_X_MSG_PAINT { SCITER_X_MSG header; HELEMENT element; /**< [in] layer #HELEMENT, can be NULL if whole tree (document) needs to be rendered.*/ - BOOL isFore; /**< [in] if element is not null tells if that element is fore-layer.*/ + SBOOL isFore; /**< [in] if element is not null tells if that element is fore-layer.*/ UINT targetType; /**< [in] one of #SCITER_PAINT_TARGET_TYPE values */ union { - HDC hdc; + LPVOID pSurface; /**< [in] must be IDXGISurface* */ struct { VOID* param; ELEMENT_BITMAP_RECEIVER* callback; @@ -150,8 +149,8 @@ typedef struct SCITER_X_MSG_PAINT { } target; #ifdef __cplusplus - SCITER_X_MSG_PAINT(HELEMENT layerElement = NULL, BOOL foreLayer = TRUE) : header(SXM_PAINT), element(layerElement), isFore(foreLayer), targetType(SPT_DEFAULT) {} + SCITER_X_MSG_PAINT(HELEMENT layerElement = NULL, SBOOL foreLayer = TRUE) : header(SXM_PAINT), element(layerElement), isFore(foreLayer), targetType(SPT_DEFAULT) {} #endif -}SCITER_X_MSG_PAINT; +} SCITER_X_MSG_PAINT; #endif diff --git a/include/sciter-x-types.h b/include/sciter-x-types.h index 4e91794..a064ad3 100644 --- a/include/sciter-x-types.h +++ b/include/sciter-x-types.h @@ -31,7 +31,7 @@ typedef uint16_t char16_t; typedef uint32_t char32_t; - + #endif enum GFX_LAYER @@ -48,6 +48,13 @@ enum GFX_LAYER #define WINDOWLESS #endif +#ifndef SBOOL + typedef int SBOOL; +#endif +#ifndef TRUE + #define TRUE (1) + #define FALSE (0) +#endif #if defined(_WIN32) || defined(_WIN64) @@ -73,7 +80,7 @@ enum GFX_LAYER #endif #elif defined(__linux__) #ifndef LINUX - #define LINUX + #define LINUX #endif #else #error "This platform is not supported yet" @@ -88,15 +95,14 @@ enum GFX_LAYER #if defined(_MSC_VER) && _MSC_VER < 1900 // Microsoft has finally implemented snprintf in Visual Studio 2015. - # define snprintf _snprintf_s - # define vsnprintf vsnprintf_s - #endif - - #if __STDC_WANT_SECURE_LIB__ - // use the safe version of `wcsncpy` if wanted - # define wcsncpy wcsncpy_s + #define snprintf _snprintf_s + #define vsnprintf vsnprintf_s #endif + //#if __STDC_WANT_SECURE_LIB__ + //// use the safe version of `wcsncpy` if wanted + // #define wcsncpy wcsncpy_s + //#endif #ifdef STATIC_LIB void SciterInit( bool start); @@ -107,8 +113,8 @@ enum GFX_LAYER #if defined(WINDOWLESS) #define HWINDOW LPVOID - #else - #define HWINDOW HWND + #else + #define HWINDOW HWND #endif #define SC_CALLBACK __stdcall @@ -128,13 +134,6 @@ enum GFX_LAYER //#ifdef __OBJC__ // #define char16_t uint16_t //#endif - #ifndef BOOL - typedef signed char BOOL; - #endif - #ifndef TRUE - #define TRUE (1) - #define FALSE (0) - #endif typedef unsigned int UINT; typedef int INT; @@ -182,25 +181,11 @@ enum GFX_LAYER #define HWINDOW LPVOID // NSView* #define HINSTANCE LPVOID // NSApplication* - #define HDC void* // CGContextRef + #define HDC void* // CGContextRef #define LRESULT long - #ifdef __LP64__ - #define TARGET_64 - #if defined(WINDOWLESS) - #define SCITER_DLL_NAME "sciter-lite-64.dylib" - #else - #define SCITER_DLL_NAME "libsciter.dylib" - #endif - #else - #define TARGET_32 - #if defined(WINDOWLESS) - #define SCITER_DLL_NAME "sciter-lite-32.dylib" - #else - #define SCITER_DLL_NAME "libsciter.dylib" - #endif - #endif + #define SCITER_DLL_NAME "libsciter.dylib" #elif defined(LINUX) @@ -210,13 +195,6 @@ enum GFX_LAYER #include #include -#ifndef BOOL - typedef signed char BOOL; - #endif - #ifndef TRUE - #define TRUE (1) - #define FALSE (0) - #endif typedef unsigned int UINT; typedef int INT; typedef unsigned int UINT32; @@ -261,11 +239,11 @@ enum GFX_LAYER } SIZE, *PSIZE, *LPSIZE; #if defined(WINDOWLESS) - #define HWINDOW void * -#else + #define HWINDOW void * +#else #define HWINDOW GtkWidget* // #endif - + #define HINSTANCE LPVOID // #define LRESULT long #define HDC LPVOID // cairo_t @@ -288,11 +266,11 @@ enum GFX_LAYER #define WINDOWLESS - #include + //#include #include - #ifndef BOOL - typedef signed char BOOL; + #ifndef SBOOL + typedef signed int SBOOL; #endif #ifndef TRUE #define TRUE (1) @@ -380,7 +358,6 @@ typedef VOID SC_CALLBACK LPCSTR_RECEIVER( LPCSTR str, UINT str_length, LPVOID pa typedef VOID SC_CALLBACK LPCBYTE_RECEIVER( LPCBYTE str, UINT num_bytes, LPVOID param ); #define STDCALL __stdcall - #define HWINDOW_PTR HWINDOW* #ifdef __cplusplus @@ -390,7 +367,7 @@ typedef VOID SC_CALLBACK LPCBYTE_RECEIVER( LPCBYTE str, UINT num_bytes, LPVOID p namespace std { typedef basic_string ustring; } - + // Note: quote here is a string literal! #ifdef WINDOWS #define _WSTR(quote) L##quote @@ -415,7 +392,7 @@ typedef VOID SC_CALLBACK LPCBYTE_RECEIVER( LPCBYTE str, UINT num_bytes, LPVOID p std::string* s = (std::string*)param; *s = std::string(str, str_length); } - + #else #define EXTERN_C extern #endif /* __cplusplus **/ diff --git a/include/sciter-x-value.h b/include/sciter-x-value.h index fb44381..079ac97 100644 --- a/include/sciter-x-value.h +++ b/include/sciter-x-value.h @@ -1,10 +1,10 @@ /* * The Sciter Engine of Terra Informatica Software, Inc. * http://sciter.com - * + * * The code and information provided "as-is" without * warranty of any kind, either expressed or implied. - * + * * (C) 2003-2015, Terra Informatica Software, Inc. */ @@ -28,7 +28,5 @@ #else typedef VALUE SCITER_VALUE; #endif - - typedef void SCAPI SciterLibraryInitFunc(SCITER_VALUE* plibobject); - + #endif diff --git a/include/sciter-x.h b/include/sciter-x.h index dba554f..bef9334 100644 --- a/include/sciter-x.h +++ b/include/sciter-x.h @@ -1,24 +1,26 @@ -/* - * The Sciter Engine of Terra Informatica Software, Inc. - * http://sciter.com - * - * The code and information provided "as-is" without - * warranty of any kind, either expressed or implied. - * - * - * (C) 2003-2015, Terra Informatica Software, Inc. - */ - -/* - * Sciter main include file - */ - - +/* + * The Sciter Engine of Terra Informatica Software, Inc. + * http://sciter.com + * + * The code and information provided "as-is" without + * warranty of any kind, either expressed or implied. + * + * + * (C) 2003-2015, Terra Informatica Software, Inc. + */ + +/* + * Sciter main include file + */ + + #ifndef __SCITER_X__ #define __SCITER_X__ #if __cplusplus > 199711L -#define CPP11 + #define CPP11 +#elif _MSC_VER >= 1600 + #define CPP11 #endif #include "sciter-x-types.h" @@ -26,17 +28,34 @@ #include "sciter-x-dom.h" #include "sciter-x-value.h" #include "sciter-x-api.h" -#include "sciter-x-msg.h" +#include "sciter-x-msg.h" #include "sciter-om.h" #if defined(__cplusplus) && !defined( PLAIN_API_ONLY ) - -// C++, namespace sciter things -#include "sciter-x-dom.hpp" -#include "sciter-x-host-callback.h" -#include "sciter-x-debug.h" -//#include "sciter-x-threads.h" + // C++, namespace sciter things + #include "sciter-x-dom.hpp" + #include "sciter-x-host-callback.h" + #include "sciter-x-debug.h" #endif +/** Signatire of Sciter extension library entry point + * \param psapi #ISciterAPI - Sciter API to be used inside the DLL. + * \param plibobject #SCITER_VALUE* - value to initialize, can be native functor, sciter::om::asset, array, map, etc. + * \return TRUE, if it populates plibobject; + * + * The DLL should have function exported with the name "SciterLibraryInit" and wit this signature. + * In script such sciter extension library can be imported as: + * + * include library "name-without-extension"; + * + **/ + +typedef SBOOL SCAPI SciterLibraryInitFunc(ISciterAPI* psapi, SCITER_VALUE* plibobject); + + + + #endif + + diff --git a/include/value.h b/include/value.h index 14009fd..9fe66e7 100644 --- a/include/value.h +++ b/include/value.h @@ -36,8 +36,8 @@ enum VALUE_TYPE T_FUNCTION = 11, // named tuple , like array but with name tag T_BYTES = 12, // sequence of bytes - e.g. image data T_OBJECT = 13, // scripting object proxy (TISCRIPT/SCITER) - T_DOM_OBJECT = 14, // DOM object, use get_object_data to get HELEMENT - //T_RESOURCE = 15, // 15 - other thing derived from tool::resource + //T_DOM_OBJECT = 14, // DOM object, use get_object_data to get HELEMENT + T_RESOURCE = 15, // 15 - other thing derived from tool::resource //T_RANGE = 16, // 16 - N..M, integer range. T_DURATION = 17, // double, seconds T_ANGLE = 18, // double, radians @@ -49,20 +49,20 @@ enum VALUE_TYPE enum VALUE_UNIT_TYPE { - UT_EM = 1, //height of the element's font. - UT_EX = 2, //height of letter 'x' + UT_EM = 1, //height of the element's font. + UT_EX = 2, //height of letter 'x' UT_PR = 3, //% UT_SP = 4, //%% "springs", a.k.a. flex units - reserved1 = 5, - reserved2 = 6, + reserved1 = 5, + reserved2 = 6, UT_PX = 7, //pixels - UT_IN = 8, //inches (1 inch = 2.54 centimeters). - UT_CM = 9, //centimeters. - UT_MM = 10, //millimeters. - UT_PT = 11, //points (1 point = 1/72 inches). - UT_PC = 12, //picas (1 pica = 12 points). + UT_IN = 8, //inches (1 inch = 2.54 centimeters). + UT_CM = 9, //centimeters. + UT_MM = 10, //millimeters. + UT_PT = 11, //points (1 point = 1/72 inches). + UT_PC = 12, //picas (1 pica = 12 points). UT_DIP = 13, - reserved3 = 14, + reserved3 = 14, reserved4 = 15, UT_URL = 16, // url in string }; @@ -94,7 +94,7 @@ enum VALUE_UNIT_UNDEFINED { enum VALUE_UNIT_TYPE_STRING { UT_STRING_STRING = 0, // string - UT_STRING_ERROR = 1, // is an error string + UT_STRING_ERROR = 1, // is an error string UT_STRING_SECURE = 2, // secure string ("wiped" on destroy) UT_STRING_SYMBOL = 0xffff, // symbol in tiscript sense }; @@ -128,7 +128,7 @@ UINT SCAPI ValueCopy( VALUE* pdst, const VALUE* psrc ); /** * ValueIsolate - converts T_OBJECT value types to T_MAP or T_ARRAY. * use this method if you need to pass values between different threads. - * The fanction is applicable for the Sciter + * The fanction is applicable for the Sciter */ UINT SCAPI ValueIsolate( VALUE* pdst ); @@ -139,13 +139,13 @@ UINT SCAPI ValueType( const VALUE* pval, UINT* pType, UINT* pUnits ); /** * ValueStringData - returns string data for T_STRING type - * For T_FUNCTION returns name of the fuction. + * For T_FUNCTION returns name of the fuction. */ UINT SCAPI ValueStringData( const VALUE* pval, LPCWSTR* pChars, UINT* pNumChars ); /** * ValueStringDataSet - sets VALUE to T_STRING type and copies chars/numChars to - * internal refcounted buffer assosiated with the value. + * internal refcounted buffer assosiated with the value. */ UINT SCAPI ValueStringDataSet( VALUE* pval, LPCWSTR chars, UINT numChars, UINT units ); @@ -155,7 +155,7 @@ UINT SCAPI ValueStringDataSet( VALUE* pval, LPCWSTR chars, UINT numChars, UINT u UINT SCAPI ValueIntData( const VALUE* pval, INT* pData ); /** - * ValueIntDataSet - sets VALUE integer data of T_INT and T_BOOL types + * ValueIntDataSet - sets VALUE integer data of T_INT and T_BOOL types * Optionally sets units field too. */ UINT SCAPI ValueIntDataSet( VALUE* pval, INT data, UINT type, UINT units ); @@ -186,7 +186,7 @@ UINT SCAPI ValueFloatDataSet( VALUE* pval, FLOAT_VALUE data, UINT type, UINT uni UINT SCAPI ValueBinaryData( const VALUE* pval, LPCBYTE* pBytes, UINT* pnBytes ); /** - * ValueBinaryDataSet - sets VALUE to sequence of bytes of type T_BYTES + * ValueBinaryDataSet - sets VALUE to sequence of bytes of type T_BYTES * 'type' here must be set to T_BYTES. Optionally sets units field too. * The function creates local copy of bytes in its own storage. */ @@ -194,7 +194,7 @@ UINT SCAPI ValueBinaryDataSet( VALUE* pval, LPCBYTE pBytes, UINT nBytes, UINT ty /** * ValueElementsCount - retreive number of sub-elements for: - * - T_ARRAY - number of elements in the array; + * - T_ARRAY - number of elements in the array; * - T_MAP - number of key/value pairs in the map; * - T_FUNCTION - number of arguments in the function; */ @@ -202,7 +202,7 @@ UINT SCAPI ValueElementsCount( const VALUE* pval, INT* pn); /** * ValueNthElementValue - retreive value of sub-element at index n for: - * - T_ARRAY - nth element of the array; + * - T_ARRAY - nth element of the array; * - T_MAP - value of nth key/value pair in the map; * - T_FUNCTION - value of nth argument of the function; */ @@ -210,10 +210,10 @@ UINT SCAPI ValueNthElementValue( const VALUE* pval, INT n, VALUE* pretval); /** * ValueNthElementValueSet - sets value of sub-element at index n for: - * - T_ARRAY - nth element of the array; + * - T_ARRAY - nth element of the array; * - T_MAP - value of nth key/value pair in the map; * - T_FUNCTION - value of nth argument of the function; - * If the VALUE is not of one of types above then it makes it of type T_ARRAY with + * If the VALUE is not of one of types above then it makes it of type T_ARRAY with * single element - 'val_to_set'. */ UINT SCAPI ValueNthElementValueSet( VALUE* pval, INT n, const VALUE* pval_to_set); @@ -221,7 +221,7 @@ UINT SCAPI ValueNthElementValueSet( VALUE* pval, INT n, const VALUE* pval_to_set /**Callback function used with #ValueEnumElements(). * return TRUE to continue enumeration */ -typedef BOOL SC_CALLBACK KeyValueCallback( LPVOID param, const VALUE* pkey, const VALUE* pval ); +typedef SBOOL SC_CALLBACK KeyValueCallback( LPVOID param, const VALUE* pkey, const VALUE* pval ); /** * ValueEnumElements - enumeartes key/value pairs of T_MAP, T_FUNCTION and T_OBJECT values @@ -230,14 +230,14 @@ typedef BOOL SC_CALLBACK KeyValueCallback( LPVOID param, const VALUE* pkey, cons */ UINT SCAPI ValueNthElementKey( const VALUE* pval, INT n, VALUE* pretval); -UINT SCAPI ValueEnumElements( const VALUE* pval, KeyValueCallback* penum, LPVOID param); +UINT SCAPI ValueEnumElements( const VALUE* pval, KeyValueCallback* penum, LPVOID param); /** * ValueSetValueToKey - sets value of sub-element by key: * - T_MAP - value of key/value pair with the key; * - T_FUNCTION - value of argument with the name key; * - T_OBJECT (tiscript) - value of property of the object - * If the VALUE is not of one of types above then it makes it of type T_MAP with + * If the VALUE is not of one of types above then it makes it of type T_MAP with * single pair - 'key'/'val_to_set'. * * key usually is a value of type T_STRING @@ -256,17 +256,17 @@ UINT SCAPI ValueGetValueOfKey( const VALUE* pval, const VALUE* pkey, VALUE* pret enum VALUE_STRING_CVT_TYPE { - CVT_SIMPLE, ///< simple conversion of terminal values - CVT_JSON_LITERAL, ///< json literal parsing/emission - CVT_JSON_MAP, ///< json parsing/emission, it parses as if token '{' already recognized + CVT_SIMPLE, ///< simple conversion of terminal values + CVT_JSON_LITERAL, ///< json literal parsing/emission + CVT_JSON_MAP, ///< json parsing/emission, it parses as if token '{' already recognized CVT_XJSON_LITERAL, ///< x-json parsing/emission, date is emitted as ISO8601 date literal, currency is emitted in the form DDDD$CCC - + }; /** * ValueToString - converts value to T_STRING inplace: * - CVT_SIMPLE - parse/emit terminal values (T_INT, T_FLOAT, T_LENGTH, T_STRING) - * - CVT_JSON_LITERAL - parse/emit value using JSON literal rules: {}, [], "string", true, false, null + * - CVT_JSON_LITERAL - parse/emit value using JSON literal rules: {}, [], "string", true, false, null * - CVT_JSON_MAP - parse/emit MAP value without enclosing '{' and '}' brackets. */ UINT SCAPI ValueToString( VALUE* pval, /*VALUE_STRING_CVT_TYPE*/ UINT how ); @@ -274,10 +274,10 @@ UINT SCAPI ValueToString( VALUE* pval, /*VALUE_STRING_CVT_TYPE*/ UINT how ); /** * ValueFromString - parses string into value: * - CVT_SIMPLE - parse/emit terminal values (T_INT, T_FLOAT, T_LENGTH, T_STRING), "guess" non-strict parsing - * - CVT_JSON_LITERAL - parse/emit value using JSON literal rules: {}, [], "string", true, false, null + * - CVT_JSON_LITERAL - parse/emit value using JSON literal rules: {}, [], "string", true, false, null * - CVT_JSON_MAP - parse/emit MAP value without enclosing '{' and '}' brackets. * Returns: - * Number of non-parsed characters in case of errors. Thus if string was parsed in full it returns 0 (success) + * Number of non-parsed characters in case of errors. Thus if string was parsed in full it returns 0 (success) */ UINT SCAPI ValueFromString( VALUE* pval, LPCWSTR str, UINT strLength, /*VALUE_STRING_CVT_TYPE*/ UINT how ); @@ -285,32 +285,32 @@ UINT SCAPI ValueFromString( VALUE* pval, LPCWSTR str, UINT strLength, /*VALUE_ST * ValueInvoke - function invocation (Sciter/TIScript). * - VALUE* pval is a value of type T_OBJECT/UT_OBJECT_FUNCTION * - VALUE* pthis - object that will be known as 'this' inside that function. - * - UINT argc, const VALUE* argv - vector of arguments to pass to the function. + * - UINT argc, const VALUE* argv - vector of arguments to pass to the function. * - VALUE* pretval - parse/emit MAP value without enclosing '{' and '}' brackets. * - LPCWSTR url - url or name of the script - used for error reporting in the script. * Returns: * HV_OK, HV_BAD_PARAMETER or HV_INCOMPATIBLE_TYPE */ -UINT SCAPI ValueInvoke( const VALUE* pval, VALUE* pthis, UINT argc, const VALUE* argv, VALUE* pretval, LPCWSTR url); +UINT SCAPI ValueInvoke( const VALUE* pval, VALUE* pthis, UINT argc, const VALUE* argv, VALUE* pretval, LPCWSTR url); /** * ValueNativeFunctorSet - set reference to native function - * - VALUE* pval - value to be initialized + * - VALUE* pval - value to be initialized * - NATIVE_FUNCTOR_INVOKE* pinvoke - reference to native functor implementation. * - NATIVE_FUNCTOR_RELEASE* prelease - reference to native functor dtor implementation. * - VOID* tag - optional tag, passed as it is to pinvoke and prelease * Returns: * HV_OK, HV_BAD_PARAMETER */ -UINT SCAPI ValueNativeFunctorSet( VALUE* pval, +UINT SCAPI ValueNativeFunctorSet( VALUE* pval, NATIVE_FUNCTOR_INVOKE* pinvoke, NATIVE_FUNCTOR_RELEASE* prelease /* = NULL*/, VOID* tag /* = NULL*/ ); -BOOL SCAPI ValueIsNativeFunctor( const VALUE* pval); +SBOOL SCAPI ValueIsNativeFunctor( const VALUE* pval); -#if defined(__cplusplus) && !defined(__value_hpp__) && !defined(PLAIN_API_ONLY) +#if defined(__cplusplus) && !defined(__value_hpp__) && !defined(PLAIN_API_ONLY) #include "value.hpp" diff --git a/request.c b/request.c index 657e2b4..9c886ec 100644 --- a/request.c +++ b/request.c @@ -2,31 +2,31 @@ extern LPSciterRequestAPI rapi(); -REQUEST_RESULT SCAPI RequestUse( HREQUEST rq ) { rapi()->RequestUse(rq); } -REQUEST_RESULT SCAPI RequestUnUse( HREQUEST rq ) { rapi()->RequestUnUse(rq); } -REQUEST_RESULT SCAPI RequestUrl( HREQUEST rq, LPCSTR_RECEIVER* rcv, LPVOID rcv_param ) { rapi()->RequestUrl(rq,rcv,rcv_param); } -REQUEST_RESULT SCAPI RequestContentUrl( HREQUEST rq, LPCSTR_RECEIVER* rcv, LPVOID rcv_param ) { rapi()->RequestContentUrl(rq,rcv,rcv_param); } -REQUEST_RESULT SCAPI RequestGetRequestType( HREQUEST rq, REQUEST_RQ_TYPE* pType ) { rapi()->RequestGetRequestType(rq,pType); } -REQUEST_RESULT SCAPI RequestGetRequestedDataType( HREQUEST rq, SciterResourceType* pData ) { rapi()->RequestGetRequestedDataType(rq,pData); } -REQUEST_RESULT SCAPI RequestGetReceivedDataType( HREQUEST rq, LPCSTR_RECEIVER* rcv, LPVOID rcv_param ) { rapi()->RequestGetReceivedDataType(rq,rcv,rcv_param); } -REQUEST_RESULT SCAPI RequestGetNumberOfParameters( HREQUEST rq, UINT* pNumber ) { rapi()->RequestGetNumberOfParameters(rq,pNumber); } -REQUEST_RESULT SCAPI RequestGetNthParameterName( HREQUEST rq, UINT n, LPCWSTR_RECEIVER* rcv, LPVOID rcv_param ) { rapi()->RequestGetNthParameterName(rq,n,rcv,rcv_param); } -REQUEST_RESULT SCAPI RequestGetNthParameterValue( HREQUEST rq, UINT n, LPCWSTR_RECEIVER* rcv, LPVOID rcv_param ) { rapi()->RequestGetNthParameterValue(rq,n,rcv,rcv_param); } -REQUEST_RESULT SCAPI RequestGetTimes( HREQUEST rq, UINT* pStarted, UINT* pEnded ) { rapi()->RequestGetTimes(rq,pStarted,pEnded); } -REQUEST_RESULT SCAPI RequestGetNumberOfRqHeaders( HREQUEST rq, UINT* pNumber ) { rapi()->RequestGetNumberOfRqHeaders(rq,pNumber); } -REQUEST_RESULT SCAPI RequestGetNthRqHeaderName( HREQUEST rq, UINT n, LPCWSTR_RECEIVER* rcv, LPVOID rcv_param ) { rapi()->RequestGetNthRqHeaderName(rq,n,rcv,rcv_param); } -REQUEST_RESULT SCAPI RequestGetNthRqHeaderValue( HREQUEST rq, UINT n, LPCWSTR_RECEIVER* rcv, LPVOID rcv_param ) { rapi()->RequestGetNthRqHeaderValue(rq,n,rcv,rcv_param); } -REQUEST_RESULT SCAPI RequestGetNumberOfRspHeaders( HREQUEST rq, UINT* pNumber ) { rapi()->RequestGetNumberOfRspHeaders(rq,pNumber); } -REQUEST_RESULT SCAPI RequestGetNthRspHeaderName( HREQUEST rq, UINT n, LPCWSTR_RECEIVER* rcv, LPVOID rcv_param ) { rapi()->RequestGetNthRspHeaderName(rq,n,rcv,rcv_param); } -REQUEST_RESULT SCAPI RequestGetNthRspHeaderValue( HREQUEST rq, UINT n, LPCWSTR_RECEIVER* rcv, LPVOID rcv_param ) { rapi()->RequestGetNthRspHeaderValue(rq,n,rcv,rcv_param); } -REQUEST_RESULT SCAPI RequestGetCompletionStatus( HREQUEST rq, REQUEST_STATE* pState, UINT* pCompletionStatus ) { rapi()->RequestGetCompletionStatus(rq,pState,pCompletionStatus); } -REQUEST_RESULT SCAPI RequestGetProxyHost( HREQUEST rq, LPCSTR_RECEIVER* rcv, LPVOID rcv_param ) { rapi()->RequestGetProxyHost(rq,rcv,rcv_param); } -REQUEST_RESULT SCAPI RequestGetProxyPort( HREQUEST rq, UINT* pPort ) { rapi()->RequestGetProxyPort(rq,pPort); } -REQUEST_RESULT SCAPI RequestSetSucceeded( HREQUEST rq, UINT status, LPCBYTE dataOrNull, UINT dataLength) { rapi()->RequestSetSucceeded(rq,status,dataOrNull,dataLength); } -REQUEST_RESULT SCAPI RequestSetFailed( HREQUEST rq, UINT status, LPCBYTE dataOrNull, UINT dataLength ) { rapi()->RequestSetFailed(rq,status,dataOrNull,dataLength); } -REQUEST_RESULT SCAPI RequestAppendDataChunk( HREQUEST rq, LPCBYTE data, UINT dataLength ) { rapi()->RequestAppendDataChunk(rq,data,dataLength); } -REQUEST_RESULT SCAPI RequestSetRqHeader( HREQUEST rq, LPCWSTR name, LPCWSTR value ) { rapi()->RequestSetRqHeader(rq,name,value); } -REQUEST_RESULT SCAPI RequestSetRspHeader( HREQUEST rq, LPCWSTR name, LPCWSTR value ) { rapi()->RequestSetRspHeader(rq,name,value); } -REQUEST_RESULT SCAPI RequestSetReceivedDataType( HREQUEST rq, LPCSTR type ) { rapi()->RequestSetReceivedDataType(rq,type); } -REQUEST_RESULT SCAPI RequestSetReceivedDataEncoding( HREQUEST rq, LPCSTR encoding ) { rapi()->RequestSetReceivedDataEncoding(rq,encoding); } -REQUEST_RESULT SCAPI RequestGetData( HREQUEST rq, LPCBYTE_RECEIVER* rcv, LPVOID rcv_param ) { rapi()->RequestGetData(rq,rcv,rcv_param); } +REQUEST_RESULT SCAPI RequestUse( HREQUEST rq ) { return rapi()->RequestUse(rq); } +REQUEST_RESULT SCAPI RequestUnUse( HREQUEST rq ) { return rapi()->RequestUnUse(rq); } +REQUEST_RESULT SCAPI RequestUrl( HREQUEST rq, LPCSTR_RECEIVER* rcv, LPVOID rcv_param ) { return rapi()->RequestUrl(rq,rcv,rcv_param); } +REQUEST_RESULT SCAPI RequestContentUrl( HREQUEST rq, LPCSTR_RECEIVER* rcv, LPVOID rcv_param ) { return rapi()->RequestContentUrl(rq,rcv,rcv_param); } +REQUEST_RESULT SCAPI RequestGetRequestType( HREQUEST rq, REQUEST_RQ_TYPE* pType ) { return rapi()->RequestGetRequestType(rq,pType); } +REQUEST_RESULT SCAPI RequestGetRequestedDataType( HREQUEST rq, SciterResourceType* pData ) { return rapi()->RequestGetRequestedDataType(rq,pData); } +REQUEST_RESULT SCAPI RequestGetReceivedDataType( HREQUEST rq, LPCSTR_RECEIVER* rcv, LPVOID rcv_param ) { return rapi()->RequestGetReceivedDataType(rq,rcv,rcv_param); } +REQUEST_RESULT SCAPI RequestGetNumberOfParameters( HREQUEST rq, UINT* pNumber ) { return rapi()->RequestGetNumberOfParameters(rq,pNumber); } +REQUEST_RESULT SCAPI RequestGetNthParameterName( HREQUEST rq, UINT n, LPCWSTR_RECEIVER* rcv, LPVOID rcv_param ) { return rapi()->RequestGetNthParameterName(rq,n,rcv,rcv_param); } +REQUEST_RESULT SCAPI RequestGetNthParameterValue( HREQUEST rq, UINT n, LPCWSTR_RECEIVER* rcv, LPVOID rcv_param ) { return rapi()->RequestGetNthParameterValue(rq,n,rcv,rcv_param); } +REQUEST_RESULT SCAPI RequestGetTimes( HREQUEST rq, UINT* pStarted, UINT* pEnded ) { return rapi()->RequestGetTimes(rq,pStarted,pEnded); } +REQUEST_RESULT SCAPI RequestGetNumberOfRqHeaders( HREQUEST rq, UINT* pNumber ) { return rapi()->RequestGetNumberOfRqHeaders(rq,pNumber); } +REQUEST_RESULT SCAPI RequestGetNthRqHeaderName( HREQUEST rq, UINT n, LPCWSTR_RECEIVER* rcv, LPVOID rcv_param ) { return rapi()->RequestGetNthRqHeaderName(rq,n,rcv,rcv_param); } +REQUEST_RESULT SCAPI RequestGetNthRqHeaderValue( HREQUEST rq, UINT n, LPCWSTR_RECEIVER* rcv, LPVOID rcv_param ) { return rapi()->RequestGetNthRqHeaderValue(rq,n,rcv,rcv_param); } +REQUEST_RESULT SCAPI RequestGetNumberOfRspHeaders( HREQUEST rq, UINT* pNumber ) { return rapi()->RequestGetNumberOfRspHeaders(rq,pNumber); } +REQUEST_RESULT SCAPI RequestGetNthRspHeaderName( HREQUEST rq, UINT n, LPCWSTR_RECEIVER* rcv, LPVOID rcv_param ) { return rapi()->RequestGetNthRspHeaderName(rq,n,rcv,rcv_param); } +REQUEST_RESULT SCAPI RequestGetNthRspHeaderValue( HREQUEST rq, UINT n, LPCWSTR_RECEIVER* rcv, LPVOID rcv_param ) { return rapi()->RequestGetNthRspHeaderValue(rq,n,rcv,rcv_param); } +REQUEST_RESULT SCAPI RequestGetCompletionStatus( HREQUEST rq, REQUEST_STATE* pState, UINT* pCompletionStatus ) { return rapi()->RequestGetCompletionStatus(rq,pState,pCompletionStatus); } +REQUEST_RESULT SCAPI RequestGetProxyHost( HREQUEST rq, LPCSTR_RECEIVER* rcv, LPVOID rcv_param ) { return rapi()->RequestGetProxyHost(rq,rcv,rcv_param); } +REQUEST_RESULT SCAPI RequestGetProxyPort( HREQUEST rq, UINT* pPort ) { return rapi()->RequestGetProxyPort(rq,pPort); } +REQUEST_RESULT SCAPI RequestSetSucceeded( HREQUEST rq, UINT status, LPCBYTE dataOrNull, UINT dataLength) { return rapi()->RequestSetSucceeded(rq,status,dataOrNull,dataLength); } +REQUEST_RESULT SCAPI RequestSetFailed( HREQUEST rq, UINT status, LPCBYTE dataOrNull, UINT dataLength ) { return rapi()->RequestSetFailed(rq,status,dataOrNull,dataLength); } +REQUEST_RESULT SCAPI RequestAppendDataChunk( HREQUEST rq, LPCBYTE data, UINT dataLength ) { return rapi()->RequestAppendDataChunk(rq,data,dataLength); } +REQUEST_RESULT SCAPI RequestSetRqHeader( HREQUEST rq, LPCWSTR name, LPCWSTR value ) { return rapi()->RequestSetRqHeader(rq,name,value); } +REQUEST_RESULT SCAPI RequestSetRspHeader( HREQUEST rq, LPCWSTR name, LPCWSTR value ) { return rapi()->RequestSetRspHeader(rq,name,value); } +REQUEST_RESULT SCAPI RequestSetReceivedDataType( HREQUEST rq, LPCSTR type ) { return rapi()->RequestSetReceivedDataType(rq,type); } +REQUEST_RESULT SCAPI RequestSetReceivedDataEncoding( HREQUEST rq, LPCSTR encoding ) { return rapi()->RequestSetReceivedDataEncoding(rq,encoding); } +REQUEST_RESULT SCAPI RequestGetData( HREQUEST rq, LPCBYTE_RECEIVER* rcv, LPVOID rcv_param ) { return rapi()->RequestGetData(rq,rcv,rcv_param); } diff --git a/sciter-x-api.c b/sciter-x-api.c index dd36cc8..bceb8c8 100644 --- a/sciter-x-api.c +++ b/sciter-x-api.c @@ -1,24 +1,24 @@ #include +#include + +typedef ISciterAPI* (SCAPI *SciterAPI_ptr)(); -// getting ISciterAPI reference: const char * SCITER_DLL_PATH = SCITER_DLL_NAME; -#ifdef STATIC_LIB +// getting ISciterAPI reference: + +#if defined(STATIC_LIB) || defined(SCITER_BUILD) EXTERN_C ISciterAPI* SCAPI SciterAPI(); -#if defined(__cplusplus) && !defined(PLAIN_API_ONLY) - ISciterAPI* SAPI( ISciterAPI* ext = nullptr ) { -#else - ISciterAPI* SAPI(ISciterAPI* ext) { -#endif - static ISciterAPI* _api = 0; + ISciterAPI* _SAPI(ISciterAPI* ext) { + static ISciterAPI* _api = NULL; if( ext ) _api = ext; if( !_api ) { _api = SciterAPI(); #if defined(__cplusplus) && !defined(PLAIN_API_ONLY) - tiscript::ni(_api->TIScriptAPI()); +// tiscript::ni(_api->TIScriptAPI()); #endif } assert(_api); @@ -27,28 +27,28 @@ const char * SCITER_DLL_PATH = SCITER_DLL_NAME; #elif defined(WINDOWS) - ISciterAPI* SAPI( ISciterAPI* ext ) { + ISciterAPI* _SAPI( ISciterAPI* ext ) { static ISciterAPI* _api = NULL; if( ext ) _api = ext; if( !_api ) { - HMODULE hm = LoadLibraryA( SCITER_DLL_PATH ); + HMODULE hm = LoadLibrary( TEXT(SCITER_DLL_NAME) ); if(hm) { SciterAPI_ptr sciterAPI = (SciterAPI_ptr) GetProcAddress(hm, "SciterAPI"); if( sciterAPI ) { _api = sciterAPI(); -#if defined(__cplusplus) - tiscript::ni( _api->TIScriptAPI() ); -#endif +//#if defined(__cplusplus) && !defined(PLAIN_API_ONLY) +// tiscript::ni( _api->TIScriptAPI() ); +//#endif } else { FreeLibrary(hm); } } } - // assert(_api); + assert(_api); if( !_api ) { - MessageBox(NULL, TEXT("Sciter engine not found, quiting"),TEXT("Error"),MB_OK); + //::MessageBox(NULL, TEXT("Sciter engine not found, quiting"),TEXT("Error"),MB_OK); exit(-1); } return _api; @@ -56,11 +56,9 @@ const char * SCITER_DLL_PATH = SCITER_DLL_NAME; #elif defined(OSX) - #include - //typedef ISciterAPI* SCAPI (*SciterAPI_ptr)(); - ISciterAPI* SAPI( ISciterAPI* ext ) + ISciterAPI* _SAPI( ISciterAPI* ext ) { static ISciterAPI* _api = NULL; if( ext ) _api = ext; @@ -73,11 +71,8 @@ const char * SCITER_DLL_PATH = SCITER_DLL_NAME; realpath(pathbuf, folderpath); *strrchr(folderpath, '/') = '\0'; - // 0. try to load from user-provided library full path. - void* lib_sciter_handle = dlopen(SCITER_DLL_PATH, RTLD_LOCAL|RTLD_LAZY); - if (!lib_sciter_handle) - { - // 1. try to load from the same folder as this executable + void* lib_sciter_handle = dlopen(SCITER_DLL_NAME, RTLD_LOCAL|RTLD_LAZY); + if( !lib_sciter_handle ) { const char* lookup_paths[] = { "/" SCITER_DLL_NAME, @@ -91,9 +86,6 @@ const char * SCITER_DLL_PATH = SCITER_DLL_NAME; lib_sciter_handle = dlopen(tpath, RTLD_LOCAL|RTLD_LAZY); } } - if (!lib_sciter_handle) // 2. no luck, try to load from system paths - lib_sciter_handle = dlopen(SCITER_DLL_NAME, RTLD_LOCAL | RTLD_LAZY); - if (!lib_sciter_handle) { fprintf(stderr, "[%s] Unable to load library: %s\n", __FILE__, dlerror()); exit(EXIT_FAILURE); @@ -105,277 +97,330 @@ const char * SCITER_DLL_PATH = SCITER_DLL_NAME; exit(EXIT_FAILURE); } _api = sapi(); - #if defined(__cplusplus) - tiscript::ni( _api->TIScriptAPI() ); - #endif + //tiscript::ni( _api->TIScriptAPI() ); } - // assert(_api); + assert(_api); return _api; } -#elif defined(LINUX) +#elif defined(ANDROID) - #include - #include +#if 1 + EXTERN_C ISciterAPI *SciterAPI(); - //typedef ISciterAPI* SCAPI (*SciterAPI_ptr)(); - - ISciterAPI* SAPI( ISciterAPI* ext ) + ISciterAPI* _SAPI( ISciterAPI* ext ) { static ISciterAPI* _api = NULL; - if( ext ) _api = ext; - if( !_api ) { + if( ext ) + _api = ext; + else + _api = SciterAPI(); + assert(_api); + //if (!sapi) { + // fprintf(stderr, "[%s] Unable to get symbol: %s\n", __FILE__, dlerror()); + // exit(EXIT_FAILURE); + //} + return _api; + } - char folderpath[2048] = {0}; +#else + ISciterAPI *_SAPI(ISciterAPI *ext) { + static ISciterAPI *_api = NULL; + if (ext) _api = ext; + if (!_api) { + void *lib_sciter_handle = NULL; + // 1. try to load from the same folder as this executable + lib_sciter_handle = dlopen(SCITER_DLL_NAME, RTLD_LOCAL | RTLD_LAZY); + if (!lib_sciter_handle) { + fprintf(stderr, "[%s] Unable to load library: %s\n", dlerror(), SCITER_DLL_NAME); + } - if (readlink ("/proc/self/exe", folderpath, sizeof(folderpath)) != -1) - { - dirname (folderpath); - //strcat (pathbuf, "/"); - } + SciterAPI_ptr sapi = (SciterAPI_ptr)dlsym(lib_sciter_handle, "SciterAPI"); + if (!sapi) { + fprintf(stderr, "[%s] Unable to get symbol: %s\n", __FILE__, dlerror()); + exit(EXIT_FAILURE); + } + _api = sapi(); + } + assert(_api); + return _api; +} - // 0. try to load from user-provided library full path. - void* lib_sciter_handle = dlopen(SCITER_DLL_PATH, RTLD_LOCAL|RTLD_LAZY); - if( !lib_sciter_handle ) { - // 1. try to load from the same folder as this executable - fprintf(stderr, "[%s] Unable to load library: %s\n", __FILE__, dlerror()); - const char* lookup_paths[] = - { - "/" SCITER_DLL_NAME, - NULL - }; - for( int n = 0; !lib_sciter_handle; ++n ) { - if( !lookup_paths[n] ) - break; - char tpath[2048] = {0}; - strcpy(tpath,folderpath); - strcat(tpath, lookup_paths[n]); - lib_sciter_handle = dlopen(tpath, RTLD_LOCAL | RTLD_LAZY); - } - } - if (!lib_sciter_handle) { - fprintf(stderr, "[%s] Unable to load library: %s\n", __FILE__, dlerror()); - exit(EXIT_FAILURE); - } +#endif - SciterAPI_ptr sapi = (SciterAPI_ptr) dlsym(lib_sciter_handle, "SciterAPI"); - if (!sapi) { - fprintf(stderr,"[%s] Unable to get symbol: %s\n", __FILE__, dlerror()); - exit(EXIT_FAILURE); - } - _api = sapi(); - #if defined(__cplusplus) - tiscript::ni( _api->TIScriptAPI() ); - #endif +#elif defined(LINUX) + +#include +#include + +// typedef ISciterAPI* SCAPI (*SciterAPI_ptr)(); + +ISciterAPI *_SAPI(ISciterAPI *ext) { + static ISciterAPI *_api = NULL; + if (ext) _api = ext; + if (!_api) { + + char folderpath[2048] = {0}; + + if (readlink("/proc/self/exe", folderpath, sizeof(folderpath)) != -1) { + dirname(folderpath); + // strcat (pathbuf, "/"); + } + + void *lib_sciter_handle = NULL; + + { + // 1. try to load from the same folder as this executable + const char *lookup_paths[] = {"/" SCITER_DLL_NAME, NULL}; + for (int n = 0; !lib_sciter_handle; ++n) { + if (!lookup_paths[n]) break; + char tpath[2048] = {0}; + strcpy(tpath, folderpath); + strcat(tpath, lookup_paths[n]); + // fprintf(stdout, "[%s]\n",tpath); + lib_sciter_handle = dlopen(tpath, RTLD_LOCAL | RTLD_LAZY); + if (!lib_sciter_handle) { + fprintf(stderr, "[%s] Unable to load library: %s\n", dlerror(), + tpath); } - // assert(_api); - return _api; + } } + if (!lib_sciter_handle) // 2. no luck, try to load from system paths + lib_sciter_handle = dlopen(SCITER_DLL_NAME, RTLD_LOCAL | RTLD_LAZY); + + if (!lib_sciter_handle) { + fprintf(stderr, "[%s] Unable to load library: %s\n", __FILE__, dlerror()); + exit(EXIT_FAILURE); + } + + SciterAPI_ptr sapi = (SciterAPI_ptr)dlsym(lib_sciter_handle, "SciterAPI"); + if (!sapi) { + fprintf(stderr, "[%s] Unable to get symbol: %s\n", __FILE__, dlerror()); + exit(EXIT_FAILURE); + } + _api = sapi(); + } + assert(_api); + return _api; +} #endif + + ISciterAPI* SAPI() { + return _SAPI(NULL); + } + LPSciterGraphicsAPI gapi() { - static LPSciterGraphicsAPI _gapi = NULL; - if(!_gapi) - _gapi = SAPI(NULL)->GetSciterGraphicsAPI(); - return _gapi; + return SAPI()->GetSciterGraphicsAPI(); } LPSciterRequestAPI rapi() { - static LPSciterRequestAPI _rapi = NULL; - if(!_rapi) - _rapi = SAPI(NULL)->GetSciterRequestAPI(); - return _rapi; + return SAPI()->GetSciterRequestAPI(); } // defining "official" API functions: - LPCWSTR SCAPI SciterClassName () { return SAPI(NULL)->SciterClassName(); } - UINT SCAPI SciterVersion (BOOL major) { return SAPI(NULL)->SciterVersion (major); } - BOOL SCAPI SciterDataReady (HWINDOW hwnd,LPCWSTR uri,LPCBYTE data, UINT dataLength) { return SAPI(NULL)->SciterDataReady (hwnd,uri,data,dataLength); } - BOOL SCAPI SciterDataReadyAsync (HWINDOW hwnd,LPCWSTR uri, LPCBYTE data, UINT dataLength, LPVOID requestId) { return SAPI(NULL)->SciterDataReadyAsync (hwnd,uri, data, dataLength, requestId); } -#ifdef WINDOWS - LRESULT SCAPI SciterProc (HWINDOW hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { return SAPI(NULL)->SciterProc (hwnd,msg,wParam,lParam); } - LRESULT SCAPI SciterProcND (HWINDOW hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL* pbHandled) { return SAPI(NULL)->SciterProcND (hwnd,msg,wParam,lParam,pbHandled); } + LPCWSTR SCAPI SciterClassName (void) { return SAPI()->SciterClassName(); } + UINT SCAPI SciterVersion (SBOOL major) { return SAPI()->SciterVersion (major); } + SBOOL SCAPI SciterDataReady (HWINDOW hwnd,LPCWSTR uri,LPCBYTE data, UINT dataLength) { return SAPI()->SciterDataReady (hwnd,uri,data,dataLength); } + SBOOL SCAPI SciterDataReadyAsync (HWINDOW hwnd,LPCWSTR uri, LPCBYTE data, UINT dataLength, LPVOID requestId) { return SAPI()->SciterDataReadyAsync (hwnd,uri, data, dataLength, requestId); } +#if defined(WINDOWS) && !defined(WINDOWLESS) + LRESULT SCAPI SciterProc (HWINDOW hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { return SAPI()->SciterProc (hwnd,msg,wParam,lParam); } + LRESULT SCAPI SciterProcND (HWINDOW hwnd, UINT msg, WPARAM wParam, LPARAM lParam, SBOOL* pbHandled) { return SAPI()->SciterProcND (hwnd,msg,wParam,lParam,pbHandled); } +#endif + SBOOL SCAPI SciterLoadFile (HWINDOW hWndSciter, LPCWSTR filename) { return SAPI()->SciterLoadFile (hWndSciter,filename); } + SBOOL SCAPI SciterLoadHtml (HWINDOW hWndSciter, LPCBYTE html, UINT htmlSize, LPCWSTR baseUrl) { return SAPI()->SciterLoadHtml (hWndSciter,html,htmlSize,baseUrl); } + VOID SCAPI SciterSetCallback (HWINDOW hWndSciter, LPSciterHostCallback cb, LPVOID cbParam) { SAPI()->SciterSetCallback (hWndSciter,cb,cbParam); } + SBOOL SCAPI SciterSetMasterCSS (LPCBYTE utf8, UINT numBytes) { return SAPI()->SciterSetMasterCSS (utf8,numBytes); } + SBOOL SCAPI SciterAppendMasterCSS (LPCBYTE utf8, UINT numBytes) { return SAPI()->SciterAppendMasterCSS (utf8,numBytes); } + SBOOL SCAPI SciterSetCSS (HWINDOW hWndSciter, LPCBYTE utf8, UINT numBytes, LPCWSTR baseUrl, LPCWSTR mediaType) { return SAPI()->SciterSetCSS (hWndSciter,utf8,numBytes,baseUrl,mediaType); } + SBOOL SCAPI SciterSetMediaType (HWINDOW hWndSciter, LPCWSTR mediaType) { return SAPI()->SciterSetMediaType (hWndSciter,mediaType); } + SBOOL SCAPI SciterSetMediaVars (HWINDOW hWndSciter, const SCITER_VALUE *mediaVars) { return SAPI()->SciterSetMediaVars (hWndSciter,mediaVars); } + UINT SCAPI SciterGetMinWidth (HWINDOW hWndSciter) { return SAPI()->SciterGetMinWidth (hWndSciter); } + UINT SCAPI SciterGetMinHeight (HWINDOW hWndSciter, UINT width) { return SAPI()->SciterGetMinHeight (hWndSciter,width); } + SBOOL SCAPI SciterCall (HWINDOW hWnd, LPCSTR functionName, UINT argc, const SCITER_VALUE* argv, SCITER_VALUE* retval) { return SAPI()->SciterCall (hWnd,functionName, argc,argv,retval); } + SBOOL SCAPI SciterEval ( HWINDOW hwnd, LPCWSTR script, UINT scriptLength, SCITER_VALUE* pretval) { return SAPI()->SciterEval ( hwnd, script, scriptLength, pretval); } + VOID SCAPI SciterUpdateWindow(HWINDOW hwnd) { SAPI()->SciterUpdateWindow(hwnd); } +#if defined(WINDOWS) && !defined(WINDOWLESS) + SBOOL SCAPI SciterTranslateMessage (MSG* lpMsg) { return SAPI()->SciterTranslateMessage (lpMsg); } #endif - BOOL SCAPI SciterLoadFile (HWINDOW hWndSciter, LPCWSTR filename) { return SAPI(NULL)->SciterLoadFile (hWndSciter,filename); } - BOOL SCAPI SciterLoadHtml (HWINDOW hWndSciter, LPCBYTE html, UINT htmlSize, LPCWSTR baseUrl) { return SAPI(NULL)->SciterLoadHtml (hWndSciter,html,htmlSize,baseUrl); } - VOID SCAPI SciterSetCallback (HWINDOW hWndSciter, LPSciterHostCallback cb, LPVOID cbParam) { SAPI(NULL)->SciterSetCallback (hWndSciter,cb,cbParam); } - BOOL SCAPI SciterSetMasterCSS (LPCBYTE utf8, UINT numBytes) { return SAPI(NULL)->SciterSetMasterCSS (utf8,numBytes); } - BOOL SCAPI SciterAppendMasterCSS (LPCBYTE utf8, UINT numBytes) { return SAPI(NULL)->SciterAppendMasterCSS (utf8,numBytes); } - BOOL SCAPI SciterSetCSS (HWINDOW hWndSciter, LPCBYTE utf8, UINT numBytes, LPCWSTR baseUrl, LPCWSTR mediaType) { return SAPI(NULL)->SciterSetCSS (hWndSciter,utf8,numBytes,baseUrl,mediaType); } - BOOL SCAPI SciterSetMediaType (HWINDOW hWndSciter, LPCWSTR mediaType) { return SAPI(NULL)->SciterSetMediaType (hWndSciter,mediaType); } - BOOL SCAPI SciterSetMediaVars (HWINDOW hWndSciter, const SCITER_VALUE *mediaVars) { return SAPI(NULL)->SciterSetMediaVars (hWndSciter,mediaVars); } - UINT SCAPI SciterGetMinWidth (HWINDOW hWndSciter) { return SAPI(NULL)->SciterGetMinWidth (hWndSciter); } - UINT SCAPI SciterGetMinHeight (HWINDOW hWndSciter, UINT width) { return SAPI(NULL)->SciterGetMinHeight (hWndSciter,width); } - BOOL SCAPI SciterCall (HWINDOW hWnd, LPCSTR functionName, UINT argc, const SCITER_VALUE* argv, SCITER_VALUE* retval) { return SAPI(NULL)->SciterCall (hWnd,functionName, argc,argv,retval); } - BOOL SCAPI SciterEval ( HWINDOW hwnd, LPCWSTR script, UINT scriptLength, SCITER_VALUE* pretval) { return SAPI(NULL)->SciterEval ( hwnd, script, scriptLength, pretval); } - VOID SCAPI SciterUpdateWindow(HWINDOW hwnd) { SAPI(NULL)->SciterUpdateWindow(hwnd); } -#ifdef WINDOWS - BOOL SCAPI SciterTranslateMessage (MSG* lpMsg) { return SAPI(NULL)->SciterTranslateMessage (lpMsg); } + SBOOL SCAPI SciterSetOption (HWINDOW hWnd, UINT option, UINT_PTR value ) { return SAPI()->SciterSetOption (hWnd,option,value ); } + VOID SCAPI SciterGetPPI (HWINDOW hWndSciter, UINT* px, UINT* py) { SAPI()->SciterGetPPI (hWndSciter,px,py); } + SBOOL SCAPI SciterGetViewExpando ( HWINDOW hwnd, VALUE* pval ) { return SAPI()->SciterGetViewExpando ( hwnd, pval ); } +#if defined(WINDOWS) && !defined(WINDOWLESS) + SBOOL SCAPI SciterRenderD2D (HWINDOW hWndSciter, IUnknown* /*ID2D1RenderTarget**/ prt) { return SAPI()->SciterRenderD2D (hWndSciter,prt); } + SBOOL SCAPI SciterD2DFactory (IUnknown** /*ID2D1Factory ***/ ppf) { return SAPI()->SciterD2DFactory (ppf); } + SBOOL SCAPI SciterDWFactory (IUnknown** /*IDWriteFactory ***/ ppf) { return SAPI()->SciterDWFactory (ppf); } #endif - BOOL SCAPI SciterSetOption (HWINDOW hWnd, UINT option, UINT_PTR value ) { return SAPI(NULL)->SciterSetOption (hWnd,option,value ); } - VOID SCAPI SciterGetPPI (HWINDOW hWndSciter, UINT* px, UINT* py) { SAPI(NULL)->SciterGetPPI (hWndSciter,px,py); } - BOOL SCAPI SciterGetViewExpando ( HWINDOW hwnd, VALUE* pval ) { return SAPI(NULL)->SciterGetViewExpando ( hwnd, pval ); } -#ifdef WINDOWS - BOOL SCAPI SciterRenderD2D (HWINDOW hWndSciter, IUnknown* /*ID2D1RenderTarget**/ prt) { return SAPI(NULL)->SciterRenderD2D (hWndSciter,prt); } - BOOL SCAPI SciterD2DFactory (void** /*ID2D1Factory ***/ ppf) { return SAPI(NULL)->SciterD2DFactory (ppf); } - BOOL SCAPI SciterDWFactory (void** /*IDWriteFactory ***/ ppf) { return SAPI(NULL)->SciterDWFactory (ppf); } + SBOOL SCAPI SciterGraphicsCaps (LPUINT pcaps) { return SAPI()->SciterGraphicsCaps (pcaps); } + SBOOL SCAPI SciterSetHomeURL (HWINDOW hWndSciter, LPCWSTR baseUrl) { return SAPI()->SciterSetHomeURL (hWndSciter,baseUrl); } +#if defined(OSX) && !defined(WINDOWLESS) + HWINDOW SCAPI SciterCreateNSView ( LPRECT frame ) { return SAPI()->SciterCreateNSView ( frame ); } #endif - BOOL SCAPI SciterGraphicsCaps (LPUINT pcaps) { return SAPI(NULL)->SciterGraphicsCaps (pcaps); } - BOOL SCAPI SciterSetHomeURL (HWINDOW hWndSciter, LPCWSTR baseUrl) { return SAPI(NULL)->SciterSetHomeURL (hWndSciter,baseUrl); } -#if defined(OSX) - HWINDOW SCAPI SciterCreateNSView ( LPRECT frame ) { return SAPI(NULL)->SciterCreateNSView ( frame ); } +#if !defined(WINDOWLESS) + HWINDOW SCAPI SciterCreateWindow ( UINT creationFlags,LPRECT frame, SciterWindowDelegate* delegate, LPVOID delegateParam, HWINDOW parent) { return SAPI()->SciterCreateWindow (creationFlags,frame,delegate,delegateParam,parent); } #endif - HWINDOW SCAPI SciterCreateWindow ( UINT creationFlags,LPRECT frame, SciterWindowDelegate* delegate, LPVOID delegateParam, HWINDOW parent) { return SAPI(NULL)->SciterCreateWindow (creationFlags,frame,delegate,delegateParam,parent); } - - SCDOM_RESULT SCAPI Sciter_UseElement(HELEMENT he) { return SAPI(NULL)->Sciter_UseElement(he); } - SCDOM_RESULT SCAPI Sciter_UnuseElement(HELEMENT he) { return SAPI(NULL)->Sciter_UnuseElement(he); } - SCDOM_RESULT SCAPI SciterGetRootElement(HWINDOW hwnd, HELEMENT *phe) { return SAPI(NULL)->SciterGetRootElement(hwnd, phe); } - SCDOM_RESULT SCAPI SciterGetFocusElement(HWINDOW hwnd, HELEMENT *phe) { return SAPI(NULL)->SciterGetFocusElement(hwnd, phe); } - SCDOM_RESULT SCAPI SciterFindElement(HWINDOW hwnd, POINT pt, HELEMENT* phe) { return SAPI(NULL)->SciterFindElement(hwnd,pt,phe); } - SCDOM_RESULT SCAPI SciterGetChildrenCount(HELEMENT he, UINT* count) { return SAPI(NULL)->SciterGetChildrenCount(he, count); } - SCDOM_RESULT SCAPI SciterGetNthChild(HELEMENT he, UINT n, HELEMENT* phe) { return SAPI(NULL)->SciterGetNthChild(he,n,phe); } - SCDOM_RESULT SCAPI SciterGetParentElement(HELEMENT he, HELEMENT* p_parent_he) { return SAPI(NULL)->SciterGetParentElement(he,p_parent_he); } - SCDOM_RESULT SCAPI SciterGetElementHtmlCB(HELEMENT he, BOOL outer, LPCBYTE_RECEIVER* rcv, LPVOID rcv_param) { return SAPI(NULL)->SciterGetElementHtmlCB( he, outer, rcv, rcv_param); } - SCDOM_RESULT SCAPI SciterGetElementTextCB(HELEMENT he, LPCWSTR_RECEIVER* rcv, LPVOID rcv_param) { return SAPI(NULL)->SciterGetElementTextCB(he, rcv, rcv_param); } - SCDOM_RESULT SCAPI SciterSetElementText(HELEMENT he, LPCWSTR utf16, UINT length) { return SAPI(NULL)->SciterSetElementText(he, utf16, length); } - SCDOM_RESULT SCAPI SciterGetAttributeCount(HELEMENT he, LPUINT p_count) { return SAPI(NULL)->SciterGetAttributeCount(he, p_count); } - SCDOM_RESULT SCAPI SciterGetNthAttributeNameCB(HELEMENT he, UINT n, LPCSTR_RECEIVER* rcv, LPVOID rcv_param) { return SAPI(NULL)->SciterGetNthAttributeNameCB(he,n,rcv,rcv_param); } - SCDOM_RESULT SCAPI SciterGetNthAttributeValueCB(HELEMENT he, UINT n, LPCWSTR_RECEIVER* rcv, LPVOID rcv_param) { return SAPI(NULL)->SciterGetNthAttributeValueCB(he, n, rcv, rcv_param); } - SCDOM_RESULT SCAPI SciterGetAttributeByNameCB(HELEMENT he, LPCSTR name, LPCWSTR_RECEIVER* rcv, LPVOID rcv_param) { return SAPI(NULL)->SciterGetAttributeByNameCB(he,name,rcv,rcv_param); } - SCDOM_RESULT SCAPI SciterSetAttributeByName(HELEMENT he, LPCSTR name, LPCWSTR value) { return SAPI(NULL)->SciterSetAttributeByName(he,name,value); } - SCDOM_RESULT SCAPI SciterClearAttributes(HELEMENT he) { return SAPI(NULL)->SciterClearAttributes(he); } - SCDOM_RESULT SCAPI SciterGetElementIndex(HELEMENT he, LPUINT p_index) { return SAPI(NULL)->SciterGetElementIndex(he,p_index); } - SCDOM_RESULT SCAPI SciterGetElementType(HELEMENT he, LPCSTR* p_type) { return SAPI(NULL)->SciterGetElementType(he,p_type); } - SCDOM_RESULT SCAPI SciterGetElementTypeCB(HELEMENT he, LPCSTR_RECEIVER* rcv, LPVOID rcv_param) { return SAPI(NULL)->SciterGetElementTypeCB(he,rcv,rcv_param); } - SCDOM_RESULT SCAPI SciterGetStyleAttributeCB(HELEMENT he, LPCSTR name, LPCWSTR_RECEIVER* rcv, LPVOID rcv_param) { return SAPI(NULL)->SciterGetStyleAttributeCB(he,name,rcv,rcv_param); } - SCDOM_RESULT SCAPI SciterSetStyleAttribute(HELEMENT he, LPCSTR name, LPCWSTR value) { return SAPI(NULL)->SciterSetStyleAttribute(he,name,value); } - SCDOM_RESULT SCAPI SciterGetElementLocation(HELEMENT he, LPRECT p_location, UINT areas /*ELEMENT_AREAS*/) { return SAPI(NULL)->SciterGetElementLocation(he,p_location,areas); } - SCDOM_RESULT SCAPI SciterScrollToView(HELEMENT he, UINT SciterScrollFlags) { return SAPI(NULL)->SciterScrollToView(he,SciterScrollFlags); } - SCDOM_RESULT SCAPI SciterUpdateElement(HELEMENT he, BOOL andForceRender) { return SAPI(NULL)->SciterUpdateElement(he,andForceRender); } - SCDOM_RESULT SCAPI SciterRefreshElementArea(HELEMENT he, RECT rc) { return SAPI(NULL)->SciterRefreshElementArea(he,rc); } - SCDOM_RESULT SCAPI SciterSetCapture(HELEMENT he) { return SAPI(NULL)->SciterSetCapture(he); } - SCDOM_RESULT SCAPI SciterReleaseCapture(HELEMENT he) { return SAPI(NULL)->SciterReleaseCapture(he); } - SCDOM_RESULT SCAPI SciterGetElementHwnd(HELEMENT he, HWINDOW* p_hwnd, BOOL rootWindow) { return SAPI(NULL)->SciterGetElementHwnd(he,p_hwnd,rootWindow); } - SCDOM_RESULT SCAPI SciterCombineURL(HELEMENT he, LPWSTR szUrlBuffer, UINT UrlBufferSize) { return SAPI(NULL)->SciterCombineURL(he,szUrlBuffer,UrlBufferSize); } - SCDOM_RESULT SCAPI SciterSelectElements(HELEMENT he, LPCSTR CSS_selectors, SciterElementCallback* callback, LPVOID param) { return SAPI(NULL)->SciterSelectElements(he,CSS_selectors,callback,param); } - SCDOM_RESULT SCAPI SciterSelectElementsW(HELEMENT he, LPCWSTR CSS_selectors, SciterElementCallback* callback, LPVOID param) { return SAPI(NULL)->SciterSelectElementsW(he,CSS_selectors,callback,param); } - SCDOM_RESULT SCAPI SciterSelectParent(HELEMENT he, LPCSTR selector, UINT depth, HELEMENT* heFound) { return SAPI(NULL)->SciterSelectParent(he,selector,depth,heFound); } - SCDOM_RESULT SCAPI SciterSelectParentW(HELEMENT he, LPCWSTR selector, UINT depth, HELEMENT* heFound) { return SAPI(NULL)->SciterSelectParentW(he,selector,depth,heFound); } - SCDOM_RESULT SCAPI SciterSetElementHtml(HELEMENT he, const BYTE* html, UINT htmlLength, UINT where) { return SAPI(NULL)->SciterSetElementHtml(he,html,htmlLength,where); } - SCDOM_RESULT SCAPI SciterGetElementUID(HELEMENT he, UINT* puid) { return SAPI(NULL)->SciterGetElementUID(he,puid); } - SCDOM_RESULT SCAPI SciterGetElementByUID(HWINDOW hwnd, UINT uid, HELEMENT* phe) { return SAPI(NULL)->SciterGetElementByUID(hwnd,uid,phe); } - SCDOM_RESULT SCAPI SciterShowPopup(HELEMENT hePopup, HELEMENT heAnchor, UINT placement) { return SAPI(NULL)->SciterShowPopup(hePopup,heAnchor,placement); } - SCDOM_RESULT SCAPI SciterShowPopupAt(HELEMENT hePopup, POINT pos, UINT placement) { return SAPI(NULL)->SciterShowPopupAt(hePopup,pos,placement); } - SCDOM_RESULT SCAPI SciterHidePopup(HELEMENT he) { return SAPI(NULL)->SciterHidePopup(he); } - SCDOM_RESULT SCAPI SciterGetElementState( HELEMENT he, UINT* pstateBits) { return SAPI(NULL)->SciterGetElementState(he,pstateBits); } - SCDOM_RESULT SCAPI SciterSetElementState( HELEMENT he, UINT stateBitsToSet, UINT stateBitsToClear, BOOL updateView) { return SAPI(NULL)->SciterSetElementState(he,stateBitsToSet,stateBitsToClear,updateView); } - SCDOM_RESULT SCAPI SciterCreateElement( LPCSTR tagname, LPCWSTR textOrNull, /*out*/ HELEMENT *phe ) { return SAPI(NULL)->SciterCreateElement(tagname,textOrNull,phe ); } - SCDOM_RESULT SCAPI SciterCloneElement( HELEMENT he, /*out*/ HELEMENT *phe ) { return SAPI(NULL)->SciterCloneElement(he,phe ); } - SCDOM_RESULT SCAPI SciterInsertElement( HELEMENT he, HELEMENT hparent, UINT index ) { return SAPI(NULL)->SciterInsertElement(he,hparent,index ); } - SCDOM_RESULT SCAPI SciterDetachElement( HELEMENT he ) { return SAPI(NULL)->SciterDetachElement( he ); } - SCDOM_RESULT SCAPI SciterDeleteElement(HELEMENT he) { return SAPI(NULL)->SciterDeleteElement(he); } - SCDOM_RESULT SCAPI SciterSetTimer( HELEMENT he, UINT milliseconds, UINT_PTR timer_id ) { return SAPI(NULL)->SciterSetTimer(he,milliseconds,timer_id ); } - SCDOM_RESULT SCAPI SciterDetachEventHandler( HELEMENT he, LPELEMENT_EVENT_PROC pep, LPVOID tag ) { return SAPI(NULL)->SciterDetachEventHandler(he,pep,tag ); } - SCDOM_RESULT SCAPI SciterAttachEventHandler( HELEMENT he, LPELEMENT_EVENT_PROC pep, LPVOID tag ) { return SAPI(NULL)->SciterAttachEventHandler( he,pep,tag ); } - SCDOM_RESULT SCAPI SciterWindowAttachEventHandler( HWINDOW hwndLayout, LPELEMENT_EVENT_PROC pep, LPVOID tag, UINT subscription ) { return SAPI(NULL)->SciterWindowAttachEventHandler(hwndLayout,pep,tag,subscription ); } - SCDOM_RESULT SCAPI SciterWindowDetachEventHandler( HWINDOW hwndLayout, LPELEMENT_EVENT_PROC pep, LPVOID tag ) { return SAPI(NULL)->SciterWindowDetachEventHandler(hwndLayout,pep,tag ); } - SCDOM_RESULT SCAPI SciterSendEvent( HELEMENT he, UINT appEventCode, HELEMENT heSource, UINT_PTR reason, /*out*/ BOOL* handled) { return SAPI(NULL)->SciterSendEvent( he,appEventCode,heSource,reason,handled); } - SCDOM_RESULT SCAPI SciterPostEvent( HELEMENT he, UINT appEventCode, HELEMENT heSource, UINT_PTR reason) { return SAPI(NULL)->SciterPostEvent(he,appEventCode,heSource,reason); } - SCDOM_RESULT SCAPI SciterFireEvent( const struct BEHAVIOR_EVENT_PARAMS* evt, BOOL post, BOOL *handled) { return SAPI(NULL)->SciterFireEvent( evt, post, handled ); } - SCDOM_RESULT SCAPI SciterCallBehaviorMethod(HELEMENT he, struct METHOD_PARAMS* params) { return SAPI(NULL)->SciterCallBehaviorMethod(he,params); } - SCDOM_RESULT SCAPI SciterRequestElementData( HELEMENT he, LPCWSTR url, UINT dataType, HELEMENT initiator ) { return SAPI(NULL)->SciterRequestElementData(he,url,dataType,initiator ); } - SCDOM_RESULT SCAPI SciterHttpRequest( HELEMENT he, LPCWSTR url, UINT dataType, UINT requestType, struct REQUEST_PARAM* requestParams, UINT nParams) { return SAPI(NULL)->SciterHttpRequest(he,url,dataType,requestType,requestParams,nParams); } - SCDOM_RESULT SCAPI SciterGetScrollInfo( HELEMENT he, LPPOINT scrollPos, LPRECT viewRect, LPSIZE contentSize ) { return SAPI(NULL)->SciterGetScrollInfo( he,scrollPos,viewRect,contentSize ); } - SCDOM_RESULT SCAPI SciterSetScrollPos( HELEMENT he, POINT scrollPos, BOOL smooth ) { return SAPI(NULL)->SciterSetScrollPos( he,scrollPos,smooth ); } - SCDOM_RESULT SCAPI SciterGetElementIntrinsicWidths( HELEMENT he, INT* pMinWidth, INT* pMaxWidth ) { return SAPI(NULL)->SciterGetElementIntrinsicWidths(he,pMinWidth,pMaxWidth ); } - SCDOM_RESULT SCAPI SciterGetElementIntrinsicHeight( HELEMENT he, INT forWidth, INT* pHeight ) { return SAPI(NULL)->SciterGetElementIntrinsicHeight( he,forWidth,pHeight ); } - SCDOM_RESULT SCAPI SciterIsElementVisible( HELEMENT he, BOOL* pVisible) { return SAPI(NULL)->SciterIsElementVisible( he,pVisible); } - SCDOM_RESULT SCAPI SciterIsElementEnabled( HELEMENT he, BOOL* pEnabled ) { return SAPI(NULL)->SciterIsElementEnabled( he, pEnabled ); } - SCDOM_RESULT SCAPI SciterSortElements( HELEMENT he, UINT firstIndex, UINT lastIndex, ELEMENT_COMPARATOR* cmpFunc, LPVOID cmpFuncParam ) { return SAPI(NULL)->SciterSortElements( he, firstIndex, lastIndex, cmpFunc, cmpFuncParam ); } - SCDOM_RESULT SCAPI SciterSwapElements( HELEMENT he1, HELEMENT he2 ) { return SAPI(NULL)->SciterSwapElements( he1,he2 ); } - SCDOM_RESULT SCAPI SciterTraverseUIEvent( UINT evt, LPVOID eventCtlStruct, BOOL* bOutProcessed ) { return SAPI(NULL)->SciterTraverseUIEvent( evt,eventCtlStruct,bOutProcessed ); } - SCDOM_RESULT SCAPI SciterCallScriptingMethod( HELEMENT he, LPCSTR name, const VALUE* argv, UINT argc, VALUE* retval ) { return SAPI(NULL)->SciterCallScriptingMethod( he,name,argv,argc,retval ); } - SCDOM_RESULT SCAPI SciterCallScriptingFunction( HELEMENT he, LPCSTR name, const VALUE* argv, UINT argc, VALUE* retval ) { return SAPI(NULL)->SciterCallScriptingFunction( he,name,argv,argc,retval ); } - SCDOM_RESULT SCAPI SciterEvalElementScript( HELEMENT he, LPCWSTR script, UINT scriptLength, VALUE* retval ) { return SAPI(NULL)->SciterEvalElementScript( he, script, scriptLength, retval ); } - SCDOM_RESULT SCAPI SciterAttachHwndToElement(HELEMENT he, HWINDOW hwnd) { return SAPI(NULL)->SciterAttachHwndToElement(he,hwnd); } - SCDOM_RESULT SCAPI SciterControlGetType( HELEMENT he, /*CTL_TYPE*/ UINT *pType ) { return SAPI(NULL)->SciterControlGetType( he, pType ); } - SCDOM_RESULT SCAPI SciterGetValue( HELEMENT he, VALUE* pval ) { return SAPI(NULL)->SciterGetValue( he,pval ); } - SCDOM_RESULT SCAPI SciterSetValue( HELEMENT he, const VALUE* pval ) { return SAPI(NULL)->SciterSetValue( he, pval ); } - SCDOM_RESULT SCAPI SciterGetExpando( HELEMENT he, VALUE* pval, BOOL forceCreation ) { return SAPI(NULL)->SciterGetExpando( he, pval, forceCreation ); } - SCDOM_RESULT SCAPI SciterGetObject( HELEMENT he, tiscript_value* pval, BOOL forceCreation ) { return SAPI(NULL)->SciterGetObject( he, pval, forceCreation ); } - SCDOM_RESULT SCAPI SciterGetElementNamespace( HELEMENT he, tiscript_value* pval) { return SAPI(NULL)->SciterGetElementNamespace( he,pval); } - SCDOM_RESULT SCAPI SciterGetHighlightedElement(HWINDOW hwnd, HELEMENT* phe) { return SAPI(NULL)->SciterGetHighlightedElement(hwnd, phe); } - SCDOM_RESULT SCAPI SciterSetHighlightedElement(HWINDOW hwnd, HELEMENT he) { return SAPI(NULL)->SciterSetHighlightedElement(hwnd,he); } - SCDOM_RESULT SCAPI SciterNodeAddRef(HNODE hn) { return SAPI(NULL)->SciterNodeAddRef(hn); } - SCDOM_RESULT SCAPI SciterNodeRelease(HNODE hn) { return SAPI(NULL)->SciterNodeRelease(hn); } - SCDOM_RESULT SCAPI SciterNodeCastFromElement(HELEMENT he, HNODE* phn) { return SAPI(NULL)->SciterNodeCastFromElement(he,phn); } - SCDOM_RESULT SCAPI SciterNodeCastToElement(HNODE hn, HELEMENT* he) { return SAPI(NULL)->SciterNodeCastToElement(hn,he); } - SCDOM_RESULT SCAPI SciterNodeFirstChild(HNODE hn, HNODE* phn) { return SAPI(NULL)->SciterNodeFirstChild(hn,phn); } - SCDOM_RESULT SCAPI SciterNodeLastChild(HNODE hn, HNODE* phn) { return SAPI(NULL)->SciterNodeLastChild(hn, phn); } - SCDOM_RESULT SCAPI SciterNodeNextSibling(HNODE hn, HNODE* phn) { return SAPI(NULL)->SciterNodeNextSibling(hn, phn); } - SCDOM_RESULT SCAPI SciterNodePrevSibling(HNODE hn, HNODE* phn) { return SAPI(NULL)->SciterNodePrevSibling(hn,phn); } - SCDOM_RESULT SCAPI SciterNodeParent(HNODE hnode, HELEMENT* pheParent) { return SAPI(NULL)->SciterNodeParent(hnode,pheParent) ; } - SCDOM_RESULT SCAPI SciterNodeNthChild(HNODE hnode, UINT n, HNODE* phn) { return SAPI(NULL)->SciterNodeNthChild(hnode,n,phn); } - SCDOM_RESULT SCAPI SciterNodeChildrenCount(HNODE hnode, UINT* pn) { return SAPI(NULL)->SciterNodeChildrenCount(hnode, pn); } - SCDOM_RESULT SCAPI SciterNodeType(HNODE hnode, UINT* pNodeType /*NODE_TYPE*/) { return SAPI(NULL)->SciterNodeType(hnode,pNodeType); } - SCDOM_RESULT SCAPI SciterNodeGetText(HNODE hnode, LPCWSTR_RECEIVER* rcv, LPVOID rcv_param) { return SAPI(NULL)->SciterNodeGetText(hnode,rcv,rcv_param); } - SCDOM_RESULT SCAPI SciterNodeSetText(HNODE hnode, LPCWSTR text, UINT textLength) { return SAPI(NULL)->SciterNodeSetText(hnode,text,textLength); } - SCDOM_RESULT SCAPI SciterNodeInsert(HNODE hnode, UINT where /*NODE_INS_TARGET*/, HNODE what) { return SAPI(NULL)->SciterNodeInsert(hnode,where,what); } - SCDOM_RESULT SCAPI SciterNodeRemove(HNODE hnode, BOOL finalize) { return SAPI(NULL)->SciterNodeRemove(hnode,finalize); } - SCDOM_RESULT SCAPI SciterCreateTextNode(LPCWSTR text, UINT textLength, HNODE* phnode) { return SAPI(NULL)->SciterCreateTextNode(text,textLength,phnode); } - SCDOM_RESULT SCAPI SciterCreateCommentNode(LPCWSTR text, UINT textLength, HNODE* phnode) { return SAPI(NULL)->SciterCreateCommentNode(text,textLength,phnode); } - - HVM SCAPI SciterGetVM( HWINDOW hwnd ) { return SAPI(NULL)->SciterGetVM(hwnd); } - - UINT SCAPI ValueInit ( VALUE* pval ) { return SAPI(NULL)->ValueInit(pval); } - UINT SCAPI ValueClear ( VALUE* pval ) { return SAPI(NULL)->ValueClear(pval); } - UINT SCAPI ValueCompare ( const VALUE* pval1, const VALUE* pval2 ) { return SAPI(NULL)->ValueCompare(pval1,pval2); } - UINT SCAPI ValueCopy ( VALUE* pdst, const VALUE* psrc ) { return SAPI(NULL)->ValueCopy(pdst, psrc); } - UINT SCAPI ValueIsolate ( VALUE* pdst ) { return SAPI(NULL)->ValueIsolate(pdst); } - UINT SCAPI ValueType ( const VALUE* pval, UINT* pType, UINT* pUnits ) { return SAPI(NULL)->ValueType(pval,pType,pUnits); } - UINT SCAPI ValueStringData ( const VALUE* pval, LPCWSTR* pChars, UINT* pNumChars ) { return SAPI(NULL)->ValueStringData(pval,pChars,pNumChars); } - UINT SCAPI ValueStringDataSet ( VALUE* pval, LPCWSTR chars, UINT numChars, UINT units ) { return SAPI(NULL)->ValueStringDataSet(pval, chars, numChars, units); } - UINT SCAPI ValueIntData ( const VALUE* pval, INT* pData ) { return SAPI(NULL)->ValueIntData ( pval, pData ); } - UINT SCAPI ValueIntDataSet ( VALUE* pval, INT data, UINT type, UINT units ) { return SAPI(NULL)->ValueIntDataSet ( pval, data,type,units ); } - UINT SCAPI ValueInt64Data ( const VALUE* pval, INT64* pData ) { return SAPI(NULL)->ValueInt64Data ( pval,pData ); } - UINT SCAPI ValueInt64DataSet ( VALUE* pval, INT64 data, UINT type, UINT units ) { return SAPI(NULL)->ValueInt64DataSet ( pval,data,type,units ); } - UINT SCAPI ValueFloatData ( const VALUE* pval, FLOAT_VALUE* pData ) { return SAPI(NULL)->ValueFloatData ( pval,pData ); } - UINT SCAPI ValueFloatDataSet ( VALUE* pval, FLOAT_VALUE data, UINT type, UINT units ) { return SAPI(NULL)->ValueFloatDataSet ( pval,data,type,units ); } - UINT SCAPI ValueBinaryData ( const VALUE* pval, LPCBYTE* pBytes, UINT* pnBytes ) { return SAPI(NULL)->ValueBinaryData ( pval,pBytes,pnBytes ); } - UINT SCAPI ValueBinaryDataSet ( VALUE* pval, LPCBYTE pBytes, UINT nBytes, UINT type, UINT units ) { return SAPI(NULL)->ValueBinaryDataSet ( pval,pBytes,nBytes,type,units ); } - UINT SCAPI ValueElementsCount ( const VALUE* pval, INT* pn) { return SAPI(NULL)->ValueElementsCount ( pval,pn); } - UINT SCAPI ValueNthElementValue ( const VALUE* pval, INT n, VALUE* pretval) { return SAPI(NULL)->ValueNthElementValue ( pval, n, pretval); } - UINT SCAPI ValueNthElementValueSet ( VALUE* pval, INT n, const VALUE* pval_to_set) { return SAPI(NULL)->ValueNthElementValueSet ( pval,n,pval_to_set); } - UINT SCAPI ValueNthElementKey ( const VALUE* pval, INT n, VALUE* pretval) { return SAPI(NULL)->ValueNthElementKey ( pval,n,pretval); } - UINT SCAPI ValueEnumElements ( const VALUE* pval, KeyValueCallback* penum, LPVOID param) { return SAPI(NULL)->ValueEnumElements (pval,penum,param); } - UINT SCAPI ValueSetValueToKey ( VALUE* pval, const VALUE* pkey, const VALUE* pval_to_set) { return SAPI(NULL)->ValueSetValueToKey ( pval, pkey, pval_to_set); } - UINT SCAPI ValueGetValueOfKey ( const VALUE* pval, const VALUE* pkey, VALUE* pretval) { return SAPI(NULL)->ValueGetValueOfKey ( pval, pkey,pretval); } - UINT SCAPI ValueToString ( VALUE* pval, UINT how ) { return SAPI(NULL)->ValueToString ( pval,how ); } - UINT SCAPI ValueFromString ( VALUE* pval, LPCWSTR str, UINT strLength, UINT how ) { return SAPI(NULL)->ValueFromString ( pval, str,strLength,how ); } - UINT SCAPI ValueInvoke ( const VALUE* pval, VALUE* pthis, UINT argc, const VALUE* argv, VALUE* pretval, LPCWSTR url) { return SAPI(NULL)->ValueInvoke ( pval, pthis, argc, argv, pretval, url); } - UINT SCAPI ValueNativeFunctorSet (VALUE* pval, NATIVE_FUNCTOR_INVOKE* pinvoke, NATIVE_FUNCTOR_RELEASE* prelease, VOID* tag ) { return SAPI(NULL)->ValueNativeFunctorSet ( pval, pinvoke,prelease,tag); } - BOOL SCAPI ValueIsNativeFunctor ( const VALUE* pval) { return SAPI(NULL)->ValueIsNativeFunctor (pval); } - - // conversion between script (managed) value and the VALUE ( com::variant alike thing ) - BOOL SCAPI Sciter_v2V(HVM vm, const tiscript_value script_value, VALUE* out_value, BOOL isolate) { return SAPI(NULL)->Sciter_v2V(vm,script_value,out_value, isolate); } - BOOL SCAPI Sciter_V2v(HVM vm, const VALUE* value, tiscript_value* out_script_value) { return SAPI(NULL)->Sciter_V2v(vm,value,out_script_value); } - - BOOL SCAPI SciterProcX(HWINDOW hwnd, SCITER_X_MSG* pMsg) { return SAPI(NULL)->SciterProcX(hwnd, pMsg); } - - HSARCHIVE SCAPI SciterOpenArchive (LPCBYTE archiveData, UINT archiveDataLength) { - return SAPI(NULL)->SciterOpenArchive (archiveData, archiveDataLength); - } - - BOOL SCAPI SciterGetArchiveItem (HSARCHIVE harc, LPCWSTR path, LPCBYTE* pdata, UINT* pdataLength) { - return SAPI(NULL)->SciterGetArchiveItem (harc, path, pdata, pdataLength); - } - - BOOL SCAPI SciterCloseArchive (HSARCHIVE harc) { - return SAPI(NULL)->SciterCloseArchive (harc); + + SCDOM_RESULT SCAPI Sciter_UseElement(HELEMENT he) { return SAPI()->Sciter_UseElement(he); } + SCDOM_RESULT SCAPI Sciter_UnuseElement(HELEMENT he) { return SAPI()->Sciter_UnuseElement(he); } + SCDOM_RESULT SCAPI SciterGetRootElement(HWINDOW hwnd, HELEMENT *phe) { return SAPI()->SciterGetRootElement(hwnd, phe); } + SCDOM_RESULT SCAPI SciterGetFocusElement(HWINDOW hwnd, HELEMENT *phe) { return SAPI()->SciterGetFocusElement(hwnd, phe); } + SCDOM_RESULT SCAPI SciterFindElement(HWINDOW hwnd, POINT pt, HELEMENT* phe) { return SAPI()->SciterFindElement(hwnd,pt,phe); } + SCDOM_RESULT SCAPI SciterGetChildrenCount(HELEMENT he, UINT* count) { return SAPI()->SciterGetChildrenCount(he, count); } + SCDOM_RESULT SCAPI SciterGetNthChild(HELEMENT he, UINT n, HELEMENT* phe) { return SAPI()->SciterGetNthChild(he,n,phe); } + SCDOM_RESULT SCAPI SciterGetParentElement(HELEMENT he, HELEMENT* p_parent_he) { return SAPI()->SciterGetParentElement(he,p_parent_he); } + SCDOM_RESULT SCAPI SciterGetElementHtmlCB(HELEMENT he, SBOOL outer, LPCBYTE_RECEIVER* rcv, LPVOID rcv_param) { return SAPI()->SciterGetElementHtmlCB( he, outer, rcv, rcv_param); } + SCDOM_RESULT SCAPI SciterGetElementTextCB(HELEMENT he, LPCWSTR_RECEIVER* rcv, LPVOID rcv_param) { return SAPI()->SciterGetElementTextCB(he, rcv, rcv_param); } + SCDOM_RESULT SCAPI SciterSetElementText(HELEMENT he, LPCWSTR utf16, UINT length) { return SAPI()->SciterSetElementText(he, utf16, length); } + SCDOM_RESULT SCAPI SciterGetAttributeCount(HELEMENT he, LPUINT p_count) { return SAPI()->SciterGetAttributeCount(he, p_count); } + SCDOM_RESULT SCAPI SciterGetNthAttributeNameCB(HELEMENT he, UINT n, LPCSTR_RECEIVER* rcv, LPVOID rcv_param) { return SAPI()->SciterGetNthAttributeNameCB(he,n,rcv,rcv_param); } + SCDOM_RESULT SCAPI SciterGetNthAttributeValueCB(HELEMENT he, UINT n, LPCWSTR_RECEIVER* rcv, LPVOID rcv_param) { return SAPI()->SciterGetNthAttributeValueCB(he, n, rcv, rcv_param); } + SCDOM_RESULT SCAPI SciterGetAttributeByNameCB(HELEMENT he, LPCSTR name, LPCWSTR_RECEIVER* rcv, LPVOID rcv_param) { return SAPI()->SciterGetAttributeByNameCB(he,name,rcv,rcv_param); } + SCDOM_RESULT SCAPI SciterSetAttributeByName(HELEMENT he, LPCSTR name, LPCWSTR value) { return SAPI()->SciterSetAttributeByName(he,name,value); } + SCDOM_RESULT SCAPI SciterClearAttributes(HELEMENT he) { return SAPI()->SciterClearAttributes(he); } + SCDOM_RESULT SCAPI SciterGetElementIndex(HELEMENT he, LPUINT p_index) { return SAPI()->SciterGetElementIndex(he,p_index); } + SCDOM_RESULT SCAPI SciterGetElementType(HELEMENT he, LPCSTR* p_type) { return SAPI()->SciterGetElementType(he,p_type); } + SCDOM_RESULT SCAPI SciterGetElementTypeCB(HELEMENT he, LPCSTR_RECEIVER* rcv, LPVOID rcv_param) { return SAPI()->SciterGetElementTypeCB(he,rcv,rcv_param); } + SCDOM_RESULT SCAPI SciterGetStyleAttributeCB(HELEMENT he, LPCSTR name, LPCWSTR_RECEIVER* rcv, LPVOID rcv_param) { return SAPI()->SciterGetStyleAttributeCB(he,name,rcv,rcv_param); } + SCDOM_RESULT SCAPI SciterSetStyleAttribute(HELEMENT he, LPCSTR name, LPCWSTR value) { return SAPI()->SciterSetStyleAttribute(he,name,value); } + SCDOM_RESULT SCAPI SciterGetElementLocation(HELEMENT he, LPRECT p_location, UINT areas /*ELEMENT_AREAS*/) { return SAPI()->SciterGetElementLocation(he,p_location,areas); } + SCDOM_RESULT SCAPI SciterScrollToView(HELEMENT he, UINT SciterScrollFlags) { return SAPI()->SciterScrollToView(he,SciterScrollFlags); } + SCDOM_RESULT SCAPI SciterUpdateElement(HELEMENT he, SBOOL andForceRender) { return SAPI()->SciterUpdateElement(he,andForceRender); } + SCDOM_RESULT SCAPI SciterRefreshElementArea(HELEMENT he, RECT rc) { return SAPI()->SciterRefreshElementArea(he,rc); } + SCDOM_RESULT SCAPI SciterSetCapture(HELEMENT he) { return SAPI()->SciterSetCapture(he); } + SCDOM_RESULT SCAPI SciterReleaseCapture(HELEMENT he) { return SAPI()->SciterReleaseCapture(he); } + SCDOM_RESULT SCAPI SciterGetElementHwnd(HELEMENT he, HWINDOW* p_hwnd, SBOOL rootWindow) { return SAPI()->SciterGetElementHwnd(he,p_hwnd,rootWindow); } + SCDOM_RESULT SCAPI SciterCombineURL(HELEMENT he, LPWSTR szUrlBuffer, UINT UrlBufferSize) { return SAPI()->SciterCombineURL(he,szUrlBuffer,UrlBufferSize); } + SCDOM_RESULT SCAPI SciterSelectElements(HELEMENT he, LPCSTR CSS_selectors, SciterElementCallback* callback, LPVOID param) { return SAPI()->SciterSelectElements(he,CSS_selectors,callback,param); } + SCDOM_RESULT SCAPI SciterSelectElementsW(HELEMENT he, LPCWSTR CSS_selectors, SciterElementCallback* callback, LPVOID param) { return SAPI()->SciterSelectElementsW(he,CSS_selectors,callback,param); } + SCDOM_RESULT SCAPI SciterSelectParent(HELEMENT he, LPCSTR selector, UINT depth, HELEMENT* heFound) { return SAPI()->SciterSelectParent(he,selector,depth,heFound); } + SCDOM_RESULT SCAPI SciterSelectParentW(HELEMENT he, LPCWSTR selector, UINT depth, HELEMENT* heFound) { return SAPI()->SciterSelectParentW(he,selector,depth,heFound); } + SCDOM_RESULT SCAPI SciterSetElementHtml(HELEMENT he, const BYTE* html, UINT htmlLength, UINT where) { return SAPI()->SciterSetElementHtml(he,html,htmlLength,where); } + SCDOM_RESULT SCAPI SciterGetElementUID(HELEMENT he, UINT* puid) { return SAPI()->SciterGetElementUID(he,puid); } + SCDOM_RESULT SCAPI SciterGetElementByUID(HWINDOW hwnd, UINT uid, HELEMENT* phe) { return SAPI()->SciterGetElementByUID(hwnd,uid,phe); } + SCDOM_RESULT SCAPI SciterShowPopup(HELEMENT hePopup, HELEMENT heAnchor, UINT placement) { return SAPI()->SciterShowPopup(hePopup,heAnchor,placement); } + SCDOM_RESULT SCAPI SciterShowPopupAt(HELEMENT hePopup, POINT pos, UINT placement) { return SAPI()->SciterShowPopupAt(hePopup,pos,placement); } + SCDOM_RESULT SCAPI SciterHidePopup(HELEMENT he) { return SAPI()->SciterHidePopup(he); } + SCDOM_RESULT SCAPI SciterGetElementState( HELEMENT he, UINT* pstateBits) { return SAPI()->SciterGetElementState(he,pstateBits); } + SCDOM_RESULT SCAPI SciterSetElementState( HELEMENT he, UINT stateBitsToSet, UINT stateBitsToClear, SBOOL updateView) { return SAPI()->SciterSetElementState(he,stateBitsToSet,stateBitsToClear,updateView); } + SCDOM_RESULT SCAPI SciterCreateElement( LPCSTR tagname, LPCWSTR textOrNull, /*out*/ HELEMENT *phe ) { return SAPI()->SciterCreateElement(tagname,textOrNull,phe ); } + SCDOM_RESULT SCAPI SciterCloneElement( HELEMENT he, /*out*/ HELEMENT *phe ) { return SAPI()->SciterCloneElement(he,phe ); } + SCDOM_RESULT SCAPI SciterInsertElement( HELEMENT he, HELEMENT hparent, UINT index ) { return SAPI()->SciterInsertElement(he,hparent,index ); } + SCDOM_RESULT SCAPI SciterDetachElement( HELEMENT he ) { return SAPI()->SciterDetachElement( he ); } + SCDOM_RESULT SCAPI SciterDeleteElement(HELEMENT he) { return SAPI()->SciterDeleteElement(he); } + SCDOM_RESULT SCAPI SciterSetTimer( HELEMENT he, UINT milliseconds, UINT_PTR timer_id ) { return SAPI()->SciterSetTimer(he,milliseconds,timer_id ); } + SCDOM_RESULT SCAPI SciterDetachEventHandler( HELEMENT he, LPELEMENT_EVENT_PROC pep, LPVOID tag ) { return SAPI()->SciterDetachEventHandler(he,pep,tag ); } + SCDOM_RESULT SCAPI SciterAttachEventHandler( HELEMENT he, LPELEMENT_EVENT_PROC pep, LPVOID tag ) { return SAPI()->SciterAttachEventHandler( he,pep,tag ); } + SCDOM_RESULT SCAPI SciterWindowAttachEventHandler( HWINDOW hwndLayout, LPELEMENT_EVENT_PROC pep, LPVOID tag, UINT subscription ) { return SAPI()->SciterWindowAttachEventHandler(hwndLayout,pep,tag,subscription ); } + SCDOM_RESULT SCAPI SciterWindowDetachEventHandler( HWINDOW hwndLayout, LPELEMENT_EVENT_PROC pep, LPVOID tag ) { return SAPI()->SciterWindowDetachEventHandler(hwndLayout,pep,tag ); } + SCDOM_RESULT SCAPI SciterSendEvent( HELEMENT he, UINT appEventCode, HELEMENT heSource, UINT_PTR reason, /*out*/ SBOOL* handled) { return SAPI()->SciterSendEvent( he,appEventCode,heSource,reason,handled); } + SCDOM_RESULT SCAPI SciterPostEvent( HELEMENT he, UINT appEventCode, HELEMENT heSource, UINT_PTR reason) { return SAPI()->SciterPostEvent(he,appEventCode,heSource,reason); } + SCDOM_RESULT SCAPI SciterFireEvent( const BEHAVIOR_EVENT_PARAMS* evt, SBOOL post, SBOOL *handled) { return SAPI()->SciterFireEvent( evt, post, handled ); } + SCDOM_RESULT SCAPI SciterCallBehaviorMethod(HELEMENT he, struct METHOD_PARAMS* params) { return SAPI()->SciterCallBehaviorMethod(he,params); } + SCDOM_RESULT SCAPI SciterRequestElementData( HELEMENT he, LPCWSTR url, UINT dataType, HELEMENT initiator ) { return SAPI()->SciterRequestElementData(he,url,dataType,initiator ); } + SCDOM_RESULT SCAPI SciterHttpRequest( HELEMENT he, LPCWSTR url, UINT dataType, UINT requestType, struct REQUEST_PARAM* requestParams, UINT nParams) { return SAPI()->SciterHttpRequest(he,url,dataType,requestType,requestParams,nParams); } + SCDOM_RESULT SCAPI SciterGetScrollInfo( HELEMENT he, LPPOINT scrollPos, LPRECT viewRect, LPSIZE contentSize ) { return SAPI()->SciterGetScrollInfo( he,scrollPos,viewRect,contentSize ); } + SCDOM_RESULT SCAPI SciterSetScrollPos( HELEMENT he, POINT scrollPos, SBOOL smooth ) { return SAPI()->SciterSetScrollPos( he,scrollPos,smooth ); } + SCDOM_RESULT SCAPI SciterGetElementIntrinsicWidths( HELEMENT he, INT* pMinWidth, INT* pMaxWidth ) { return SAPI()->SciterGetElementIntrinsicWidths(he,pMinWidth,pMaxWidth ); } + SCDOM_RESULT SCAPI SciterGetElementIntrinsicHeight( HELEMENT he, INT forWidth, INT* pHeight ) { return SAPI()->SciterGetElementIntrinsicHeight( he,forWidth,pHeight ); } + SCDOM_RESULT SCAPI SciterIsElementVisible( HELEMENT he, SBOOL* pVisible) { return SAPI()->SciterIsElementVisible( he,pVisible); } + SCDOM_RESULT SCAPI SciterIsElementEnabled( HELEMENT he, SBOOL* pEnabled ) { return SAPI()->SciterIsElementEnabled( he, pEnabled ); } + SCDOM_RESULT SCAPI SciterSortElements( HELEMENT he, UINT firstIndex, UINT lastIndex, ELEMENT_COMPARATOR* cmpFunc, LPVOID cmpFuncParam ) { return SAPI()->SciterSortElements( he, firstIndex, lastIndex, cmpFunc, cmpFuncParam ); } + SCDOM_RESULT SCAPI SciterSwapElements( HELEMENT he1, HELEMENT he2 ) { return SAPI()->SciterSwapElements( he1,he2 ); } + SCDOM_RESULT SCAPI SciterTraverseUIEvent( UINT evt, LPVOID eventCtlStruct, SBOOL* bOutProcessed ) { return SAPI()->SciterTraverseUIEvent( evt,eventCtlStruct,bOutProcessed ); } + SCDOM_RESULT SCAPI SciterCallScriptingMethod( HELEMENT he, LPCSTR name, const VALUE* argv, UINT argc, VALUE* retval ) { return SAPI()->SciterCallScriptingMethod( he,name,argv,argc,retval ); } + SCDOM_RESULT SCAPI SciterCallScriptingFunction( HELEMENT he, LPCSTR name, const VALUE* argv, UINT argc, VALUE* retval ) { return SAPI()->SciterCallScriptingFunction( he,name,argv,argc,retval ); } + SCDOM_RESULT SCAPI SciterEvalElementScript( HELEMENT he, LPCWSTR script, UINT scriptLength, VALUE* retval ) { return SAPI()->SciterEvalElementScript( he, script, scriptLength, retval ); } + SCDOM_RESULT SCAPI SciterAttachHwndToElement(HELEMENT he, HWINDOW hwnd) { return SAPI()->SciterAttachHwndToElement(he,hwnd); } + SCDOM_RESULT SCAPI SciterControlGetType( HELEMENT he, /*CTL_TYPE*/ UINT *pType ) { return SAPI()->SciterControlGetType( he, pType ); } + SCDOM_RESULT SCAPI SciterGetValue( HELEMENT he, VALUE* pval ) { return SAPI()->SciterGetValue( he,pval ); } + SCDOM_RESULT SCAPI SciterSetValue( HELEMENT he, const VALUE* pval ) { return SAPI()->SciterSetValue( he, pval ); } + SCDOM_RESULT SCAPI SciterGetExpando( HELEMENT he, VALUE* pval, SBOOL forceCreation ) { return SAPI()->SciterGetExpando( he, pval, forceCreation ); } + //SCDOM_RESULT SCAPI SciterGetObject( HELEMENT he, void* pval, SBOOL forceCreation ) { return SAPI()->SciterGetObject( he, pval, forceCreation ); } + //SCDOM_RESULT SCAPI SciterGetElementNamespace( HELEMENT he, void* pval) { return SAPI()->SciterGetElementNamespace( he,pval); } + SCDOM_RESULT SCAPI SciterGetHighlightedElement(HWINDOW hwnd, HELEMENT* phe) { return SAPI()->SciterGetHighlightedElement(hwnd, phe); } + SCDOM_RESULT SCAPI SciterSetHighlightedElement(HWINDOW hwnd, HELEMENT he) { return SAPI()->SciterSetHighlightedElement(hwnd,he); } + SCDOM_RESULT SCAPI SciterNodeAddRef(HNODE hn) { return SAPI()->SciterNodeAddRef(hn); } + SCDOM_RESULT SCAPI SciterNodeRelease(HNODE hn) { return SAPI()->SciterNodeRelease(hn); } + SCDOM_RESULT SCAPI SciterNodeCastFromElement(HELEMENT he, HNODE* phn) { return SAPI()->SciterNodeCastFromElement(he,phn); } + SCDOM_RESULT SCAPI SciterNodeCastToElement(HNODE hn, HELEMENT* he) { return SAPI()->SciterNodeCastToElement(hn,he); } + SCDOM_RESULT SCAPI SciterNodeFirstChild(HNODE hn, HNODE* phn) { return SAPI()->SciterNodeFirstChild(hn,phn); } + SCDOM_RESULT SCAPI SciterNodeLastChild(HNODE hn, HNODE* phn) { return SAPI()->SciterNodeLastChild(hn, phn); } + SCDOM_RESULT SCAPI SciterNodeNextSibling(HNODE hn, HNODE* phn) { return SAPI()->SciterNodeNextSibling(hn, phn); } + SCDOM_RESULT SCAPI SciterNodePrevSibling(HNODE hn, HNODE* phn) { return SAPI()->SciterNodePrevSibling(hn,phn); } + SCDOM_RESULT SCAPI SciterNodeParent(HNODE hnode, HELEMENT* pheParent) { return SAPI()->SciterNodeParent(hnode,pheParent) ; } + SCDOM_RESULT SCAPI SciterNodeNthChild(HNODE hnode, UINT n, HNODE* phn) { return SAPI()->SciterNodeNthChild(hnode,n,phn); } + SCDOM_RESULT SCAPI SciterNodeChildrenCount(HNODE hnode, UINT* pn) { return SAPI()->SciterNodeChildrenCount(hnode, pn); } + SCDOM_RESULT SCAPI SciterNodeType(HNODE hnode, UINT* pNodeType /*NODE_TYPE*/) { return SAPI()->SciterNodeType(hnode,pNodeType); } + SCDOM_RESULT SCAPI SciterNodeGetText(HNODE hnode, LPCWSTR_RECEIVER* rcv, LPVOID rcv_param) { return SAPI()->SciterNodeGetText(hnode,rcv,rcv_param); } + SCDOM_RESULT SCAPI SciterNodeSetText(HNODE hnode, LPCWSTR text, UINT textLength) { return SAPI()->SciterNodeSetText(hnode,text,textLength); } + SCDOM_RESULT SCAPI SciterNodeInsert(HNODE hnode, UINT where /*NODE_INS_TARGET*/, HNODE what) { return SAPI()->SciterNodeInsert(hnode,where,what); } + SCDOM_RESULT SCAPI SciterNodeRemove(HNODE hnode, SBOOL finalize) { return SAPI()->SciterNodeRemove(hnode,finalize); } + SCDOM_RESULT SCAPI SciterCreateTextNode(LPCWSTR text, UINT textLength, HNODE* phnode) { return SAPI()->SciterCreateTextNode(text,textLength,phnode); } + SCDOM_RESULT SCAPI SciterCreateCommentNode(LPCWSTR text, UINT textLength, HNODE* phnode) { return SAPI()->SciterCreateCommentNode(text,textLength,phnode); } + + //HVM SCAPI SciterGetVM( HWINDOW hwnd ) { return SAPI()->SciterGetVM(hwnd); } + + UINT SCAPI ValueInit ( VALUE* pval ) { return SAPI()->ValueInit(pval); } + UINT SCAPI ValueClear ( VALUE* pval ) { return SAPI()->ValueClear(pval); } + UINT SCAPI ValueCompare ( const VALUE* pval1, const VALUE* pval2 ) { return SAPI()->ValueCompare(pval1,pval2); } + UINT SCAPI ValueCopy ( VALUE* pdst, const VALUE* psrc ) { return SAPI()->ValueCopy(pdst, psrc); } + UINT SCAPI ValueIsolate ( VALUE* pdst ) { return SAPI()->ValueIsolate(pdst); } + UINT SCAPI ValueType ( const VALUE* pval, UINT* pType, UINT* pUnits ) { return SAPI()->ValueType(pval,pType,pUnits); } + UINT SCAPI ValueStringData ( const VALUE* pval, LPCWSTR* pChars, UINT* pNumChars ) { return SAPI()->ValueStringData(pval,pChars,pNumChars); } + UINT SCAPI ValueStringDataSet ( VALUE* pval, LPCWSTR chars, UINT numChars, UINT units ) { return SAPI()->ValueStringDataSet(pval, chars, numChars, units); } + UINT SCAPI ValueIntData ( const VALUE* pval, INT* pData ) { return SAPI()->ValueIntData ( pval, pData ); } + UINT SCAPI ValueIntDataSet ( VALUE* pval, INT data, UINT type, UINT units ) { return SAPI()->ValueIntDataSet ( pval, data,type,units ); } + UINT SCAPI ValueInt64Data ( const VALUE* pval, INT64* pData ) { return SAPI()->ValueInt64Data ( pval,pData ); } + UINT SCAPI ValueInt64DataSet ( VALUE* pval, INT64 data, UINT type, UINT units ) { return SAPI()->ValueInt64DataSet ( pval,data,type,units ); } + UINT SCAPI ValueFloatData ( const VALUE* pval, FLOAT_VALUE* pData ) { return SAPI()->ValueFloatData ( pval,pData ); } + UINT SCAPI ValueFloatDataSet ( VALUE* pval, FLOAT_VALUE data, UINT type, UINT units ) { return SAPI()->ValueFloatDataSet ( pval,data,type,units ); } + UINT SCAPI ValueBinaryData ( const VALUE* pval, LPCBYTE* pBytes, UINT* pnBytes ) { return SAPI()->ValueBinaryData ( pval,pBytes,pnBytes ); } + UINT SCAPI ValueBinaryDataSet ( VALUE* pval, LPCBYTE pBytes, UINT nBytes, UINT type, UINT units ) { return SAPI()->ValueBinaryDataSet ( pval,pBytes,nBytes,type,units ); } + UINT SCAPI ValueElementsCount ( const VALUE* pval, INT* pn) { return SAPI()->ValueElementsCount ( pval,pn); } + UINT SCAPI ValueNthElementValue ( const VALUE* pval, INT n, VALUE* pretval) { return SAPI()->ValueNthElementValue ( pval, n, pretval); } + UINT SCAPI ValueNthElementValueSet ( VALUE* pval, INT n, const VALUE* pval_to_set) { return SAPI()->ValueNthElementValueSet ( pval,n,pval_to_set); } + UINT SCAPI ValueNthElementKey ( const VALUE* pval, INT n, VALUE* pretval) { return SAPI()->ValueNthElementKey ( pval,n,pretval); } + UINT SCAPI ValueEnumElements ( const VALUE* pval, KeyValueCallback* penum, LPVOID param) { return SAPI()->ValueEnumElements (pval,penum,param); } + UINT SCAPI ValueSetValueToKey ( VALUE* pval, const VALUE* pkey, const VALUE* pval_to_set) { return SAPI()->ValueSetValueToKey ( pval, pkey, pval_to_set); } + UINT SCAPI ValueGetValueOfKey ( const VALUE* pval, const VALUE* pkey, VALUE* pretval) { return SAPI()->ValueGetValueOfKey ( pval, pkey,pretval); } + UINT SCAPI ValueToString ( VALUE* pval, UINT how ) { return SAPI()->ValueToString ( pval,how ); } + UINT SCAPI ValueFromString ( VALUE* pval, LPCWSTR str, UINT strLength, UINT how ) { return SAPI()->ValueFromString ( pval, str,strLength,how ); } + UINT SCAPI ValueInvoke ( const VALUE* pval, VALUE* pthis, UINT argc, const VALUE* argv, VALUE* pretval, LPCWSTR url) { return SAPI()->ValueInvoke ( pval, pthis, argc, argv, pretval, url); } + UINT SCAPI ValueNativeFunctorSet (VALUE* pval, NATIVE_FUNCTOR_INVOKE* pinvoke, NATIVE_FUNCTOR_RELEASE* prelease, VOID* tag ) { return SAPI()->ValueNativeFunctorSet ( pval, pinvoke,prelease,tag); } + SBOOL SCAPI ValueIsNativeFunctor ( const VALUE* pval) { return SAPI()->ValueIsNativeFunctor (pval); } + + HSARCHIVE SCAPI SciterOpenArchive (LPCBYTE archiveData, UINT archiveDataLength) { return SAPI()->SciterOpenArchive (archiveData,archiveDataLength); } + SBOOL SCAPI SciterGetArchiveItem (HSARCHIVE harc, LPCWSTR path, LPCBYTE* pdata, UINT* pdataLength){ return SAPI()->SciterGetArchiveItem (harc,path,pdata,pdataLength); } + SBOOL SCAPI SciterCloseArchive (HSARCHIVE harc) { return SAPI()->SciterCloseArchive(harc); } + +#if defined(WINDOWS) && !defined(WINDOWLESS) + SBOOL SCAPI SciterCreateOnDirectXWindow(HWINDOW hwnd, IUnknown* pSwapChain) { return SAPI()->SciterCreateOnDirectXWindow(hwnd,pSwapChain); } + SBOOL SCAPI SciterRenderOnDirectXWindow(HWINDOW hwnd, HELEMENT elementToRenderOrNull, SBOOL frontLayer) { return SAPI()->SciterRenderOnDirectXWindow(hwnd,elementToRenderOrNull,frontLayer); } + SBOOL SCAPI SciterRenderOnDirectXTexture(HWINDOW hwnd, HELEMENT elementToRenderOrNull, IUnknown* surface) { return SAPI()->SciterRenderOnDirectXTexture(hwnd,elementToRenderOrNull,surface); } +#endif + + SBOOL SCAPI SciterProcX(HWINDOW hwnd, SCITER_X_MSG* pMsg) { return SAPI()->SciterProcX(hwnd, pMsg); } +#ifdef __cplusplus + template + SBOOL SCAPI SciterProcX(HWINDOW hwnd, const MSG &msg) { + static_assert(offsetof(MSG, header) == 0, "must contain SCITER_X_MSG as first memeber"); + static_assert(std::is_same::value, "must contain SCITER_X_MSG"); + return SAPI()->SciterProcX(hwnd, (SCITER_X_MSG*)(&msg)); } +#endif + + UINT64 SCAPI SciterAtomValue(const char* name) { return SAPI()->SciterAtomValue(name); } + UINT64 SCAPI SciterAtomNameCB(UINT64 atomv, LPCSTR_RECEIVER* rcv, LPVOID rcv_param) { return SAPI()->SciterAtomNameCB(atomv, rcv, rcv_param); } + SBOOL SCAPI SciterSetGlobalAsset(som_asset_t* pass) { return SAPI()->SciterSetGlobalAsset(pass); } + + UINT SCAPI SciterElementUnwrap(const VALUE* pval, HELEMENT* ppElement) { return SAPI()->SciterElementUnwrap(pval, ppElement); } + UINT SCAPI SciterElementWrap(VALUE* pval, HELEMENT pElement) { return SAPI()->SciterElementWrap(pval, pElement); } + + UINT SCAPI SciterNodeUnwrap(const VALUE* pval, HNODE* ppNode) { return SAPI()->SciterNodeUnwrap(pval, ppNode); } + UINT SCAPI SciterNodeWrap(VALUE* pval, HNODE pNode) { return SAPI()->SciterNodeWrap(pval, pNode); } diff --git a/sciter.go b/sciter.go index 731d137..5171fa7 100644 --- a/sciter.go +++ b/sciter.go @@ -11,11 +11,11 @@ package sciter #include "sciter-x.h" -extern BOOL SC_CALLBACK SciterElementCallback_cgo(HELEMENT he, LPVOID param); +extern SBOOL SC_CALLBACK SciterElementCallback_cgo(HELEMENT he, LPVOID param); extern VOID SC_CALLBACK LPCSTR_RECEIVER_cgo( LPCSTR str, UINT str_length, LPVOID param ); extern VOID SC_CALLBACK LPCWSTR_RECEIVER_cgo( LPCWSTR str, UINT str_length, LPVOID param ); extern VOID SC_CALLBACK LPCBYTE_RECEIVER_cgo( LPCBYTE bytes, UINT num_bytes, LPVOID param ); -extern BOOL SC_CALLBACK ElementEventProc_cgo(LPVOID tag, HELEMENT he, UINT evtg, LPVOID prms ); +extern SBOOL SC_CALLBACK ElementEventProc_cgo(LPVOID tag, HELEMENT he, UINT evtg, LPVOID prms ); extern UINT SC_CALLBACK SciterHostCallback_cgo( LPSCITER_CALLBACK_NOTIFICATION pns, LPVOID callbackParam ); // native functor extern VOID NATIVE_FUNCTOR_INVOKE_cgo( VOID* tag, UINT argc, const VALUE* argv, VALUE* retval); @@ -23,15 +23,15 @@ extern VOID NATIVE_FUNCTOR_RELEASE_cgo( VOID* tag ); // cmp extern INT SC_CALLBACK ELEMENT_COMPARATOR_cgo( HELEMENT he1, HELEMENT he2, LPVOID param ); // ValueEnumElements -extern BOOL SC_CALLBACK KeyValueCallback_cgo(LPVOID param, const VALUE* pkey, const VALUE* pval ); +extern SBOOL SC_CALLBACK KeyValueCallback_cgo(LPVOID param, const VALUE* pkey, const VALUE* pval ); extern const char * SCITER_DLL_PATH; extern HSARCHIVE SCAPI SciterOpenArchive (LPCBYTE archiveData, UINT archiveDataLength); -extern BOOL SCAPI SciterGetArchiveItem (HSARCHIVE harc, LPCWSTR path, LPCBYTE* pdata, UINT* pdataLength); +extern SBOOL SCAPI SciterGetArchiveItem (HSARCHIVE harc, LPCWSTR path, LPCBYTE* pdata, UINT* pdataLength); -extern BOOL SCAPI SciterCloseArchive (HSARCHIVE harc); +extern SBOOL SCAPI SciterCloseArchive (HSARCHIVE harc); */ import "C" @@ -73,9 +73,9 @@ func ClassName() string { func Version(major bool) uint { var v C.UINT if major { - v = C.SciterVersion(C.BOOL(1)) + v = C.SciterVersion(C.SBOOL(1)) } else { - v = C.SciterVersion(C.BOOL(0)) + v = C.SciterVersion(C.SBOOL(0)) } return uint(v) } @@ -788,9 +788,9 @@ var ( func (e *Element) Html(outer bool) (string, error) { var bs []byte // args - couter := C.BOOL(C.FALSE) + couter := C.SBOOL(C.FALSE) if outer { - couter = C.BOOL(C.TRUE) + couter = C.SBOOL(C.TRUE) } cparam := C.LPVOID(unsafe.Pointer(&bs)) // cgo call @@ -1013,7 +1013,7 @@ func (e *Element) ScrollToView(flag SCITER_SCROLL_FLAGS) error { // \return \b #SCDOM_RESULT SCAPI func (e *Element) Update(forceRender bool) error { // args - var cforceRender C.BOOL = C.FALSE + var cforceRender C.SBOOL = C.FALSE if forceRender { cforceRender = C.TRUE } @@ -1045,7 +1045,7 @@ func (e *Element) ReleaseCapture() error { // Get HWINDOW of containing window. func (e *Element) GetHwnd(rootWindow bool) (hwnd C.HWINDOW, err error) { // args - var crootWindow C.BOOL = C.FALSE + var crootWindow C.SBOOL = C.FALSE if rootWindow { crootWindow = C.TRUE } @@ -1273,7 +1273,7 @@ func (e *Element) SetState(bitsToSet, bitsToClear ElementState, updateView bool) // args cbitsToSet := C.UINT(bitsToSet) cbitsToClear := C.UINT(bitsToClear) - var cupdateView C.BOOL = C.FALSE + var cupdateView C.SBOOL = C.FALSE if updateView { cupdateView = C.TRUE } @@ -1726,7 +1726,7 @@ func (e *Element) HttpRequest(url string, dataType SciterResourceType, requestTy // \param[out] pVisible \b LPBOOL, visibility state. func (e *Element) IsVisible() bool { // args - var v C.BOOL + var v C.SBOOL // cgo call C.SciterIsElementVisible(e.handle, &v) if v == C.TRUE { @@ -1743,7 +1743,7 @@ func (e *Element) IsVisible() bool { // \param[out] pEnabled \b LPBOOL, enabled state. func (e *Element) IsEnabled() bool { // args - var v C.BOOL + var v C.SBOOL // cgo call C.SciterIsElementEnabled(e.handle, &v) if v == C.TRUE {