func (s *ScnLoadData) Uri() string {
	return Utf16ToString((*uint16)(unsafe.Pointer(s.uri)))
}
type ScnLoadData struct {
SciterCallbackNotification
uri         *uint16
outData     *byte
outDataSize uint
DataType    uint
RequestId   uintptr
Principal   C.HELEMENT
Initiator   C.HELEMENT
}
package sciter
import "C"
import (
	"fmt"
	"unsafe"
)
type WindowCreationFlag uint32
const (
	SW_CHILD        WindowCreationFlag = (1 << iota)  
	SW_TITLEBAR                                       
	SW_RESIZEABLE                                     
	SW_TOOL                                           
	SW_CONTROLS                                       
	SW_GLASSY                                         
	SW_ALPHA                                          
	SW_MAIN                                           
	SW_POPUP                                          
	SW_ENABLE_DEBUG                                   
	SW_OWNS_VM                                        
)
var (
	DefaultWindowCreateFlag = SW_TITLEBAR | SW_RESIZEABLE | SW_CONTROLS | SW_MAIN | SW_ENABLE_DEBUG
)
const (
	OT_DOM  = iota  
	OT_CSSS         
	OT_CSS          
	OT_TIS          
)
const (
	OS_INFO = iota
	OS_WARNING
	OS_ERROR
)
const (
	HANDLE_INITIALIZATION = 0x0000  
	HANDLE_MOUSE          = 0x0001  
	HANDLE_KEY            = 0x0002  
	HANDLE_FOCUS          = 0x0004  
	HANDLE_SCROLL         = 0x0008  
	HANDLE_TIMER          = 0x0010  
	HANDLE_SIZE           = 0x0020  
	HANDLE_DRAW           = 0x0040  
	HANDLE_DATA_ARRIVED   = 0x080   
	HANDLE_BEHAVIOR_EVENT = 0x0100  
	HANDLE_METHOD_CALL           = 0x0200  
	HANDLE_SCRIPTING_METHOD_CALL = 0x0400  
	HANDLE_TISCRIPT_METHOD_CALL  = 0x0800  
	HANDLE_EXCHANGE = 0x1000  
	HANDLE_GESTURE  = 0x2000  
	HANDLE_ALL = 0xFFFF  
	SUBSCRIPTIONS_REQUEST = 0xFFFFFFFF  
)
const (
	BUBBLING = 0       
	SINKING  = 0x8000  
	HANDLED  = 0x10000
)
type MouseButton uint32
const (
	MAIN_MOUSE_BUTTON   MouseButton = 1  
	PROP_MOUSE_BUTTON   MouseButton = 2  
	MIDDLE_MOUSE_BUTTON MouseButton = 4
)
type KeyboardState uint32
const (
	CONTROL_KEY_PRESSED KeyboardState = 0x1
	SHIFT_KEY_PRESSED   KeyboardState = 0x2
	ALT_KEY_PRESSED     KeyboardState = 0x4
)
const (
	BEHAVIOR_DETACH = 0
	BEHAVIOR_ATTACH = 1
)
type DraggingType uint32
const (
	NO_DRAGGING = iota
	DRAGGING_MOVE
	DRAGGING_COPY
)
type MouseEvent uint32
const (
	MOUSE_ENTER MouseEvent = iota
	MOUSE_LEAVE
	MOUSE_MOVE
	MOUSE_UP
	MOUSE_DOWN
	MOUSE_DCLICK
	MOUSE_WHEEL
	MOUSE_TICK  
	MOUSE_IDLE  
	DROP          
	DRAG_ENTER    
	DRAG_LEAVE    
	DRAG_REQUEST  
	MOUSE_CLICK MouseEvent = 0xFF  
	DRAGGING MouseEvent = 0x100  
)
type CursorType uint32
const (
	CURSOR_ARROW       CursorType = iota  
	CURSOR_IBEAM                          
	CURSOR_WAIT                           
	CURSOR_CROSS                          
	CURSOR_UPARROW                        
	CURSOR_SIZENWSE                       
	CURSOR_SIZENESW                       
	CURSOR_SIZEWE                         
	CURSOR_SIZENS                         
	CURSOR_SIZEALL                        
	CURSOR_NO                             
	CURSOR_APPSTARTING                    
	CURSOR_HELP                           
	CURSOR_HAND                           
	CURSOR_DRAG_MOVE                      
	CURSOR_DRAG_COPY                      
)
type KeyEvent uint32
const (
	KEY_DOWN KeyEvent = iota
	KEY_UP
	KEY_CHAR
)
type FocusEvent uint32
const (
	FOCUS_LOST FocusEvent = iota
	FOCUS_GOT
)
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
)
type GestureCmd uint32
const (
	GESTURE_REQUEST GestureCmd = iota  
	GESTURE_ZOOM                       
	GESTURE_PAN                        
	GESTURE_ROTATE                     
	GESTURE_TAP1                       
	GESTURE_TAP2                       
)
type GestureState uint32
const (
	GESTURE_STATE_BEGIN   GestureState = 1  
	GESTURE_STATE_INERTIA GestureState = 2  
	GESTURE_STATE_END     GestureState = 4  
)
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  
	GESTURE_FLAG_TAP2                          GestureTypeFlag = 0x0020  
	GESTURE_FLAG_PAN_WITH_GUTTER  GestureTypeFlag = 0x4000  
	GESTURE_FLAG_PAN_WITH_INERTIA GestureTypeFlag = 0x8000  
	GESTURE_FLAGS_ALL             GestureTypeFlag = 0xFFFF  
)
type DrawEvent uint32
const (
	DRAW_CONTENT    DrawEvent = 1
	DRAW_FOREGROUND DrawEvent = 2
)
const (
	CONTENT_ADDED   = 0x01
	CONTENT_REMOVED = 0x02
)
type BehaviorEvent uint32
const (
	BUTTON_CLICK             BehaviorEvent = 0  
	BUTTON_PRESS             BehaviorEvent = 1  
	BUTTON_STATE_CHANGED     BehaviorEvent = 2  
	EDIT_VALUE_CHANGING      BehaviorEvent = 3  
	EDIT_VALUE_CHANGED       BehaviorEvent = 4  
	SELECT_SELECTION_CHANGED BehaviorEvent = 5  
	SELECT_STATE_CHANGED     BehaviorEvent = 6  
	POPUP_REQUEST BehaviorEvent = 7  
	POPUP_READY BehaviorEvent = 8  
	POPUP_DISMISSED BehaviorEvent = 9  
	MENU_ITEM_ACTIVE BehaviorEvent = 0xA  
	MENU_ITEM_CLICK  BehaviorEvent = 0xB  
	CONTEXT_MENU_REQUEST BehaviorEvent = 0x10  
	VISIUAL_STATUS_CHANGED  BehaviorEvent = 0x11  
	DISABLED_STATUS_CHANGED BehaviorEvent = 0x12  
	POPUP_DISMISSING BehaviorEvent = 0x13  
	CONTENT_CHANGED BehaviorEvent = 0x15  
	HYPERLINK_CLICK BehaviorEvent = 0x80  
)
const (
	ELEMENT_COLLAPSED BehaviorEvent = iota + 0x90  
	ELEMENT_EXPANDED                               
	ACTIVATE_CHILD  
	INIT_DATA_VIEW  
	ROWS_DATA_REQUEST  
	UI_STATE_CHANGED  
	FORM_SUBMIT  
	FORM_RESET  
	DOCUMENT_COMPLETE  
	HISTORY_PUSH  
	HISTORY_DROP
	HISTORY_PRIOR
	HISTORY_NEXT
	HISTORY_STATE_CHANGED  
	CLOSE_POPUP      
	REQUEST_TOOLTIP  
	ANIMATION BehaviorEvent = 0xA0  
	DOCUMENT_CREATED       BehaviorEvent = 0xC0  
	DOCUMENT_CLOSE_REQUEST BehaviorEvent = 0xC1  
	DOCUMENT_CLOSE         BehaviorEvent = 0xC2  
	DOCUMENT_READY         BehaviorEvent = 0xC3  
	VIDEO_INITIALIZED BehaviorEvent = 0xD1  
	VIDEO_STARTED     BehaviorEvent = 0xD2  
	VIDEO_STOPPED     BehaviorEvent = 0xD3  
	VIDEO_BIND_RQ     BehaviorEvent = 0xD4  
	FIRST_APPLICATION_EVENT_CODE = 0x100
)
type EventReason uint
const (
	BY_MOUSE_CLICK EventReason = iota
	BY_KEY_CLICK
	SYNTHESIZED  
	BY_MOUSE_ON_ICON
)
type EditChangedReason uint
const (
	BY_INS_CHAR  EditChangedReason = iota  
	BY_INS_CHARS                           
	BY_DEL_CHAR                            
	BY_DEL_CHARS                           
	BY_UNDO_REDO                           
)
type BehaviorMethodIdentifier uint32
const (
	DO_CLICK BehaviorMethodIdentifier = iota
	GET_TEXT_VALUE
	SET_TEXT_VALUE
	TEXT_EDIT_GET_SELECTION
	TEXT_EDIT_SET_SELECTION
	TEXT_EDIT_REPLACE_SELECTION
	SCROLL_BAR_GET_VALUE
	SCROLL_BAR_SET_VALUE
	TEXT_EDIT_GET_CARET_POSITION
	TEXT_EDIT_GET_SELECTION_TEXT  
	TEXT_EDIT_GET_SELECTION_HTML  
	TEXT_EDIT_CHAR_POS_AT_XY      
	IS_EMPTY  BehaviorMethodIdentifier = 0xFC  
	GET_VALUE BehaviorMethodIdentifier = 0xFD  
	SET_VALUE BehaviorMethodIdentifier = 0xFE  
	FIRST_APPLICATION_METHOD_ID BehaviorMethodIdentifier = 0x100
)
const (
	T_UNDEFINED = iota
	T_NULL
	T_BOOL
	T_INT
	T_FLOAT
	T_STRING
	T_DATE      
	T_CURRENCY  
	T_LENGTH    
	T_ARRAY
	T_MAP
	T_FUNCTION
	T_BYTES       
	T_OBJECT      
	T_DOM_OBJECT  
)
const (
	UT_EM     = 1  
	UT_EX     = 2  
	UT_PR     = 3  
	UT_SP     = 4  
	reserved1 = 5
	reserved2 = 6
	UT_PX     = 7   
	UT_IN     = 8   
	UT_CM     = 9   
	UT_MM     = 10  
	UT_PT     = 11  
	UT_PC     = 12  
	UT_DIP    = 13
	reserved3 = 14
	UT_COLOR  = 15      
	UT_URL    = 16      
	UT_SYMBOL = 0xFFFF  
)
const (
	DT_HAS_DATE    = 0x01  
	DT_HAS_TIME    = 0x02  
	DT_HAS_SECONDS = 0x04  
	DT_UTC         = 0x10  
)
const (
	UT_OBJECT_ARRAY    = 0  
	UT_OBJECT_OBJECT   = 1  
	UT_OBJECT_CLASS    = 2  
	UT_OBJECT_NATIVE   = 3  
	UT_OBJECT_FUNCTION = 4  
	UT_OBJECT_ERROR    = 5  
)
type ValueStringConvertType uint32
const (
	CVT_SIMPLE        ValueStringConvertType = iota  
	CVT_JSON_LITERAL                                 
	CVT_JSON_MAP                                     
	CVT_XJSON_LITERAL                                
)
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
)
type InitializationParams struct {
	Cmd uint32
}
type MouseParams struct {
	Cmd         MouseEvent  
	Target      C.HELEMENT
	Pos         Point
	DocumentPos Point
	ButtonState MouseButton
	AltState    KeyboardState
	CursorType  CursorType
	IsOnIcon    int32
	Dragging     C.HELEMENT
	DraggingMode DraggingType
}
type KeyParams struct {
	Cmd      KeyEvent  
	Target   C.HELEMENT
	KeyCode  uint32
	AltState KeyboardState
}
type FocusParams struct {
	Cmd          FocusEvent  
	Target       C.HELEMENT
	ByMouseClick int32  
	Cancel       int32  
}
type DrawParams struct {
	Cmd      DrawEvent  
	Hdc      uintptr
	Area     Rect
	reserved uint32
}
type TimerParams struct {
	TimerId uintptr
}
type BehaviorEventParams C.BEHAVIOR_EVENT_PARAMS
func (b *BehaviorEventParams) Cmd() BehaviorEvent {
	return BehaviorEvent(b.cmd)
}
type MethodParams struct {
	MethodId BehaviorMethodIdentifier
}
type ScriptingMethodParams C.SCRIPTING_METHOD_PARAMS
func (s *ScriptingMethodParams) Name() string {
	return C.GoString(s.name)
}
func (s *ScriptingMethodParams) Argc() int {
	return int(s.argc)
}
func (r *ScriptingMethodParams) Args() []*Value {
	args := make([]*Value, 0)
	step := unsafe.Sizeof(r.result)
	for i := 0; i < int(r.Argc()); i++ {
		p := uintptr(unsafe.Pointer(r.argv)) + uintptr(i)*step
		args = append(args, (*Value)(unsafe.Pointer(p)))
	}
	return args
}
func (r *ScriptingMethodParams) Arg(i int) *Value {
	if i >= int(r.Argc()) {
		panic("ScriptingMethodParams arg index out of range")
	}
	p := uintptr(unsafe.Pointer(r.argv)) + uintptr(i)*unsafe.Sizeof(r.result)
	return (*Value)(unsafe.Pointer(p))
}
func (s *ScriptingMethodParams) Return(val interface{}) {
	v := (*Value)(unsafe.Pointer(&(s.result)))
	v.init()
	v.Assign(val)
}
type PTiscriptVM uintptr
type HVM PTiscriptVM
type TiscriptValue uint64
type TiscriptPvalue struct {
	Val    TiscriptValue
	VM     HVM
	d1, d2 uintptr
}
type TiscriptMethodParams struct {
	VM HVM
	Tag TiscriptValue
	Result TiscriptValue
}
type DataArrivedParams C.DATA_ARRIVED_PARAMS
func (d *DataArrivedParams) Uri() string {
	return Utf16ToString((*uint16)(unsafe.Pointer(d.uri)))
}
func (d *DataArrivedParams) Data() []byte {
	return BytePtrToBytes((*byte)(unsafe.Pointer(d.data)), uint(d.dataSize))
}
type ScrollParams struct {
	Cmd      ScrollEvent
	Target   C.HELEMENT
	Pos      int32
	Vertical int32  
}
type ExchangeCmd uint32
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 DDMode uint32
const (
	DD_MODE_NONE DDMode = 0
	DD_MODE_COPY
	DD_MODE_MOVE
	DD_MODE_COPY_OR_MOVE
	DD_MODE_LINK
)
type ExchangeParams struct {
	Cmd     ExchangeCmd
	Target  C.HELEMENT
	Source  C.HELEMENT
	Pos     Point
	PosView Point
	Mode    DDMode
	Data    Value
}
type GestureParams struct {
	Cmd       GestureCmd
	Target    C.HELEMENT
	Pos       Point
	PosView   Point
	Flags     uint32
	DeltaTime uint32
	DeltaXY   Size
	DeltaV    float64
}
const (
	LOAD_OK      = 0  
	LOAD_DISCARD = 1  
	LOAD_DELAYED = 2  
)
const (
	SC_LOAD_DATA = 0x01
	SC_DATA_LOADED = 0x02
	SC_ATTACH_BEHAVIOR = 0x04
	SC_ENGINE_DESTROYED = 0x05
	SC_POSTED_NOTIFICATION = 0x06
)
type SciterCallbackNotification struct {
	Code uint32
	Hwnd C.HWINDOW
}
type ScnEngineDestroyed SciterCallbackNotification
type ScnPostedNotification struct {
	SciterCallbackNotification
	Wparam  *uint
	Lparam  *uint
	Lreturn *uint
}
type ScnLoadData C.SCN_LOAD_DATA