Documentation
¶
Overview ¶
This package provides a Golang bindings of Sciter using cgo. Using go sciter you must have the platform specified sciter dynamic library downloaded from sciter-sdk, the library itself is rather small (under 5MB, less than 2MB when upxed) .
Index ¶
- Constants
- Variables
- func AppendMasterCSS(data string) (ok bool)
- func ByteCPtrToBytes(bp C.LPCBYTE, size C.UINT) []byte
- func BytePtrToBytes(bp *byte, size uint) []byte
- func ClassName() string
- func CreateWindow(createFlags WindowCreationFlag, rect *Rect, delegate uintptr, ...) C.HWINDOW
- func SetDLL(dir string)
- func SetMasterCSS(data string) (ok bool)
- func SetOption(option Sciter_RT_OPTIONS, value uint) (ok bool)
- func StringToBytePtr(s string) *byte
- func StringToUTF16Ptr(s string) *uint16
- func StringToUTF16PtrWithLen(s string) (*uint16, int)
- func StringToWcharPtr(s string) *C.WCHAR
- func Utf16FromString(s string) ([]uint16, error)
- func Utf16ToString(s *uint16) string
- func Utf16ToStringLength(s *uint16, length int) string
- func Version(major bool) uint
- func VersionAsString() string
- type BehaviorEvent
- type BehaviorEventParams
- type BehaviorMethodIdentifier
- type CallbackHandler
- type CursorType
- type DDMode
- type DataArrivedParams
- type DraggingType
- type DrawEvent
- type DrawParams
- type EditChangedReason
- type Element
- func (e *Element) Append(el *Element) error
- func (e *Element) AttachEventHandler(handler *EventHandler) error
- func (e *Element) Attr(name string) (string, error)
- func (e *Element) AttrCount() (int, error)
- func (e *Element) CallFunction(functionName string, args ...*Value) (retval *Value, err error)
- func (e *Element) CallMethod(methodName string, args ...*Value) (retval *Value, err error)
- func (e *Element) Capture() error
- func (e *Element) ChildrenCount() (int, error)
- func (e *Element) Clear() error
- func (e *Element) ClearAttr() error
- func (e *Element) Clone() (*Element, error)
- func (e *Element) CombineURL(url string) (combinedUrl string, err error)
- func (e *Element) DefineMethod(name string, nf func(args ...*Value) *Value)
- func (e *Element) Delete() error
- func (e *Element) Detach() error
- func (e *Element) DetachEventHandler(handler *EventHandler) error
- func (e *Element) GetHwnd(rootWindow bool) (hwnd C.HWINDOW, err error)
- func (e *Element) GetValue() (*Value, error)
- func (e *Element) HidePopup() error
- func (e *Element) Html(outer bool) (string, error)
- func (e *Element) HttpRequest(url string, dataType SciterResourceType, requestType RequestType, ...) error
- func (e *Element) Index() (idx int, err error)
- func (e *Element) Insert(el *Element, index int) error
- func (e *Element) IsEnabled() bool
- func (e *Element) IsVisible() bool
- func (e *Element) Load(url string, dataType SciterResourceType) error
- func (e *Element) MustSelectById(id string) *Element
- func (e *Element) MustSelectUnique(selector string) *Element
- func (e *Element) NthAttr(n int) (value string, err error)
- func (e *Element) NthAttrName(n int) (name string, err error)
- func (e *Element) NthChild(n int) (*Element, error)
- func (e *Element) OnClick(fn func())
- func (e *Element) ParentElement() (*Element, error)
- func (e *Element) ReleaseCapture() error
- func (e *Element) ScrollToView(flag SCITER_SCROLL_FLAGS) error
- func (e *Element) Select(css_selectors string) ([]*Element, error)
- func (e *Element) SelectById(id string) (*Element, error)
- func (e *Element) SelectFirst(css_selectors string) (*Element, error)
- func (e *Element) SelectParent(css_selector string, depth int) (*Element, error)
- func (e *Element) SelectUnique(selector string) (*Element, error)
- func (e *Element) SetAttr(name, val string) error
- func (e *Element) SetHtml(html string, where SET_ELEMENT_HTML) error
- func (e *Element) SetState(bitsToSet, bitsToClear ElementState, updateView bool) error
- func (e *Element) SetStyle(name, val string) error
- func (e *Element) SetText(text string) error
- func (e *Element) SetTimer(milliseconds int) error
- func (e *Element) SetValue(v *Value) error
- func (e *Element) ShowPopup(eAnchor *Element, placement PopupPlacement) error
- func (e *Element) ShowPopupAt(pos Point, placement uint) error
- func (e *Element) Sort(start, count int, comparator func(*Element, *Element) int) error
- func (e *Element) SortChildren(comparator func(*Element, *Element) int) error
- func (e *Element) State() (ElementState, error)
- func (e *Element) Style(name string) (string, error)
- func (e *Element) Swap(t *Element) error
- func (e *Element) Text() (string, error)
- func (e *Element) Type() (string, error)
- func (e *Element) UID() (uint, error)
- func (e *Element) Update(forceRender bool) error
- type ElementState
- type EventHandler
- type EventReason
- type ExchangeCmd
- type ExchangeParams
- type FocusEvent
- type FocusParams
- type GestureCmd
- type GestureParams
- type GestureState
- type GestureTypeFlag
- type HVM
- type InitializationParams
- type KeyEvent
- type KeyParams
- type KeyValueCallback
- type KeyboardState
- type MethodParams
- type MouseButton
- type MouseEvent
- type MouseParams
- type NativeFunctor
- type PTiscriptVM
- type PhaseMask
- type Point
- type PopupPlacement
- type REQUEST_RESULT
- type Rect
- type Request
- func (r *Request) AppendDataChunk(data []byte) error
- func (r *Request) CompletionStatus() (uint, uint, error)
- func (r *Request) ContentUrl() (string, error)
- func (r *Request) Data() ([]byte, error)
- func (r *Request) NthParameterName(idx uint) (string, error)
- func (r *Request) NthParameterValue(idx uint) (string, error)
- func (r *Request) NthRqHeaderName(idx uint) (string, error)
- func (r *Request) NthRqHeaderValue(idx uint) (string, error)
- func (r *Request) NthRspHeaderName(idx uint) (string, error)
- func (r *Request) NthRspHeaderValue(idx uint) (string, error)
- func (r *Request) NumberOfParameters() (uint, error)
- func (r *Request) NumberOfRqHeaders() (uint, error)
- func (r *Request) NumberOfRspHeaders() (uint, error)
- func (r *Request) ProxyHost() (string, error)
- func (r *Request) ProxyPort() (uint, error)
- func (r *Request) ReceivedDataType() (string, error)
- func (r *Request) RequestSetReceivedDataEncoding(encoding string) error
- func (r *Request) RequestType() (uint, error)
- func (r *Request) RequestedDataType() (SciterResourceType, error)
- func (r *Request) SetFailed(status uint, data []byte) error
- func (r *Request) SetReceivedDataType(dataType string) error
- func (r *Request) SetRqHeader(name, value string) error
- func (r *Request) SetRspHeader(name, value string) error
- func (r *Request) SetSucceeded(status uint, data []byte) error
- func (r *Request) Times() (time.Time, time.Time, error)
- func (r *Request) Url() (string, error)
- type RequestParam
- type RequestType
- type SCDOM_RESULT
- type SCITER_SCROLL_FLAGS
- type SET_ELEMENT_HTML
- type Sciter
- func (s *Sciter) AttachWindowEventHandler(handler *EventHandler) error
- func (s *Sciter) Call(functionName string, args ...*Value) (retval *Value, err error)
- func (s *Sciter) CloseArchive()
- func (s *Sciter) DataReady(uri string, data []byte) bool
- func (s *Sciter) DataReadyAsync(uri string, data []byte, requestId C.HREQUEST) bool
- func (s *Sciter) DefineFunction(name string, nf func(args ...*Value) *Value)
- func (s *Sciter) DetachWindowEventHandler(handler *EventHandler) error
- func (s *Sciter) Eval(script string) (retval *Value, ok bool)
- func (s *Sciter) FindElement(pt Point) (*Element, error)
- func (s *Sciter) GetArchiveItem(uri string) []byte
- func (s *Sciter) GetElementByUID(uid uint) (*Element, error)
- func (s *Sciter) GetFocusElement() (*Element, error)
- func (s *Sciter) GetHwnd() C.HWINDOW
- func (s *Sciter) GetRootElement() (*Element, error)
- func (s *Sciter) LoadFile(filename string) error
- func (s *Sciter) LoadHtml(html, baseUrl string) error
- func (s *Sciter) MinHeight(width int) int
- func (s *Sciter) MinWidth() int
- func (s *Sciter) OpenArchive(data []byte)
- func (s *Sciter) SetCSS(css, baseUrl, mediaType string) (ok bool)
- func (s *Sciter) SetCallback(handler *CallbackHandler)
- func (s *Sciter) SetHomeURL(baseUrl string) (ok bool)
- func (s *Sciter) SetMediaType(mediaType string) (ok bool)
- func (s *Sciter) SetOption(option Sciter_RT_OPTIONS, value uint) (ok bool)
- func (s *Sciter) SetResourceArchive(data []byte)
- func (s *Sciter) UpdateWindow()
- type SciterCallbackNotification
- type SciterResourceType
- type Sciter_RT_OPTIONS
- type ScnAttachBehavior
- type ScnDataLoaded
- type ScnEngineDestroyed
- type ScnGraphicsCriticalFailure
- type ScnInvalidateRect
- type ScnKeyboardRequest
- type ScnLoadData
- type ScnPostedNotification
- type ScriptingMethodParams
- type ScrollEvent
- type ScrollParams
- type Size
- type SomEvents
- type SomParams
- type TimerParams
- type TiscriptMethodParams
- type TiscriptPvalue
- type TiscriptValue
- type VALUE_RESULT
- type Value
- func (pdst *Value) Append(val interface{}) error
- func (v *Value) Assign(val interface{})
- func (v *Value) Bool() bool
- func (pdst *Value) Bytes() []byte
- func (v *Value) Clone() *Value
- func (pdst *Value) Compare(val *Value) error
- func (pdst *Value) ConvertFromString(str string, how ValueStringConvertType) error
- func (pdst *Value) ConvertToString(how ValueStringConvertType) error
- func (pdst *Value) Copy(psrc *Value) error
- func (pdst *Value) EnumerateKeyValue(fn KeyValueCallback) error
- func (pdst *Value) Float() float64
- func (pdst *Value) Get(key string) (val *Value)
- func (pdst *Value) Index(n int) *Value
- func (pdst *Value) Int() int
- func (pdst *Value) Int64() int64
- func (v *Value) Invoke(self *Value, nameOrUrl string, args ...*Value) (retval *Value, err error)
- func (v *Value) IsAngle() bool
- func (v *Value) IsArray() bool
- func (v *Value) IsAsset() bool
- func (v *Value) IsBool() bool
- func (v *Value) IsByte() bool
- func (v *Value) IsColor() bool
- func (v *Value) IsCurrency() bool
- func (v *Value) IsDate() bool
- func (v *Value) IsDomElement() bool
- func (v *Value) IsDuration() bool
- func (v *Value) IsFloat() bool
- func (v *Value) IsFunction() bool
- func (v *Value) IsInt() bool
- func (v *Value) IsMap() bool
- func (pdst *Value) IsNativeFunctor() bool
- func (v *Value) IsNothing() bool
- func (v *Value) IsNull() bool
- func (v *Value) IsObject() bool
- func (v *Value) IsObjectArray() bool
- func (v *Value) IsObjectClass() bool
- func (v *Value) IsObjectE() bool
- func (v *Value) IsObjectFunction() bool
- func (v *Value) IsObjectNative() bool
- func (v *Value) IsObjectObject() bool
- func (v *Value) IsString() bool
- func (v *Value) IsSymbol() bool
- func (v *Value) IsUndefined() bool
- func (pdst *Value) Isolate() error
- func (pdst *Value) Length() int
- func (pdst *Value) NthElementKey(idx int) (val *Value)
- func (v *Value) Release()
- func (pdst *Value) Set(key string, val interface{}) error
- func (pdst *Value) SetBool(b bool) error
- func (pdst *Value) SetBytes(data []byte) error
- func (pdst *Value) SetFloat(data float64) error
- func (pdst *Value) SetIndex(idx int, val interface{}) error
- func (pdst *Value) SetInt(data int) error
- func (pdst *Value) SetInt64(data int64, typ uint) error
- func (pdst *Value) SetNativeFunctor(nf NativeFunctor) error
- func (pdst *Value) SetString(str string, uintType ...int) error
- func (v *Value) String() string
- func (pdst *Value) Type(pType, pUints *uint) uint
- type ValueStringConvertType
- type WindowCreationFlag
Constants ¶
const ( REQUEST_PANIC = iota - 1 // e.g. not enough memory REQUEST_OK REQUEST_BAD_PARAM // bad parameter REQUEST_FAILURE // operation failed, e.g. index out of bounds REQUEST_NOTSUPPORTED // the platform does not support requested feature )
enum REQUEST_RESULT
const ( RRT_GET = 1 + iota RRT_POST RRT_PUT RRT_DELETE RRT_FORCE_DWORD = 0xFFFFFFFF )
enum REQUEST_RQ_TYPE
const ( RS_PENDING = iota RS_SUCCESS // completed successfully RS_FAILURE // completed with failure RS_FORCE_DWORD = 0xFFFFFFFF )
enum REQUEST_STATE
const ( OT_DOM = iota // html parser & runtime OT_CSSS // csss! parser & runtime OT_CSS // css parser OT_TIS // TIS parser & runtime )
enum OUTPUT_SUBSYTEMS
const ( OS_INFO = iota OS_WARNING OS_ERROR )
enum OUTPUT_SEVERITY
const ( HANDLE_INITIALIZATION = 0x0000 /** attached/detached */ HANDLE_MOUSE = 0x0001 /** mouse events */ HANDLE_KEY = 0x0002 /** key events */ HANDLE_FOCUS = 0x0004 /** focus events if this flag is set it also means that element it attached to is focusable */ HANDLE_SCROLL = 0x0008 /** scroll events */ HANDLE_TIMER = 0x0010 /** timer event */ HANDLE_SIZE = 0x0020 /** size changed event */ HANDLE_DRAW = 0x0040 /** drawing request (event) */ HANDLE_DATA_ARRIVED = 0x080 /** requested data () has been delivered */ HANDLE_BEHAVIOR_EVENT = 0x0100 /** logical synthetic events: BUTTON_CLICK HYPERLINK_CLICK etc. 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_EXCHANGE = 0x1000 /** system drag-n-drop */ HANDLE_GESTURE = 0x2000 /** touch input events */ HANDLE_SOM = 0x8000 /** som_asset_t request */ HANDLE_ALL = 0xFFFF /* all of them */ SUBSCRIPTIONS_REQUEST = 0xFFFFFFFF /** special value for getting subscription flags */ )
enum EVENT_GROUPS
const ( BUBBLING = 0 // bubbling (emersion) phase SINKING = 0x8000 // capture (immersion) phase, this flag is or'ed with EVENTS codes below HANDLED = 0x10000 // a bubbling event consumed by some element SINKING_HANDLED = 0x18000 // a sinking event consumed by some child element )
enum PHASE_MASK
const ( BEHAVIOR_DETACH = 0 BEHAVIOR_ATTACH = 1 )
parameters of evtg == HANDLE_INITIALIZATION enum INITIALIZATION_EVENTS
const ( NO_DRAGGING = iota DRAGGING_MOVE DRAGGING_COPY )
enum DRAGGING_TYPE
const ( CONTENT_ADDED = 0x01 CONTENT_REMOVED = 0x02 )
enum CONTENT_CHANGE_BITS { // for CONTENT_CHANGED reason
const ( T_UNDEFINED = iota T_NULL T_BOOL T_INT T_FLOAT T_STRING T_DATE // INT64 - contains a 64-bit value representing the number of 100-nanosecond intervals since January 1 1601 (UTC) a.k.a. FILETIME on Windows T_CURRENCY // INT64 - 14.4 fixed number. E.g. dollars = int64 / 10000; T_LENGTH // length units value is int or float units are VALUE_UNIT_TYPE T_ARRAY T_MAP T_FUNCTION T_BYTES // sequence of bytes - e.g. image data T_OBJECT // scripting object proxy (TISCRIPT/SCITER) T_DOM_OBJECT // DOM object (CSSS!) use get_object_data to get HELEMENT T_RESOURCE // 15 - other thing derived from tool::resource T_RANGE // 16 - N..M, integer range. T_DURATION // double, seconds T_ANGLE // double, radians T_COLOR // [unsigned] INT, ABGR T_ENUM T_ASSET // sciter::om::iasset* add_ref'ed pointer )
enum VALUE_TYPE
const ( 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 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_DIP = 13 UT_COLOR = 15 // color in int UT_URL = 16 // url in string UT_SYMBOL = 0xFFFF // for T_STRINGs designates symbol string ( so called NAME_TOKEN - CSS or JS identifier ) )
enum VALUE_UNIT_TYPE
const ( DT_HAS_DATE = 0x01 // date contains date portion DT_HAS_TIME = 0x02 // date contains time portion HH:MM DT_HAS_SECONDS = 0x04 // date contains time and seconds HH:MM:SS DT_UTC = 0x10 // T_DATE is known to be UTC. Otherwise it is local date/time )
enum VALUE_UNIT_TYPE_DATE
const ( UT_OBJECT_ARRAY = 0 // type T_OBJECT of type Array UT_OBJECT_OBJECT = 1 // type T_OBJECT of type Object UT_OBJECT_CLASS = 2 // type T_OBJECT of type Type (class or namespace) UT_OBJECT_NATIVE = 3 // type T_OBJECT of native Type with data slot (LPVOID) UT_OBJECT_FUNCTION = 4 // type T_OBJECT of type Function UT_OBJECT_ERROR = 5 // type T_OBJECT of type Error )
Sciter or TIScript specific enum VALUE_UNIT_TYPE_OBJECT
const ( SOM_GET_PASSPORT = 0 SOM_GET_ASSET = 1 )
const ( 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. )
const ( /**Notifies that Sciter is about to download a referred resource. * * \param lParam #LPSCN_LOAD_DATA. * \return #LOAD_OK or #LOAD_DISCARD * * 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 * database or other resource). To do this set #SCN_LOAD_DATA::outData and * #SCN_LOAD_DATA::outDataSize members of SCN_LOAD_DATA. Sciter does not * store pointer to this data. You can call #SciterDataReady() function instead * of filling these fields. This allows you to free your outData buffer * immediately. **/ SC_LOAD_DATA = 0x01 /**This notification indicates that external data (for example image) download process * completed. * * \param lParam #LPSCN_DATA_LOADED * * This notifiaction is sent for each external resource used by document when * this resource has been completely downloaded. Sciter will send this * notification asynchronously. **/ SC_DATA_LOADED = 0x02 /**This notification is sent on parsing the document and while processing * elements having non empty style.behavior attribute value. * * \param lParam #LPSCN_ATTACH_BEHAVIOR * * Application has to provide implementation of #sciter::behavior interface. * Set #SCN_ATTACH_BEHAVIOR::impl to address of this implementation. **/ SC_ATTACH_BEHAVIOR = 0x04 /**This notification is sent when instance of the engine is destroyed. * It is always final notification. * * \param lParam #LPSCN_ENGINE_DESTROYED * **/ SC_ENGINE_DESTROYED = 0x05 /**Posted notification. * \param lParam #LPSCN_POSTED_NOTIFICATION * **/ 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 * **/ SC_GRAPHICS_CRITICAL_FAILURE = 0x07 /**This notification is sent when the engine needs keyboard to be present on screen E.g. when <input|text> gets focus * \param lParam #LPSCN_KEYBOARD_REQUEST * **/ SC_KEYBOARD_REQUEST = 0x08 /**This notification is sent when the engine needs some area to be redrawn * \param lParam #LPSCN_INVLIDATE_RECT * **/ SC_INVALIDATE_RECT = 0x09 )
const ( ROOT_RELATIVE = 0x01 // - or this flag if you want to get HTMLayout window relative coordinates // otherwise it will use nearest windowed container e.g. popup window. SELF_RELATIVE = 0x02 // - "or" this flag if you want to get coordinates relative to the origin // of element iself. CONTAINER_RELATIVE = 0x03 // - position inside immediate container. VIEW_RELATIVE = 0x04 // - position relative to view - HTMLayout window CONTENT_BOX = 0x00 // content (inner) box PADDING_BOX = 0x10 // content + paddings BORDER_BOX = 0x20 // content + paddings + border MARGIN_BOX = 0x30 // content + paddings + border + margins BACK_IMAGE_AREA = 0x40 // relative to content origin - location of background image (if it set no-repeat) FORE_IMAGE_AREA = 0x50 // relative to content origin - location of foreground image (if it set no-repeat) SCROLLABLE_AREA = 0x60 // scroll_area - scrollable area in content box )
enum ELEMENT_AREAS
const ( ALLOW_FILE_IO = 0x00000001 ALLOW_SOCKET_IO = 0x00000002 ALLOW_EVAL = 0x00000004 ALLOW_SYSINFO = 0x00000008 )
enum SCRIPT_RUNTIME_FEATURES {
const ( GFX_LAYER_GDI = 1 GFX_LAYER_CG = 1 GFX_LAYER_CAIRO = 1 GFX_LAYER_WARP = 2 GFX_LAYER_D2D = 3 GFX_LAYER_SKIA = 4 GFX_LAYER_SKIA_OPENGL = 5 GFX_LAYER_AUTO = 0xFFFF )
enum GFX_LAYER {
const ( SCITER_SMOOTH_SCROLL Sciter_RT_OPTIONS = 1 // value:TRUE - enable, value:FALSE - disable, enabled by default SCITER_CONNECTION_TIMEOUT = 2 // value: milliseconds, connection timeout of http client SCITER_HTTPS_ERROR = 3 // value: 0 - drop connection, 1 - use builtin dialog, 2 - accept connection silently SCITER_FONT_SMOOTHING = 4 // value: 0 - system default, 1 - no smoothing, 2 - std smoothing, 3 - clear type SCITER_TRANSPARENT_WINDOW = 6 // Windows Aero support, value: // 0 - normal drawing, // 1 - window has transparent background after calls DwmExtendFrameIntoClientArea() or DwmEnableBlurBehindWindow(). SCITER_SET_GPU_BLACKLIST = 7 // hWnd = NULL, // value = LPCBYTE, json - GPU black list, see: gpu-blacklist.json resource. 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_ALPHA_WINDOW = 12 // hWnd, value - TRUE/FALSE - window uses per pixel alpha (e.g. WS_EX_LAYERED/UpdateLayeredWindow() window) SCITER_SET_INIT_SCRIPT = 13 // hWnd - N/A , value LPCSTR - UTF-8 encoded script source to be loaded into each view before any other script execution. SCITER_SET_MAIN_WINDOW = 14 // hWnd, value - TRUE/FALSE - window is main, will destroy all other dependent windows on close SCITER_SET_MAX_HTTP_DATA_LENGTH = 15 // hWnd - N/A , value - max request length in megabytes (1024*1024 bytes) )
const (
UT_NOTHING = 1
)
enum VALUE_UNIT_UNDEFINED
Variables ¶
var (
BAD_HWINDOW C.HWINDOW = nil
)
var (
DefaultRect = &Rect{0, 0, 300, 400}
)
var ( // create an resizable main window with minimize/maximize controls // linux must use this combination to create the main window correctly DefaultWindowCreateFlag = SW_TITLEBAR | SW_RESIZEABLE | SW_CONTROLS | SW_MAIN | SW_ENABLE_DEBUG )
Functions ¶
func AppendMasterCSS ¶
Append Master style sheet.
\param[in] utf8 \b LPCBYTE, start of CSS buffer. \param[in] numBytes \b UINT, number of bytes in utf8.
func BytePtrToBytes ¶
func CreateWindow ¶
func CreateWindow(createFlags WindowCreationFlag, rect *Rect, delegate uintptr, delegateParam uintptr, parent C.HWINDOW) C.HWINDOW
rect is the display area
func SetMasterCSS ¶
Set Master style sheet.
\param[in] utf8 \b LPCBYTE, start of CSS buffer. \param[in] numBytes \b UINT, number of bytes in utf8.
func SetOption ¶
func SetOption(option Sciter_RT_OPTIONS, value uint) (ok bool)
BOOL SciterSetOption (NULL, UINT option, UINT_PTR value )
func StringToBytePtr ¶
func StringToUTF16Ptr ¶
func StringToUTF16PtrWithLen ¶
func StringToWcharPtr ¶
func Utf16FromString ¶
returns a UTF-16 string, including the trailing zero
func Utf16ToString ¶
Returns the utf-8 encoding of the utf-16 sequence s, with a terminating NUL removed.
func Utf16ToStringLength ¶
func VersionAsString ¶
func VersionAsString() string
Types ¶
type BehaviorEvent ¶
type BehaviorEvent uint32
const ( BUTTON_CLICK BehaviorEvent = 0 // click on button BUTTON_PRESS BehaviorEvent = 1 // mouse down or key down in button BUTTON_STATE_CHANGED BehaviorEvent = 2 // checkbox/radio/slider changed its state/value EDIT_VALUE_CHANGING BehaviorEvent = 3 // before text change EDIT_VALUE_CHANGED BehaviorEvent = 4 // after text change SELECT_SELECTION_CHANGED BehaviorEvent = 5 // selection in <select> changed SELECT_STATE_CHANGED BehaviorEvent = 6 // node in select expanded/collapsed heTarget is the node POPUP_REQUEST BehaviorEvent = 7 // request to show popup just received // here DOM of popup element can be modifed. POPUP_READY BehaviorEvent = 8 // popup element has been measured and ready to be shown on screen // here you can use functions like ScrollToView. POPUP_DISMISSED BehaviorEvent = 9 // popup element is closed MENU_ITEM_ACTIVE BehaviorEvent = 0xA // menu item activated by mouse hover or by keyboard MENU_ITEM_CLICK BehaviorEvent = 0xB // menu item click CONTEXT_MENU_REQUEST BehaviorEvent = 0x10 // "right-click" BEHAVIOR_EVENT_PARAMS::he is current popup menu HELEMENT being processed or NULL. VISIUAL_STATUS_CHANGED BehaviorEvent = 0x11 // broadcast notification sent to all elements of some container being shown or hidden DISABLED_STATUS_CHANGED BehaviorEvent = 0x12 // broadcast notification sent to all elements of some container that got new value of :disabled state POPUP_DISMISSING BehaviorEvent = 0x13 // popup is about to be closed CONTENT_CHANGED BehaviorEvent = 0x15 // content has been changed is posted to the element that gets content changed reason is combination of CONTENT_CHANGE_BITS. // "grey" event codes - notfications from behaviors from this SDK HYPERLINK_CLICK BehaviorEvent = 0x80 // hyperlink click )
enum BEHAVIOR_EVENTS
const ( ELEMENT_COLLAPSED BehaviorEvent = iota + 0x90 // element was collapsed so far only behavior:tabs is sending these two to the panels ELEMENT_EXPANDED // element was expanded ACTIVATE_CHILD // activate (select) child 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 UI_STATE_CHANGED // ui state changed observers shall update their visual states. FORM_SUBMIT // behavior:form detected submission event. BEHAVIOR_EVENT_PARAMS::data field contains data to be posted. // BEHAVIOR_EVENT_PARAMS::data is of type T_MAP in this case key/value pairs of data that is about // to be submitted. You can modify the data or discard submission by returning true from the handler. FORM_RESET // behavior:form detected reset event (from button type=reset). BEHAVIOR_EVENT_PARAMS::data field contains data to be reset. DOCUMENT_COMPLETE // document in behavior:frame or root document is complete. HISTORY_PUSH // requests to behavior:history (commands) HISTORY_DROP HISTORY_PRIOR HISTORY_NEXT HISTORY_STATE_CHANGED // behavior:history notification - history stack has changed CLOSE_POPUP // close popup request REQUEST_TOOLTIP // request tooltip evt.source <- is the tooltip element. ANIMATION BehaviorEvent = 0xA0 // animation started (reason=1) or ended(reason=0) on the element. DOCUMENT_CREATED BehaviorEvent = 0xC0 // document created script namespace initialized. target -> the document DOCUMENT_CLOSE_REQUEST BehaviorEvent = 0xC1 // document is about to be closed to cancel closing do: evt.data = sciter::value("cancel"); DOCUMENT_CLOSE BehaviorEvent = 0xC2 // last notification before document removal from the DOM DOCUMENT_READY BehaviorEvent = 0xC3 // document has got DOM structure styles and behaviors of DOM elements. Script loading run is complete at this moment. VIDEO_INITIALIZED BehaviorEvent = 0xD1 // <video> "ready" notification VIDEO_STARTED BehaviorEvent = 0xD2 // <video> playback started notification VIDEO_STOPPED BehaviorEvent = 0xD3 // <video> playback stoped/paused notification VIDEO_BIND_RQ BehaviorEvent = 0xD4 // <video> request for frame source binding FIRST_APPLICATION_EVENT_CODE = 0x100 )
func (BehaviorEvent) String ¶
func (i BehaviorEvent) String() string
type BehaviorEventParams ¶
type BehaviorEventParams C.BEHAVIOR_EVENT_PARAMS
typedef struct BEHAVIOR_EVENT_PARAMS
{ UINT cmd; // BEHAVIOR_EVENTS HELEMENT heTarget; // target element handler, in MENU_ITEM_CLICK this is owner element that caused this menu - e.g. context menu owner // In scripting this field named as Event.owner HELEMENT he; // source element e.g. in SELECTION_CHANGED it is new selected <option>, in MENU_ITEM_CLICK it is menu item (LI) element UINT_PTR reason; // EVENT_REASON or EDIT_CHANGED_REASON - UI action causing change. // In case of custom event notifications this may be any // application specific value. SCITER_VALUE data; // auxiliary data accompanied with the event. E.g. FORM_SUBMIT event is using this field to pass collection of values. } BEHAVIOR_EVENT_PARAMS;
func (*BehaviorEventParams) Cmd ¶
func (b *BehaviorEventParams) Cmd() BehaviorEvent
func (*BehaviorEventParams) Phase ¶
func (b *BehaviorEventParams) Phase() PhaseMask
type BehaviorMethodIdentifier ¶
type BehaviorMethodIdentifier uint32
const ( DO_CLICK BehaviorMethodIdentifier = iota GET_TEXT_VALUE SET_TEXT_VALUE TEXT_EDIT_GET_SELECTION TEXT_EDIT_SET_SELECTION // Replace selection content or insert text at current caret position. // Replaced text will be selected. TEXT_EDIT_REPLACE_SELECTION // Set value of type="vscrollbar"/"hscrollbar" SCROLL_BAR_GET_VALUE SCROLL_BAR_SET_VALUE TEXT_EDIT_GET_CARET_POSITION TEXT_EDIT_GET_SELECTION_TEXT // p - TEXT_SELECTION_PARAMS TEXT_EDIT_GET_SELECTION_HTML // p - TEXT_SELECTION_PARAMS TEXT_EDIT_CHAR_POS_AT_XY // p - TEXT_EDIT_CHAR_POS_AT_XY_PARAMS IS_EMPTY BehaviorMethodIdentifier = 0xFC // p - IS_EMPTY_PARAMS // set VALUE_PARAMS::is_empty (false/true) reflects :empty state of the element. GET_VALUE BehaviorMethodIdentifier = 0xFD // p - VALUE_PARAMS SET_VALUE BehaviorMethodIdentifier = 0xFE // p - VALUE_PARAMS FIRST_APPLICATION_METHOD_ID BehaviorMethodIdentifier = 0x100 )
enum BEHAVIOR_METHOD_IDENTIFIERS
func (BehaviorMethodIdentifier) String ¶
func (i BehaviorMethodIdentifier) String() string
type CallbackHandler ¶
type CallbackHandler struct { Behaviors map[string]*EventHandler // Notifies that Sciter is about to download a referred resource. OnLoadData func(params *ScnLoadData) int // This notification indicates that external data (for example image) download process OnDataLoaded func(params *ScnDataLoaded) int /**This notification is sent on parsing the document and while processing * elements having non empty style.behavior attribute value. * * \param lParam #LPSCN_ATTACH_BEHAVIOR * * Application has to provide implementation of #sciter::behavior interface. * Set #SCN_ATTACH_BEHAVIOR::impl to address of this implementation. **/ OnAttachBehavior func(params *ScnAttachBehavior) int /**This notification is sent when instance of the engine is destroyed. * It is always final notification. * * \param lParam #LPSCN_ENGINE_DESTROYED * **/ OnEngineDestroyed func() int /**Posted notification. * \param lParam #LPSCN_POSTED_NOTIFICATION * **/ OnPostedNotification func(params *ScnPostedNotification) int /**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 * **/ OnGraphicsCriticalFailure func() int /**This notification is sent when the engine needs keyboard to be present on screen E.g. when <input|text> gets focus * \param lParam #LPSCN_KEYBOARD_REQUEST * **/ OnKeyboardRequest func(params *ScnKeyboardRequest) int /**This notification is sent when the engine needs some area to be redrawn * \param lParam #LPSCN_INVLIDATE_RECT * **/ OnInvalidateRect func(params *ScnInvalidateRect) int }
type CursorType ¶
type CursorType uint32
const ( CURSOR_ARROW CursorType = iota //0 CURSOR_IBEAM //1 CURSOR_WAIT //2 CURSOR_CROSS //3 CURSOR_UPARROW //4 CURSOR_SIZENWSE //5 CURSOR_SIZENESW //6 CURSOR_SIZEWE //7 CURSOR_SIZENS //8 CURSOR_SIZEALL //9 CURSOR_NO //10 CURSOR_APPSTARTING //11 CURSOR_HELP //12 CURSOR_HAND //13 CURSOR_DRAG_MOVE //14 CURSOR_DRAG_COPY //15 )
enum CURSOR_TYPE
func (CursorType) String ¶
func (i CursorType) String() string
type DDMode ¶
type DDMode uint32
enum DD_MODES { DD_MODE_NONE = 0, // DROPEFFECT_NONE ( 0 ) DD_MODE_COPY = 1, // DROPEFFECT_COPY ( 1 ) DD_MODE_MOVE = 2, // DROPEFFECT_MOVE ( 2 ) DD_MODE_COPY_OR_MOVE = 3, // DROPEFFECT_COPY ( 1 ) | DROPEFFECT_MOVE ( 2 ) DD_MODE_LINK = 4, // DROPEFFECT_LINK ( 4 ) };
const ( DD_MODE_NONE DDMode = 0 DD_MODE_COPY DD_MODE_MOVE DD_MODE_COPY_OR_MOVE DD_MODE_LINK )
type DataArrivedParams ¶
type DataArrivedParams C.DATA_ARRIVED_PARAMS
typedef struct DATA_ARRIVED_PARAMS
{ HELEMENT initiator; // element intiator of HTMLayoutRequestElementData request, LPCBYTE data; // data buffer UINT dataSize; // size of data UINT dataType; // data type passed "as is" from HTMLayoutRequestElementData UINT status; // status = 0 (dataSize == 0) - unknown error. // status = 100..505 - http response status, Note: 200 - OK! // status > 12000 - wininet error code, see ERROR_INTERNET_*** in wininet.h LPCWSTR uri; // requested url } DATA_ARRIVED_PARAMS;
func (*DataArrivedParams) Data ¶
func (d *DataArrivedParams) Data() []byte
func (*DataArrivedParams) Uri ¶
func (d *DataArrivedParams) Uri() string
type DraggingType ¶
type DraggingType uint32
type DrawParams ¶
type EditChangedReason ¶
type EditChangedReason uint
const ( BY_INS_CHAR EditChangedReason = iota // single char insertion BY_INS_CHARS // character range insertion clipboard BY_DEL_CHAR // single char deletion BY_DEL_CHARS // character range deletion (selection) BY_UNDO_REDO // undo/redo )
enum EDIT_CHANGED_REASON
func (EditChangedReason) String ¶
func (i EditChangedReason) String() string
type Element ¶
type Element struct {
// contains filtered or unexported fields
}
Represents a single DOM element, owns and manages a Handle
func CreateElement ¶
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. \param[in] tagname \b LPCSTR, html tag of the element e.g. "div", "option", etc. \param[in] textOrNull \b LPCWSTR, initial text of the element or NULL. text here is a plain text - method does no parsing. \param[out ] phe \b #HELEMENT*, variable to receive handle of the element
func WrapElement ¶
Wrap C.HELEMENT to a go side *Element, doing Sciter_UseElement/Sciter_UnuseElement automatically
func (*Element) AttachEventHandler ¶
func (e *Element) AttachEventHandler(handler *EventHandler) error
SCDOM_RESULT SciterAttachEventHandler( HELEMENT he, LPELEMENT_EVENT_PROC pep, LPVOID tag ) ;//{ return SAPI()->SciterAttachEventHandler( he,pep,tag ); }
Any Element that calls this function would not be gc collected any more thus prevent the handler missing in sciter callbacks
func (*Element) Attr ¶
Get value of any element's attribute by name.
\param[in] he \b #HELEMENT \param[in] name \b LPCSTR, attribute name \param[out] p_value \b LPCWSTR*, will be set to address of the string containing attribute value \return \b #SCDOM_RESULT SCAPI
func (*Element) AttrCount ¶
Get number of element's attributes.
\param[in] he \b #HELEMENT \param[out] p_count \b LPUINT, variable to receive number of element attributes. \return \b #SCDOM_RESULT SCAPI
func (*Element) CallFunction ¶
call scripting function defined on global level Example, script:
function foo() {...}
Native code:
dom::element root = ... get root element of main document or some frame inside it root.call_function("foo"); // call the function
func (*Element) CallMethod ¶
call scripting method attached to the element (directly or through of scripting behavior) Example, script:
var elem = ... elem.foo = function() {...}
Native code:
dom::element elem = ... elem.call_method("foo");
func (*Element) Capture ¶
Set the mouse capture to the specified element.
\param[in] he \b #HELEMENT \return \b #SCDOM_RESULT SCAPI After call to this function all mouse events will be targeted to the element. To remove mouse capture call ReleaseCapture() function.
func (*Element) ChildrenCount ¶
Get number of child elements.
\param[in] he \b #HELEMENT, element which child elements you need to count \param[out] count \b UINT*, variable to receive number of child elements \return \b #SCDOM_RESULT SCAPI \par Example: for paragraph defined as \verbatim <p>Hello <b>wonderfull</b> world!</p> \endverbatim count will be set to 1 as the paragraph has only one sub element: \verbatim <b>wonderfull</b> \endverbatim
func (*Element) ClearAttr ¶
Remove all attributes from the element.
\param[in] he \b #HELEMENT \return \b #SCDOM_RESULT SCAPI
func (*Element) Clone ¶
Create new element as copy of existing element, new element is a full (deep) copy of the element and
is disconnected initially from the DOM. Element created with ref_count = 1 thus you \b must call Sciter_UnuseElement on returned handler. \param[in] he \b #HELEMENT, source element. \param[out ] phe \b #HELEMENT*, variable to receive handle of the new element.
func (*Element) CombineURL ¶
Combine given URL with URL of the document element belongs to.
\param[in] he \b #HELEMENT \param[in, out] szUrlBuffer \b LPWSTR, at input this buffer contains zero-terminated URL to be combined, after function call it contains zero-terminated combined URL \param[in] UrlBufferSize \b UINT, size of the buffer pointed by \c szUrlBuffer \return \b #SCDOM_RESULT SCAPI This function is used for resolving relative references.
func (*Element) DefineMethod ¶
DefineMethod defines Element locally scripting function in tiscript
The local method must be access as the element attribute.
func (*Element) Delete ¶
Take element out of its container (and DOM tree).
Element will be destroyed when its reference counter will become zero
func (*Element) Detach ¶
Take element out of its container (and DOM tree).
Element will be destroyed when its reference counter will become zero
func (*Element) DetachEventHandler ¶
func (e *Element) DetachEventHandler(handler *EventHandler) error
SCDOM_RESULT SciterDetachEventHandler( HELEMENT he, LPELEMENT_EVENT_PROC pep, LPVOID tag )
func (*Element) GetValue ¶
SciterGetValue - get value of the element. 'value' is value of correspondent behavior attached to the element or its text.
\param[in] he \b HELEMENT, element which value will be retrieved. \param[out] pval \b VALUE*, pointer to VALUE that will get elements value. ATTN: if you are not using json::value wrapper then you shall call ValueClear aginst the returned value otherwise memory will leak.
func (*Element) Html ¶
Get html representation of the element.
\param[in] he \b #HELEMENT \param[in] outer \b BOOL, if TRUE will retunr 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
func (*Element) HttpRequest ¶
func (e *Element) HttpRequest(url string, dataType SciterResourceType, requestType RequestType, params ...RequestParam) error
SciterSendRequest - send GET or POST request for the element
event handler on the 'he' element (if any) will be notified when data will be ready by receiving HANDLE_DATA_DELIVERY event.
func (*Element) Index ¶
Get element index.
\param[in] he \b #HELEMENT \param[out] p_index \b LPUINT, variable to receive number of the element among parent element's subelements. \return \b #SCDOM_RESULT SCAPI
func (*Element) Insert ¶
SCDOM_RESULT SciterInsertElement( HELEMENT he, HELEMENT hparent, UINT index )
Insert element at the index position of parent.
It is not an error to insert element which already has parent - it will be disconnected first, but you need to update elements parent in this case.
func (*Element) IsEnabled ¶
SciterIsElementEnabled - deep enable state, determines if element enabled - is not disabled by itself or no one
of its parents is disabled.
\param[in] he \b HELEMENT, element. \param[out] pEnabled \b LPBOOL, enabled state.
func (*Element) IsVisible ¶
SciterIsElementVisible - deep visibility, determines if element visible - has no visiblity:hidden and no display:none defined
for itself or for any its parents. \param[in] he \b HELEMENT, element. \param[out] pVisible \b LPBOOL, visibility state.
func (*Element) Load ¶
func (e *Element) Load(url string, dataType SciterResourceType) error
SciterRequestElementData - request data download for the element. as jQuery.load :)
\param[in] he \b HELEMENT, element to deleiver data to. \param[in] url \b LPCWSTR, url to download data from. \param[in] dataType \b UINT, data type, see SciterResourceType. \param[in] hInitiator \b HELEMENT, element - initiator, can be NULL. event handler on the he element (if any) will be notified when data will be ready by receiving HANDLE_DATA_DELIVERY event.
func (*Element) MustSelectById ¶
func (*Element) MustSelectUnique ¶
Returns the only child element that matches the selector. If no elements match or more than one element matches, the function panics.
func (*Element) NthAttr ¶
Get value of any element's attribute by attribute's number.
\param[in] he \b #HELEMENT \param[in] n \b UINT, number of desired attribute \param[out] p_name \b LPCSTR*, will be set to address of the string containing attribute name \param[out] p_value \b LPCWSTR*, will be set to address of the string containing attribute value \return \b #SCDOM_RESULT SCAPI
func (*Element) NthChild ¶
Get handle of every element's child element.
\param[in] he \b #HELEMENT \param[in] n \b UINT, number of the child element \param[out] phe \b #HELEMENT*, variable to receive handle of the child element \return \b #SCDOM_RESULT SCAPI \par Example: for paragraph defined as \verbatim <p>Hello <b>wonderfull</b> world!</p> \endverbatim *phe will be equal to handle of <b> element: \verbatim <b>wonderfull</b> \endverbatim
func (*Element) ParentElement ¶
Get parent element.
func (*Element) ReleaseCapture ¶
SCDOM_RESULT SciterReleaseCapture(HELEMENT he)
func (*Element) ScrollToView ¶
func (e *Element) ScrollToView(flag SCITER_SCROLL_FLAGS) error
Scroll to view.
func (*Element) Select ¶
SCDOM_RESULT SciterSelectElementsW(HELEMENT he, LPCWSTR CSS_selectors, SciterElementCallback* callback, LPVOID param)
func (*Element) SelectById ¶
A wrapper of SelectUnique that auto-prepends a hash to the provided id. Useful when selecting elements base on a programmatically retrieved id (which does not already have the hash on it)
func (*Element) SelectFirst ¶
Returns the only child element that matches the selector.
func (*Element) SelectParent ¶
SCDOM_RESULT SciterSelectParentW(HELEMENT he, LPCWSTR selector, UINT depth, HELEMENT* heFound)
func (*Element) SelectUnique ¶
Returns the only child element that matches the selector. If no elements match or more than one element matches, the function returns error.
func (*Element) SetAttr ¶
Set attribute's value.
\param[in] he \b #HELEMENT \param[in] name \b LPCSTR, attribute name \param[in] value \b LPCWSTR, new attribute value or 0 if you want to remove attribute. \return \b #SCDOM_RESULT SCAPI
func (*Element) SetHtml ¶
func (e *Element) SetHtml(html string, where SET_ELEMENT_HTML) error
SCDOM_RESULT SciterSetElementHtml(HELEMENT he, const BYTE* html, UINT htmlLength, UINT where)
func (*Element) SetState ¶
func (e *Element) SetState(bitsToSet, bitsToClear ElementState, updateView bool) error
SCDOM_RESULT SciterSetElementState( HELEMENT he, UINT stateBitsToSet, UINT stateBitsToClear, BOOL updateView)
func (*Element) SetText ¶
Set inner text of the element from LPCWSTR buffer (utf16 words).
\param[in] he \b #HELEMENT \param[in] utf16words \b pointer, UTF16 encoded plain text \param[in] length \b UINT, number of words in utf16words sequence \return \b #SCDOM_RESULT SCAPI
func (*Element) SetTimer ¶
Start Timer for the element.
Element will receive on_timer event To stop timer call SciterSetTimer( he, 0 );
func (*Element) SetValue ¶
SciterSetValue - set value of the element.
\param[in] he \b HELEMENT, element which value will be changed. \param[in] pval \b VALUE*, pointer to the VALUE to set.
func (*Element) ShowPopup ¶
func (e *Element) ShowPopup(eAnchor *Element, placement PopupPlacement) error
Shows block element (DIV) in popup window. \param[in] hePopup \b HELEMENT, element to show as popup \param[in] heAnchor \b HELEMENT, anchor element - hePopup will be shown near this element \param[in] placement \b UINT, values:
2 - popup element below of anchor 8 - popup element above of anchor 4 - popup element on left side of anchor 6 - popup element on right side of anchor ( see numpad on keyboard to get an idea of the numbers)
\return \b #SCDOM_RESULT SCAPI
func (*Element) ShowPopupAt ¶
Shows block element (DIV) in popup window at given position.
\param[in] hePopup \b HELEMENT, element to show as popup \param[in] pos \b POINT, popup element position, relative to origin of Sciter window. \param[in] placement \b UINT, values: 2 - popup element below of anchor 8 - popup element above of anchor 4 - popup element on left side of anchor 6 - popup element on right side of anchor ( see numpad on keyboard to get an idea of the numbers)
func (*Element) Sort ¶
* SciterSortElements - sort children of the element.
- \param[in] he \b HELEMENT, element which children to be sorted.
- \param[in] firstIndex \b UINT, first child index to start sorting from.
- \param[in] lastIndex \b UINT, last index of the sorting range, element with this index will not be included in the sorting.
- \param[in] cmpFunc \b ELEMENT_COMPARATOR, comparator function.
- \param[in] cmpFuncParam \b LPVOID, parameter to be passed in comparator function. *
func (*Element) SortChildren ¶
func (*Element) State ¶
func (e *Element) State() (ElementState, error)
Get/set state bits, stateBits*** accept or'ed values above
func (*Element) Style ¶
Get element's style attribute.
\param[in] he \b #HELEMENT \param[in] name \b LPCSTR, name of the style attribute \param[in] rcv \b pointer to the function receiving UTF16 encoded plain text \param[in] rcv_param \b param passed that passed to LPCWSTR_RECEIVER "as is" Style attributes are those that are set using css. E.g. "font-face: arial" or "display: block". \sa #SciterSetStyleAttribute()
func (*Element) Swap ¶
SciterSwapElements - swap element positions.
Function changes "insertion points" of two elements. So it swops indexes and parents of two elements. \param[in] he1 \b HELEMENT, first element. \param[in] he2 \b HELEMENT, second element.
func (*Element) Text ¶
Get inner text of the element as LPCWSTR (utf16 words).
\param[in] he \b #HELEMENT \param[in] rcv \b pointer to the function receiving UTF16 encoded plain text \param[in] rcv_param \b param passed that passed to LPCWSTR_RECEIVER "as is" \return \b #SCDOM_RESULT SCAPI
type ElementState ¶
type ElementState uint32
const ( STATE_LINK ElementState = 0x00000001 STATE_HOVER ElementState = 0x00000002 STATE_ACTIVE ElementState = 0x00000004 STATE_FOCUS ElementState = 0x00000008 STATE_VISITED ElementState = 0x00000010 STATE_CURRENT ElementState = 0x00000020 // current (hot) item STATE_CHECKED ElementState = 0x00000040 // element is checked (or selected) STATE_DISABLED ElementState = 0x00000080 // element is disabled STATE_READONLY ElementState = 0x00000100 // readonly input element STATE_EXPANDED ElementState = 0x00000200 // expanded state - nodes in tree view STATE_COLLAPSED ElementState = 0x00000400 // collapsed state - nodes in tree view - mutually exclusive with STATE_INCOMPLETE ElementState = 0x00000800 // one of fore/back images requested but not delivered STATE_ANIMATING ElementState = 0x00001000 // is animating currently STATE_FOCUSABLE ElementState = 0x00002000 // will accept focus STATE_ANCHOR ElementState = 0x00004000 // anchor in selection (used with current in selects) STATE_SYNTHETIC ElementState = 0x00008000 // this is a synthetic element - don't emit it's head/tail STATE_OWNS_POPUP ElementState = 0x00010000 // this is a synthetic element - don't emit it's head/tail STATE_TABFOCUS ElementState = 0x00020000 // focus gained by tab traversal STATE_EMPTY ElementState = 0x00040000 // 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 ElementState = 0x00080000 // busy; loading STATE_DRAG_OVER ElementState = 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 ElementState = 0x00200000 // active drop target. STATE_MOVING ElementState = 0x00400000 // dragging/moving - the flag is set for the moving block. STATE_COPYING ElementState = 0x00800000 // dragging/copying - the flag is set for the copying block. STATE_DRAG_SOURCE ElementState = 0x01000000 // element that is a drag source. STATE_DROP_MARKER ElementState = 0x02000000 // element is drop marker STATE_PRESSED ElementState = 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 ElementState = 0x08000000 // this element is out of flow - popup STATE_IS_LTR ElementState = 0x10000000 // the element or one of its containers has dir=ltr declared STATE_IS_RTL ElementState = 0x20000000 // the element or one of its containers has dir=rtl declared )
enum ELEMENT_STATE_BITS
type EventHandler ¶
type EventHandler struct { OnAttached func(he *Element) OnDetached func(he *Element) OnMouse func(he *Element, params *MouseParams) bool OnKey func(he *Element, params *KeyParams) bool OnFocus func(he *Element, params *FocusParams) bool OnDraw func(he *Element, params *DrawParams) bool OnTimer func(he *Element, params *TimerParams) bool // notification events from builtin behaviors - synthesized events: BUTTON_CLICK, VALUE_CHANGED // see enum BEHAVIOR_EVENTS OnBehaviorEvent func(he *Element, params *BehaviorEventParams) bool OnMethodCall func(he *Element, params *MethodParams) bool // If needed your application may expose some [native] functions to be called by script code. // Usually this is made by implementing your own event_handler and overriding // its on_script_call(helement, name, argc, argv, retval) method. // If you will do this then you can invoke this callback from script as: // "global" native functions: var r = view.funcName( p0, p1, ... ); // - calling on_script_call of event_handler instance attached to the window. // As element's methods: var r = el.funcName( p0, p1, ... ); // - calling on_script_call of event_handler instance (native behavior) attached to the element. // This way you can establish interaction between scipt and native code inside your application. OnScriptingMethodCall func(he *Element, params *ScriptingMethodParams) bool // Calls from TIScript. Override this if you want your own methods accessible directly from tiscript engine. // Use tiscript::args to access parameters. OnTiscriptMethodCall func(he *Element, params *TiscriptMethodParams) bool // call when resource is loaded but not used // return true would cancel the resource usage // return false would follow the normal procedure OnDataArrived func(he *Element, params *DataArrivedParams) bool OnSize func(he *Element) OnScroll func(he *Element, params *ScrollParams) bool OnExchange func(he *Element, params *ExchangeParams) bool OnGesture func(he *Element, params *GestureParams) bool OnSom func(he *Element, params *SomParams) bool }
type EventReason ¶
type EventReason uint
const ( BY_MOUSE_CLICK EventReason = iota BY_KEY_CLICK SYNTHESIZED // synthesized programmatically generated. BY_MOUSE_ON_ICON )
enum EVENT_REASON
func (EventReason) String ¶
func (i EventReason) String() string
type ExchangeCmd ¶
type ExchangeCmd uint32
enum EXCHANGE_CMD { X_DRAG_ENTER = 0, // drag enters the element X_DRAG_LEAVE = 1, // drag leaves the element X_DRAG = 2, // drag over the element X_DROP = 3, // data dropped on the element X_PASTE = 4, // N/A X_DRAG_REQUEST = 5, // N/A X_DRAG_CANCEL = 6, // drag cancelled (e.g. by pressing VK_ESCAPE) X_WILL_ACCEPT_DROP = 7, // drop target element shall consume this event in order to receive X_DROP };
const ( X_DRAG_ENTER ExchangeCmd = iota X_DRAG_LEAVE X_DRAG X_DROP X_PASTE X_DRAG_REQUEST X_DRAG_CANCEL X_WILL_ACCEPT_DROP )
type ExchangeParams ¶
type ExchangeParams struct { Cmd ExchangeCmd Target C.HELEMENT Source C.HELEMENT Pos Point PosView Point Mode DDMode Data Value }
struct EXCHANGE_PARAMS
{ UINT cmd; // EXCHANGE_EVENTS HELEMENT target; // target element HELEMENT source; // source element (can be null if D&D from external window) POINT pos; // position of cursor, element relative POINT pos_view; // position of cursor, view relative UINT mode; // DD_MODE SCITER_VALUE data; // packaged drag data };
type FocusEvent ¶
type FocusEvent uint32
const ( FOCUS_LOST FocusEvent = iota FOCUS_GOT )
enum FOCUS_EVENTS
func (FocusEvent) String ¶
func (i FocusEvent) String() string
type FocusParams ¶
type FocusParams struct { Cmd FocusEvent // FocusEvents Target C.HELEMENT ByMouseClick int32 // boolean // true if focus is being set by mouse click Cancel int32 // boolean // in FOCUS_LOST phase setting this field to true will cancel transfer focus from old element to the new one. }
type GestureCmd ¶
type GestureCmd uint32
const ( GESTURE_REQUEST GestureCmd = iota // 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. )
enum GESTURE_CMD
func (GestureCmd) String ¶
func (i GestureCmd) String() string
type GestureParams ¶
type GestureParams struct { Cmd GestureCmd Target C.HELEMENT Pos Point PosView Point Flags uint32 DeltaTime uint32 DeltaXY Size DeltaV float64 }
struct GESTURE_PARAMS { UINT cmd; // GESTURE_EVENTS HELEMENT target; // target element POINT pos; // position of cursor, element relative POINT pos_view; // position of cursor, view relative UINT flags; // for GESTURE_REQUEST combination of GESTURE_FLAGs.
// for others it is a combination of GESTURE_STATe's
UINT delta_time; // period of time from previous event. SIZE delta_xy; // for GESTURE_PAN it is a direction vector double delta_v; // for GESTURE_ROTATE - delta angle (radians)
// for GESTURE_ZOOM - zoom value, is less or greater than 1.0 };
type GestureState ¶
type GestureState uint32
const ( GESTURE_STATE_BEGIN GestureState = 1 // starts GESTURE_STATE_INERTIA GestureState = 2 // events generated by inertia processor GESTURE_STATE_END GestureState = 4 // end last event of the gesture sequence )
enum GESTURE_STATE
func (GestureState) String ¶
func (i GestureState) String() string
type GestureTypeFlag ¶
type GestureTypeFlag uint32
const ( GESTURE_FLAG_ZOOM GestureTypeFlag = 0x0001 GESTURE_FLAG_ROTATE GestureTypeFlag = 0x0002 GESTURE_FLAG_PAN_VERTICAL GestureTypeFlag = 0x0004 GESTURE_FLAG_PAN_HORIZONTALGestureTypeFlag = 0x0008 GESTURE_FLAG_TAP1 GestureTypeFlag = 0x0010 // press & tap GESTURE_FLAG_TAP2 GestureTypeFlag = 0x0020 // two fingers tap GESTURE_FLAG_PAN_WITH_GUTTER GestureTypeFlag = 0x4000 // PAN_VERTICAL and PAN_HORIZONTAL modifiers GESTURE_FLAG_PAN_WITH_INERTIA GestureTypeFlag = 0x8000 // GESTURE_FLAGS_ALL GestureTypeFlag = 0xFFFF // )
enum GESTURE_TYPE_FLAGS // requested
func (GestureTypeFlag) String ¶
func (i GestureTypeFlag) String() string
type HVM ¶
type HVM PTiscriptVM
type InitializationParams ¶
type InitializationParams struct {
Cmd uint32
}
type KeyParams ¶
type KeyParams struct { Cmd KeyEvent // KeyEvents Target C.HELEMENT KeyCode uint32 AltState KeyboardState }
type KeyValueCallback ¶
type KeyboardState ¶
type KeyboardState uint32
const ( CONTROL_KEY_PRESSED KeyboardState = 0x1 SHIFT_KEY_PRESSED KeyboardState = 0x2 ALT_KEY_PRESSED KeyboardState = 0x4 )
enum KEYBOARD_STATES
type MethodParams ¶
type MethodParams struct {
MethodId BehaviorMethodIdentifier
}
type MouseButton ¶
type MouseButton uint32
const ( MAIN_MOUSE_BUTTON MouseButton = 1 //aka left button PROP_MOUSE_BUTTON MouseButton = 2 //aka right button MIDDLE_MOUSE_BUTTON MouseButton = 4 )
enum MOUSE_BUTTONS
type MouseEvent ¶
type MouseEvent uint32
const ( MOUSE_ENTER MouseEvent = iota MOUSE_LEAVE MOUSE_MOVE MOUSE_UP MOUSE_DOWN MOUSE_DCLICK MOUSE_WHEEL MOUSE_TICK // mouse pressed ticks MOUSE_IDLE // mouse stay idle for some time DROP // item dropped target is that dropped item DRAG_ENTER // drag arrived to the target element that is one of current drop targets. DRAG_LEAVE // drag left one of current drop targets. target is the drop target element. DRAG_REQUEST // drag src notification before drag start. To cancel - return true from handler. MOUSE_CLICK MouseEvent = 0xFF // mouse click event DRAGGING MouseEvent = 0x100 // This flag is 'ORed' with MOUSE_ENTER..MOUSE_DOWN codes if dragging operation is in effect. )
parameters of evtg == HANDLE_MOUSE enum MOUSE_EVENTS
func (MouseEvent) String ¶
func (i MouseEvent) String() string
type MouseParams ¶
type MouseParams struct { Cmd MouseEvent // MouseEvents Target C.HELEMENT Pos Point DocumentPos Point ButtonState MouseButton AltState KeyboardState CursorType CursorType IsOnIcon int32 Dragging C.HELEMENT DraggingMode DraggingType }
type NativeFunctor ¶
type PTiscriptVM ¶
type PTiscriptVM uintptr
type PopupPlacement ¶
type PopupPlacement uint32
* \param[in] placement \b UINT, values: * 2 - popup element below of anchor * 8 - popup element above of anchor * 4 - popup element on left side of anchor * 6 - popup element on right side of anchor * ( see numpad on keyboard to get an idea of the numbers)
const ( BelowAnchor PopupPlacement = 2 LeftOfAnchor PopupPlacement = 4 RightOfAnchor PopupPlacement = 6 )
type REQUEST_RESULT ¶
type REQUEST_RESULT int32
func (REQUEST_RESULT) String ¶
func (i REQUEST_RESULT) String() string
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request represents a request issued by sciter e.g. el.request(...) or view.request(...)
func WrapRequest ¶
WrapRequest wraps C.HREQUEST to a go side *Request, doing RequestUse/RequestUnUse automatically
func (*Request) AppendDataChunk ¶
func (*Request) ContentUrl ¶
func (*Request) NumberOfParameters ¶
func (*Request) NumberOfRqHeaders ¶
func (*Request) NumberOfRspHeaders ¶
func (*Request) ReceivedDataType ¶
func (*Request) RequestSetReceivedDataEncoding ¶
func (*Request) RequestType ¶
func (*Request) RequestedDataType ¶
func (r *Request) RequestedDataType() (SciterResourceType, error)
func (*Request) SetReceivedDataType ¶
func (*Request) SetRqHeader ¶
func (*Request) SetRspHeader ¶
type RequestParam ¶
type RequestType ¶
type RequestType uint32
const ( GET_ASYNC RequestType = iota // async GET POST_ASYNC // async POST GET_SYNC // synchronous GET POST_SYNC // synchronous POST )
enum REQUEST_TYPE
type SCDOM_RESULT ¶
type SCDOM_RESULT int32
typedef int SCDOM_RESULT;
const ( SCDOM_OK SCDOM_RESULT = iota SCDOM_INVALID_HWND SCDOM_INVALID_HANDLE SCDOM_PASSIVE_HANDLE SCDOM_INVALID_PARAMETER SCDOM_OPERATION_FAILED SCDOM_OK_NOT_HANDLED SCDOM_RESULT = (-1) )
func (SCDOM_RESULT) String ¶
func (i SCDOM_RESULT) String() string
type SCITER_SCROLL_FLAGS ¶
type SCITER_SCROLL_FLAGS uint32
const ( SCROLL_TO_TOP SCITER_SCROLL_FLAGS = 0x01 SCROLL_SMOOTH SCITER_SCROLL_FLAGS = 0x10 )
enum SCITER_SCROLL_FLAGS
type SET_ELEMENT_HTML ¶
type SET_ELEMENT_HTML int32
const ( SIH_REPLACE_CONTENT SET_ELEMENT_HTML = 0 SIH_INSERT_AT_START SET_ELEMENT_HTML = 1 SIH_APPEND_AFTER_LAST SET_ELEMENT_HTML = 2 SOH_REPLACE SET_ELEMENT_HTML = 3 SOH_INSERT_BEFORE SET_ELEMENT_HTML = 4 SOH_INSERT_AFTER SET_ELEMENT_HTML = 5 )
enum SET_ELEMENT_HTML
type Sciter ¶
type Sciter struct {
// contains filtered or unexported fields
}
func (*Sciter) AttachWindowEventHandler ¶
func (s *Sciter) AttachWindowEventHandler(handler *EventHandler) error
SCDOM_RESULT SciterWindowAttachEventHandler( HWINDOW hwndLayout, LPELEMENT_EVENT_PROC pep, LPVOID tag, UINT subscription )
func (*Sciter) Call ¶
To call global function defined in script using its full name (may include name of namespaces where it resides)
func (*Sciter) DataReady ¶
This function is used in response to SCN_LOAD_DATA request.
\param[in] hwnd \b HWINDOW, Sciter window handle. \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 (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
func (*Sciter) DataReadyAsync ¶
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. \param[in] hwnd \b HWINDOW, Sciter window handle. \param[in] uri \b LPCWSTR, URI of the data requested by Sciter. \param[in] data \b LPBYTE, pointer to data buffer. \param[in] requestId \b LPVOID, SCN_LOAD_DATA requestId. \return \b BOOL, TRUE if Sciter accepts the data or \c FALSE if error occured
func (*Sciter) DefineFunction ¶
DefineFunction defines global scripting function which works for tiscript and csss! script.
The global function must be access via the `view` namespace
func (*Sciter) DetachWindowEventHandler ¶
func (s *Sciter) DetachWindowEventHandler(handler *EventHandler) error
SCDOM_RESULT SciterWindowDetachEventHandler( HWINDOW hwndLayout, LPELEMENT_EVENT_PROC pep, LPVOID tag )
func (*Sciter) Eval ¶
To evaluate arbitrary script in context of current document loaded into the window
func (*Sciter) FindElement ¶
Find DOM element by coordinate.
\param[in] hwnd \b HWINDOW, Sciter window for which you need to find elementz \param[in] pt \b POINT, coordinates, window client area relative. \param[out ] phe \b #HELEMENT*, variable to receive found element handle. \return \b #SCDOM_RESULT SCAPI If element was not found then *phe will be set to zero.
func (*Sciter) GetArchiveItem ¶
Get an archive item referenced by \c uri.
Usually it is passed to \c Sciter.DataReady().
func (*Sciter) GetElementByUID ¶
SCDOM_RESULT SciterGetElementByUID(HWINDOW hwnd, UINT uid, HELEMENT* phe)
func (*Sciter) GetFocusElement ¶
Get focused DOM element of HTML document.
\param[in] hwnd \b HWINDOW, Sciter window for which you need to get focus element \param[out ] phe \b #HELEMENT*, variable to receive focus element \return \b #SCDOM_RESULT SCAPI phe can have null value (0). COMMENT: To set focus on element use SciterSetElementState(STATE_FOCUS,0)
func (*Sciter) GetRootElement ¶
Get root DOM element of HTML document.
\param[in] hwnd \b HWINDOW, Sciter window for which you need to get root element \param[out ] phe \b #HELEMENT*, variable to receive root element \return \b #SCDOM_RESULT SCAPI Root DOM object is always a 'HTML' element of the document.
func (*Sciter) LoadHtml ¶
Load HTML from in memory buffer with base.
\param[in] hWndSciter \b HWINDOW, Sciter window handle. \param[in] html \b LPCBYTE, Address of HTML to load. \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.
func (*Sciter) OpenArchive ¶
Open data blob of the provided compressed Sciter archive.
func (*Sciter) SetCSS ¶
Set (reset) style sheet of current document. Will reset styles for all elements according to given CSS (utf8)
\param[in] hWndSciter \b HWINDOW, Sciter window handle. \param[in] utf8 \b LPCBYTE, start of CSS buffer. \param[in] numBytes \b UINT, number of bytes in utf8.
func (*Sciter) SetCallback ¶
func (s *Sciter) SetCallback(handler *CallbackHandler)
Set \link #SCITER_NOTIFY() notification callback function \endlink.
\param[in] hWndSciter \b HWINDOW, Sciter window handle. \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.
func (*Sciter) SetHomeURL ¶
Set sciter home url.
home url is used for resolving sciter: urls If you will set it like SciterSetHomeURL(hwnd,"http://sciter.com/modules/") then <script src="sciter:lib/root-extender.tis"> will load root-extender.tis from http://sciter.com/modules/lib/root-extender.tis \param[in] hWndSciter \b HWINDOW, Sciter window handle. \param[in] baseUrl \b LPCWSTR, URL of sciter home.
func (*Sciter) SetMediaType ¶
Set media type of this sciter instance.
\param[in] hWndSciter \b HWINDOW, Sciter window handle. \param[in] mediaType \b LPCWSTR, media type name. For example media type can be "handheld", "projection", "screen", "screen-hires", etc. By default sciter window has "screen" media type. Media type name is used while loading and parsing style sheets in the engine so you should call this function *before* loading document in it.
func (*Sciter) SetOption ¶
func (s *Sciter) SetOption(option Sciter_RT_OPTIONS, value uint) (ok bool)
BOOL SciterSetOption (HWINDOW hWnd, UINT option, UINT_PTR value )
func (*Sciter) SetResourceArchive ¶
Register `this://app/` URLs to be loaded from the given Sciter archive.
Pack resources using `packfolder` tool:
`$ packfolder res_folder res_packed.go -v resource_name -go`
Usage:
```
win.SetResourceArchive(resource_name) win.LoadFile("this://app//index.htm")
```
type SciterCallbackNotification ¶
Notify structures *Notification callback structure.
*
typedef struct SCITER_CALLBACK_NOTIFICATION
{ UINT code; /**< [in] one of the codes above.*/ HWINDOW hwnd; /**< [in] HWINDOW of the window this callback was attached to.*/ } SCITER_CALLBACK_NOTIFICATION;
type SciterResourceType ¶
type SciterResourceType uint32
* Resource data type.
- Used by SciterDataReadyAsync() function. *
const ( RT_DATA_HTML SciterResourceType = iota RT_DATA_IMAGE RT_DATA_STYLE RT_DATA_CURSOR RT_DATA_SCRIPT RT_DATA_RAW RT_DATA_FONT RT_DATA_SOUND // wav bytes RT_DATA_FORCE_DWORD = 0xffffffff )
typedef enum SciterResourceType
type Sciter_RT_OPTIONS ¶
type Sciter_RT_OPTIONS uint32
type ScnAttachBehavior ¶
type ScnAttachBehavior C.SCN_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.*/ 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.*/
} SCN_ATTACH_BEHAVIOR;
func (*ScnAttachBehavior) BehaviorName ¶
func (s *ScnAttachBehavior) BehaviorName() string
func (*ScnAttachBehavior) Element ¶
func (s *ScnAttachBehavior) Element() C.HELEMENT
type ScnDataLoaded ¶
type ScnDataLoaded struct { SciterCallbackNotification DataSize uint32 DataType SciterResourceType Status uint32 // contains filtered or unexported fields }
*This structure is used by #SCN_DATA_LOADED notification.
*\copydoc SCN_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.*/ 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 dataType; /**< [in] SciterResourceType */ UINT status; /**< [in] status = 0 (dataSize == 0) - unknown error. status = 100..505 - http response status, Note: 200 - OK! status > 12000 - wininet error code, see ERROR_INTERNET_*** in wininet.h */ } SCN_DATA_LOADED;
func (*ScnDataLoaded) Data ¶
func (s *ScnDataLoaded) Data() []byte
func (*ScnDataLoaded) Uri ¶
func (s *ScnDataLoaded) Uri() string
type ScnEngineDestroyed ¶
type ScnEngineDestroyed SciterCallbackNotification
*This structure is used by #SC_ENGINE_DESTROYED notification.
*\copydoc SCN_ENGINE_DESTROYED *
typedef struct SCN_ENGINE_DESTROYED
{ UINT code; /**< [in] one of the codes above.*/ HWINDOW hwnd; /**< [in] HWINDOW of the window this callback was attached to.*/ } SCN_ENGINE_DESTROYED;
type ScnGraphicsCriticalFailure ¶
type ScnGraphicsCriticalFailure SciterCallbackNotification
*This structure is used by #SC_GRAPHICS_CRITICAL_FAILURE notification.
*\copydoc SC_GRAPHICS_CRITICAL_FAILURE *
type ScnInvalidateRect ¶
type ScnInvalidateRect struct { SciterCallbackNotification // contains filtered or unexported fields }
*This structure is used by #SC_INVALIDATE_RECT notification.
*\copydoc SC_INVALIDATE_RECT *
type ScnKeyboardRequest ¶
type ScnKeyboardRequest struct { SciterCallbackNotification // contains filtered or unexported fields }
*This structure is used by #SC_KEYBOARD_REQUEST notification.
*\copydoc SC_KEYBOARD_REQUEST *
type ScnLoadData ¶
type ScnLoadData C.SCN_LOAD_DATA
func (*ScnLoadData) Data ¶
func (s *ScnLoadData) Data() []byte
func (*ScnLoadData) RequestId ¶
func (s *ScnLoadData) RequestId() C.HREQUEST
func (*ScnLoadData) SetData ¶
func (s *ScnLoadData) SetData(data []byte)
func (*ScnLoadData) Uri ¶
func (s *ScnLoadData) Uri() string
type ScnPostedNotification ¶
type ScnPostedNotification struct { SciterCallbackNotification Wparam *uint Lparam *uint Lreturn *uint }
*This structure is used by #SC_ENGINE_DESTROYED notification.
*\copydoc SCN_ENGINE_DESTROYED *
typedef struct SCN_POSTED_NOTIFICATION
{ UINT code; /**< [in] one of the codes above.*/ HWINDOW hwnd; /**< [in] HWINDOW of the window this callback was attached to.*/ UINT_PTR wparam; UINT_PTR lparam; UINT_PTR lreturn; } SCN_POSTED_NOTIFICATION;
type ScriptingMethodParams ¶
type ScriptingMethodParams C.SCRIPTING_METHOD_PARAMS
func (*ScriptingMethodParams) Arg ¶
func (r *ScriptingMethodParams) Arg(i int) *Value
func (*ScriptingMethodParams) Argc ¶
func (s *ScriptingMethodParams) Argc() int
func (*ScriptingMethodParams) Args ¶
func (r *ScriptingMethodParams) Args() []*Value
func (*ScriptingMethodParams) Name ¶
func (s *ScriptingMethodParams) Name() string
func (*ScriptingMethodParams) Return ¶
func (s *ScriptingMethodParams) Return(val interface{})
set the return val for the scripting func if not set return undefined
type ScrollEvent ¶
type ScrollEvent uint32
const ( SCROLL_HOME ScrollEvent = iota SCROLL_END SCROLL_STEP_PLUS SCROLL_STEP_MINUS SCROLL_PAGE_PLUS SCROLL_PAGE_MINUS SCROLL_POS SCROLL_SLIDER_RELEASED SCROLL_CORNER_PRESSED SCROLL_CORNER_RELEASED )
enum SCROLL_EVENTS
func (ScrollEvent) String ¶
func (i ScrollEvent) String() string
type ScrollParams ¶
type ScrollParams struct { Cmd ScrollEvent Target C.HELEMENT Pos int32 Vertical int32 // bool }
struct SCROLL_PARAMS
{ UINT cmd; // SCROLL_EVENTS HELEMENT target; // target element INT pos; // scroll position if SCROLL_POS BOOL vertical; // true if from vertical scrollbar };
type SomParams ¶
type SomParams C.SOM_PARAMS
type TimerParams ¶
type TimerParams struct {
TimerId uintptr
}
type TiscriptMethodParams ¶
type TiscriptMethodParams struct { // tiscript_VM *vm VM HVM // tiscript_value tag //< method id (symbol) Tag TiscriptValue // tiscript_value result //< return value Result TiscriptValue }
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;
type TiscriptPvalue ¶
type TiscriptPvalue struct { Val TiscriptValue VM HVM // contains filtered or unexported fields }
// pinned tiscript_value, val here will survive GC. typedef struct tiscript_pvalue
{ tiscript_value val; struct tiscript_VM* vm; void *d1,*d2; } tiscript_pvalue;
type VALUE_RESULT ¶
type VALUE_RESULT int32 //C.VALUE_RESULT
const ( HV_OK_TRUE VALUE_RESULT = iota - 1 HV_OK HV_BAD_PARAMETER HV_INCOMPATIBLE_TYPE )
enum VALUE_RESULT
func (VALUE_RESULT) String ¶
func (i VALUE_RESULT) String() string
type Value ¶
typedef struct
{ UINT t; UINT u; UINT64 d; } VALUE;
func NewValue ¶
func NewValue(val ...interface{}) *Value
Only supported basic types: int/bool/string/float/NativeFunctor/Value
for creating array: a := NewValue(); a.SetIndex(0, 123)|a.Append(123) for creating map/object: obj := NewValue(); obj.Set("key", "value")
The creating process would call ValueInit/VlaueClear automatically
func NothingValue ¶
func NothingValue() *Value
static value nothing() { value n; n.t = T_UNDEFINED; n.u = UT_NOTHING; return n; }
func NullValue ¶
func NullValue() *Value
// static value null() { value n; n.t = T_NULL; return n; }
func (*Value) Assign ¶
func (v *Value) Assign(val interface{})
Assign go value to Sciter Value currently supported go types: bool integer float string and NativeFunctor
func (*Value) ConvertFromString ¶
func (pdst *Value) ConvertFromString(str string, how ValueStringConvertType) error
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_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)
func (*Value) ConvertToString ¶
func (pdst *Value) ConvertToString(how ValueStringConvertType) error
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_MAP - parse/emit MAP value without enclosing '{' and '}' brackets.
func (*Value) Copy ¶
ValueCopy - copies src VALUE to dst VALUE. dst VALUE must be in ValueInit state.
func (*Value) EnumerateKeyValue ¶
func (pdst *Value) EnumerateKeyValue(fn KeyValueCallback) error
*
- ValueEnumElements - enumeartes key/value pairs of T_MAP, T_FUNCTION and T_OBJECT values
- - T_MAP - key of nth key/value pair in the map;
- - T_FUNCTION - name of nth argument of the function (if any);
UINT ValueEnumElements ( VALUE* pval, KeyValueCallback* penum, LPVOID param) ;//{ return SAPI()->ValueEnumElements (pval,penum,param); }
func (*Value) Float ¶
UINT ValueFloatData ( const VALUE* pval, FLOAT_VALUE* pData ) ;//{ return SAPI()->ValueFloatData ( pval,pData ); }
func (*Value) Get ¶
ValueGetValueOfKey - retrieves 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
Otherwise *pretval will have T_UNDEFINED value.
func (*Value) Index ¶
ValueNthElementValue - retreive value of sub-element at index n for: - 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;
func (*Value) Int ¶
UINT ValueIntData ( const VALUE* pval, INT* pData ) ;//{ return SAPI()->ValueIntData ( pval, pData ); }
func (*Value) Int64 ¶
UINT ValueInt64Data ( const VALUE* pval, INT64* pData ) ;//{ return SAPI()->ValueInt64Data ( pval,pData ); }
func (*Value) Invoke ¶
ValueInvoke - function invocation (Sciter/TIScript). Usually as callbacks for asynchronous tasks
- VALUE* pval is a value of type T_OBJECT/UT_OBJECT_FUNCTION
- VALUE* self - object that will be known as 'this' inside that function. 'self' here is what will be known as 'this' inside the function, can be undefined for invocations of global functions
- 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
func (*Value) IsCurrency ¶
bool is_currency() const { return t == T_CURRENCY; }
func (*Value) IsDomElement ¶
bool is_dom_element() const { return t == T_DOM_OBJECT; }
func (*Value) IsDuration ¶
bool is_duration() const { return t == T_DURATION; }
func (*Value) IsFunction ¶
bool is_function() const { return t == T_FUNCTION; }
func (*Value) IsNativeFunctor ¶
BOOL ValueIsNativeFunctor ( const VALUE* pval) ;//{ return SAPI()->ValueIsNativeFunctor (pval); }
func (*Value) IsObjectArray ¶
bool is_object_array() const { return t == T_OBJECT && u == UT_OBJECT_ARRAY; }
func (*Value) IsObjectClass ¶
bool is_object_class() const { return t == T_OBJECT && u == UT_OBJECT_CLASS; } // that is TS class
func (*Value) IsObjectE ¶
bool is_object_error() const { return t == T_OBJECT && u == UT_OBJECT_ERROR; } // that is TS error
func (*Value) IsObjectFunction ¶
bool is_object_function() const { return t == T_OBJECT && u == UT_OBJECT_FUNCTION; }
func (*Value) IsObjectNative ¶
bool is_object_native() const { return t == T_OBJECT && u == UT_OBJECT_NATIVE; }
func (*Value) IsObjectObject ¶
bool is_object_object() const { return t == T_OBJECT && u == UT_OBJECT_OBJECT; } // that is plain TS object
func (*Value) IsUndefined ¶
bool is_undefined() const { return t == T_UNDEFINED; }
func (*Value) Isolate ¶
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
func (*Value) Length ¶
ValueElementsCount - retreive number of sub-elements for: - 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;
func (*Value) NthElementKey ¶
UINT ValueNthElementKey ( const VALUE* pval, INT n, VALUE* pretval) ;//{ return SAPI()->ValueNthElementKey ( pval,n,pretval); }
func (*Value) Set ¶
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 single pair - 'key'/'val_to_set'.
key usually is a value of type T_STRING
func (*Value) SetBytes ¶
UINT ValueBinaryDataSet ( VALUE* pval, LPCBYTE pBytes, UINT nBytes, UINT type, UINT units )
func (*Value) SetFloat ¶
UINT ValueFloatDataSet ( VALUE* pval, FLOAT_VALUE data, UINT type, UINT units ) ;//{ return SAPI()->ValueFloatDataSet ( pval,data,type,units ); }
func (*Value) SetIndex ¶
ValueNthElementValueSet - sets value of sub-element at index n for:
- 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 single element - 'val_to_set'.
func (*Value) SetInt ¶
UINT ValueIntDataSet ( VALUE* pval, INT data, UINT type, UINT units ) ;//{ return SAPI()->ValueIntDataSet ( pval, data,type,units ); }
func (*Value) SetInt64 ¶
UINT ValueInt64DataSet ( VALUE* pval, INT64 data, UINT type, UINT units ) ;//{ return SAPI()->ValueInt64DataSet ( pval,data,type,units ); }
func (*Value) SetNativeFunctor ¶
func (pdst *Value) SetNativeFunctor(nf NativeFunctor) error
ValueNativeFunctorSet - set reference to native function
- 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
type ValueStringConvertType ¶
type ValueStringConvertType uint32
const ( CVT_SIMPLE ValueStringConvertType = iota ///< 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 )
enum VALUE_STRING_CVT_TYPE
type WindowCreationFlag ¶
type WindowCreationFlag uint32
enum SCITER_CREATE_WINDOW_FLAGS { SW_CHILD = (1 << 0), // child window only, if this flag is set all other flags ignored SW_TITLEBAR = (1 << 1), // toplevel window, has titlebar SW_RESIZEABLE = (1 << 2), // has resizeable frame SW_TOOL = (1 << 3), // is tool window SW_CONTROLS = (1 << 4), // has minimize / maximize buttons SW_GLASSY = (1 << 5), // glassy window ( DwmExtendFrameIntoClientArea on windows ) SW_ALPHA = (1 << 6), // transparent window ( e.g. WS_EX_LAYERED on Windows ) SW_MAIN = (1 << 7), // main window of the app, will terminate the app on close SW_POPUP = (1 << 8), // the window is created as topmost window. SW_ENABLE_DEBUG = (1 << 9), // make this window inspector ready SW_OWNS_VM = (1 << 10), // it has its own script VM };
const ( SW_CHILD WindowCreationFlag = (1 << iota) // child window only, if this flag is set all other flags ignored SW_TITLEBAR // toplevel window, has titlebar SW_RESIZEABLE // has resizeable frame SW_TOOL // is tool window SW_CONTROLS // has minimize / maximize buttons SW_GLASSY // glassy window ( DwmExtendFrameIntoClientArea on windows ) SW_ALPHA // transparent window ( e.g. WS_EX_LAYERED on Windows ) SW_MAIN // main window of the app, will terminate the app on close SW_POPUP // the window is created as topmost window. SW_ENABLE_DEBUG // make this window inspector ready SW_OWNS_VM // it has its own script VM )