Window and Initialization


SciterClassName

Intializes the library and returns child window class.

parameters: (none)
returns: LPCWSTR name of Sciter child window class.
NULL if initialization of the engine has failed.

Use this function if you wish to create Sciter as a child window. The returned name can be used in CreateWindow(Ex)W function on Windows.

SciterVersion

Returns major and minor version of Sciter engine.
parameters: major BOOL TRUE – major part of version, FALSE – minor part of version
returns: UINT High and low words of the UINT contains pair of version/subversion numbers.

Example:

UINT version = SciterVersion(true);
// version -> 0x0301 for sciter version 3.1.0.4

SciterProc

[Windows only] Sciter window procedure that can be used in ::RegisterClass().

parameters: hwnd HWINDOW window handler
msg UINT Windows message code
wParam WPARAM wparam
lParam LPARAM lparam
returns: LRESULT standard lresult value

This function calls ::DefWindowProc() on all non-handled window messages.

SciterProcND

[Windows only] Partial implementation of Sciter window procedure that can be used for "mix-in" type of Sciter integration.

parameters: hwnd HWINDOW window handler
msg UINT Windows message code
wParam WPARAM wparam
lParam LPARAM lparam
pbHandled BOOL* address of handled/not handled flag, Sciter sets it to TRUE if it a) handles the message and b) that message shall not be passed to ::DefWindowProc().
returns: LRESULT standard lresult value

This function does not call ::DefWindowProc().

SciterDataReady

This function is used in response to SCN_LOAD_DATA request to supply data requested by the engine.

parameters: hwnd HWINDOW window handler
uri LPCWSTR Url of data request
data LPCBYTE pointer to buffer containing the data
dataLength UINT length of the buffer – number of bytes.
returns: BOOL TRUE if data is accepted by the engine, FALSE – otherwise.

After the call application can free the data buffer as the engine makes copy of it.

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

SciterDataReadyAsync

This function is used in response to SCN_LOAD_DATA request to supply data requested by the engine.

parameters: hwnd HWINDOW window handler
uri LPCWSTR Url of data request
data LPCBYTE pointer to buffer containing the data
dataLength UINT length of the buffer – number of bytes
requestId LPVOID SCN_LOAD_DATA requestId
returns: BOOL TRUE if data is accepted by the engine, FALSE – otherwise.

After the call application can free the data buffer as the engine makes copy of it.

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.

SciterLoadFile

Load HTML file from local drive or from remote location.

parameters: hwnd HWINDOW sciter window handler
uri LPCWSTR url of document to load
returns: BOOL TRUE if document is parsed by the engine, FALSE – otherwise.

This function can be used to load HTML into Sciter window from app specific storage as it generates SC_LOAD_DATA callback.

SciterLoadHtml

Load HTML from memory location.

parameters: hwnd HWINDOW sciter window handler
html LPCBYTE address of HTML buffer to load
htmlSize UINT Length of buffer pointed by html parameter
baseUri LPCWSTR base url used to resolve relative links in the document.
returns: BOOL TRUE if document is parsed by the engine, FALSE – otherwise.

SciterSetCallback

Load HTML file from local drive or from remote location.

parameters: hwnd HWINDOW sciter window handler
callback SciterHostCallback* address of callback function handling callbacks
callbackParam LPVOID parameter passed to callback function as it is
returns: VOID

This function is used to attach callback function to Sciter instance to handle various callbacks and notifications, see: SC_LOAD_DATA , SC_DATA_LOADED, etc.

SciterHostCallback is a function that has the following signature:

UINT SC_CALLBACK SciterHostCallback( LPSCITER_CALLBACK_NOTIFICATION pns, LPVOID callbackParam );

where LPSCITER_CALLBACK_NOTIFICATION is an address of corresponding structure: SCN_LOAD_DATA, SCN_DATA_LOADED, etc.

SciterSetMasterCSS

Styling of all standard HTML elements in Sciter is defined in so called "master style sheet" (CSS resource). This function allows to provide application specific version of all default styles.

parameters: utf8 LPCBYTE utf8 encoded CSS data
numBytes UINT length of CSS data
returns: BOOL TRUE if parsing was successful

Call this function at the start up of your application – before creation of Sciter windows.

SciterAppendMasterCSS

Typedefs

HWINDOW

window handle, on Windows that is HWND that represents as window as its client part. On other OSes it is a root child widget representing client portion of the window.

Windows HWND Window handle
OS X NSView* root NSView of OS X window.
Linux/GTK GtkWidget* root widget of GTK window.

Constants and Enumerations

Callback/notification codes

Notification codes received by function set by SciterSetCallback

SC_LOAD_DATA 1 Request to load data, see SCN_LOAD_DATA
SC_DATA_LOADED 2 Notification, data is received, see SCN_DATA_LOADED
SC_ATTACH_BEHAVIOR 4 Request to attach specific behavior to DOM element. behaviors are defined in CSS but implemented in native code.
SC_ENGINE_DESTROYED 5 This notification is sent when instance of the engine is destroyed. This is always a final notification.

enum SciterResourceType

Defines type of data requested by the engine.

values:
RT_DATA_HTML 0 HTML data requested
RT_DATA_IMAGE 1 image data requested
RT_DATA_STYLE 2 CSS data requested
RT_DATA_CURSOR 3 cursor data requested
RT_DATA_SCRIPT 4 script requested
RT_DATA_RAW 5 raw data requested – data of any or unknown type

Structures

struct SCN_LOAD_DATA

Structure passed by the engine in SC_LOAD_DATA callback notification.

Fields:
code UINT SC_LOAD_DATA value
hwnd HWINDOW window handler
uri LPCWSTR Url of data request
outData LPCBYTE pointer to buffer containing the data
outDataLength UINT length of the buffer – number of bytes
dataType UINT one of SciterResourceType values
requestId LPVOID requestId used for indentification of particular request
principal HELEMENT element handle – receiver of the data
initiator HELEMENT element handle – initiator of the request, usually is the same as the principal