2022-10-04 13:21:05 +08:00
|
|
|
//----------------------------------------
|
|
|
|
//
|
|
|
|
// Copyright © yanghy. All Rights Reserved.
|
|
|
|
//
|
2022-10-04 16:38:43 +08:00
|
|
|
// Licensed under GNU General Public License v3.0
|
2022-10-04 13:21:05 +08:00
|
|
|
//
|
|
|
|
//----------------------------------------
|
|
|
|
|
|
|
|
package cef
|
|
|
|
|
|
|
|
import (
|
2022-11-02 12:47:47 +08:00
|
|
|
. "github.com/energye/energy/common"
|
2022-10-04 13:21:05 +08:00
|
|
|
"github.com/energye/golcl/lcl/api"
|
|
|
|
"github.com/energye/golcl/lcl/types"
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
//--------TCEFApplication proc begin--------
|
|
|
|
|
|
|
|
// TCEFApplication AddCrDelegate
|
|
|
|
func AddCrDelegate() uintptr {
|
|
|
|
r1, _, _ := Proc("CEF_AddCrDelegate").Call()
|
|
|
|
return r1
|
|
|
|
}
|
|
|
|
|
|
|
|
// TCEFApplication _CEFApplication_Create
|
|
|
|
func _CEFApplication_Create(config uintptr) uintptr {
|
|
|
|
r1, _, _ := Proc("CEFApplication_Create").Call(config)
|
|
|
|
return r1
|
|
|
|
}
|
|
|
|
|
|
|
|
// TCEFApplication _CEFApplication_Free
|
|
|
|
func _CEFApplication_Free() uintptr {
|
|
|
|
r1, _, _ := Proc("CEFApplication_Free").Call()
|
|
|
|
return r1
|
|
|
|
}
|
|
|
|
|
|
|
|
// TCEFApplication _CEFStartMainProcess
|
|
|
|
func _CEFStartMainProcess(instance uintptr) uintptr {
|
|
|
|
r1, _, _ := Proc("CEFStartMainProcess").Call(instance)
|
|
|
|
return r1
|
|
|
|
}
|
|
|
|
|
|
|
|
// TCEFApplication _CEFStartSubProcess
|
|
|
|
func _CEFStartSubProcess(instance uintptr) uintptr {
|
|
|
|
r1, _, _ := Proc("CEFStartSubProcess").Call(instance)
|
|
|
|
return r1
|
|
|
|
}
|
|
|
|
|
|
|
|
func _AddCustomCommandLine(commandLine, value uintptr) {
|
|
|
|
Proc("AddCustomCommandLine").Call(commandLine, value)
|
|
|
|
}
|
|
|
|
|
|
|
|
func _CEFApplication_ExecuteJS(browseId int32, jsCode string) {
|
|
|
|
Proc("CEFApplication_ExecuteJS").Call(uintptr(browseId), api.GoStrToDStr(jsCode))
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------TCEFApplication proc end--------
|
|
|
|
|
|
|
|
//--------TCEFWindowParent proc begin--------
|
|
|
|
|
|
|
|
// TCEFWindowParent _CEFWindow_UpdateSize
|
|
|
|
func _CEFWindow_UpdateSize(instance uintptr) {
|
|
|
|
Proc("CEFWindow_UpdateSize").Call(instance)
|
|
|
|
}
|
|
|
|
|
|
|
|
func _CEFWindow_OnEnter(instance uintptr, fn interface{}) {
|
|
|
|
Proc("CEFWindow_OnEnter").Call(instance, api.GetAddEventToMapFn()(instance, fn))
|
|
|
|
}
|
|
|
|
|
|
|
|
func _CEFWindow_OnExit(instance uintptr, fn interface{}) {
|
|
|
|
Proc("CEFWindow_OnExit").Call(instance, api.GetAddEventToMapFn()(instance, fn))
|
|
|
|
}
|
|
|
|
|
|
|
|
// TCEFWindowParent _CEFLinkedWindow_UpdateSize
|
|
|
|
func _CEFLinkedWindow_UpdateSize(instance uintptr) {
|
|
|
|
Proc("CEFLinkedWindow_UpdateSize").Call(instance)
|
|
|
|
}
|
|
|
|
|
2022-12-01 15:24:22 +08:00
|
|
|
func _CEFLinkedWindow_SetChromium(instance uintptr, chromium IChromium, tag int32) {
|
|
|
|
Proc("CEFLinkedWindow_SetChromium").Call(instance, chromium.Instance(), uintptr(tag))
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func _CEFLinkedWindow_OnEnter(instance uintptr, fn interface{}) {
|
|
|
|
Proc("CEFLinkedWindow_OnEnter").Call(instance, api.GetAddEventToMapFn()(instance, fn))
|
|
|
|
}
|
|
|
|
|
|
|
|
func _CEFLinkedWindow_OnExit(instance uintptr, fn interface{}) {
|
|
|
|
Proc("CEFLinkedWindow_OnExit").Call(instance, api.GetAddEventToMapFn()(instance, fn))
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------TCEFWindowParent proc end--------
|
|
|
|
|
|
|
|
/* 通用 PROC --- begin ---*/
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _Create 创建
|
|
|
|
func _Create(name string, owner uintptr) uintptr {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "Create")
|
2022-10-04 13:21:05 +08:00
|
|
|
r1, _, _ := Proc(name).Call(owner)
|
|
|
|
return r1
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _GetHandle 获取组件句柄
|
|
|
|
func _GetHandle(name string, instance uintptr) uintptr {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "GetHandle")
|
2022-10-04 13:21:05 +08:00
|
|
|
ret, _, _ := Proc(name).Call(instance)
|
|
|
|
return ret
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
func _DestroyChildWindow(name string, instance uintptr) uintptr {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "DestroyChildWindow")
|
2022-10-04 13:21:05 +08:00
|
|
|
ret, _, _ := Proc(name).Call(instance)
|
|
|
|
return ret
|
|
|
|
}
|
|
|
|
|
|
|
|
// _HandleAllocated
|
2022-11-29 20:04:08 +08:00
|
|
|
func _HandleAllocated(name string, instance uintptr) uintptr {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "HandleAllocated")
|
2022-10-04 13:21:05 +08:00
|
|
|
r1, _, _ := Proc(name).Call(instance)
|
|
|
|
return r1
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _CreateHandle
|
|
|
|
func _CreateHandle(name string, instance uintptr) {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "CreateHandle")
|
2022-10-04 13:21:05 +08:00
|
|
|
Proc(name).Call(instance)
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _Free 释放
|
|
|
|
func _Free(name string, instance uintptr) uintptr {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "Free")
|
2022-10-04 13:21:05 +08:00
|
|
|
r1, _, _ := Proc(name).Call(instance)
|
|
|
|
return r1
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _SetParent 设置父组件
|
|
|
|
func _SetParent(name string, instance, owner uintptr) {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "SetParent")
|
2022-10-04 13:21:05 +08:00
|
|
|
Proc(name).Call(instance, owner)
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _Align 获取控件自动调整。
|
|
|
|
func _Align(name string, instance uintptr) types.TAlign {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "GetAlign")
|
2022-10-04 13:21:05 +08:00
|
|
|
r1, _, _ := Proc(name).Call(instance)
|
|
|
|
return types.TAlign(r1)
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _SetAlign 设置获取控件自动调整。
|
|
|
|
func _SetAlign(name string, instance uintptr, value types.TAlign) {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "SetAlign")
|
2022-10-04 13:21:05 +08:00
|
|
|
Proc(name).Call(instance, uintptr(value))
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _Anchors 获取四个角位置的锚点。
|
|
|
|
func _Anchors(name string, instance uintptr) types.TAnchors {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "GetAnchors")
|
2022-10-04 13:21:05 +08:00
|
|
|
r1, _, _ := Proc(name).Call(instance)
|
|
|
|
return types.TAnchors(r1)
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _SetAnchors 设置四个角位置的锚点。
|
|
|
|
func _SetAnchors(name string, instance uintptr, value types.TAnchors) {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "SetAnchors")
|
2022-10-04 13:21:05 +08:00
|
|
|
Proc(name).Call(instance, uintptr(value))
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _GetVisible 获取控件可视。
|
|
|
|
func _GetVisible(name string, instance uintptr) bool {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "GetVisible")
|
2022-10-04 13:21:05 +08:00
|
|
|
ret, _, _ := Proc(name).Call(instance)
|
|
|
|
return api.DBoolToGoBool(ret)
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _SetVisible 设置控件可视。
|
|
|
|
func _SetVisible(name string, instance uintptr, value bool) {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "SetVisible")
|
2022-10-04 13:21:05 +08:00
|
|
|
Proc(name).Call(instance, api.GoBoolToDBool(value))
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _GetEnabled 获取是否启用
|
|
|
|
func _GetEnabled(name string, instance uintptr) bool {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "GetEnabled")
|
2022-10-04 13:21:05 +08:00
|
|
|
ret, _, _ := Proc(name).Call(instance)
|
|
|
|
return api.DBoolToGoBool(ret)
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _SetEnabled 设置是否启用
|
|
|
|
func _SetEnabled(name string, instance uintptr, value bool) {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "SetEnabled")
|
2022-10-04 13:21:05 +08:00
|
|
|
Proc(name).Call(instance, api.GoBoolToDBool(value))
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _GetLeft 获取左边距
|
|
|
|
func _GetLeft(name string, instance uintptr) int32 {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "GetLeft")
|
2022-10-04 13:21:05 +08:00
|
|
|
ret, _, _ := Proc(name).Call(instance)
|
|
|
|
return int32(ret)
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _SetLeft 设置左边距
|
|
|
|
func _SetLeft(name string, instance uintptr, value int32) {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "SetLeft")
|
2022-10-04 13:21:05 +08:00
|
|
|
Proc(name).Call(instance, uintptr(value))
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _Top 获取上边距
|
|
|
|
func _GetTop(name string, instance uintptr) int32 {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "GetTop")
|
2022-10-04 13:21:05 +08:00
|
|
|
ret, _, _ := Proc(name).Call(instance)
|
|
|
|
return int32(ret)
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _SetTop 设置上边距
|
|
|
|
func _SetTop(name string, instance uintptr, value int32) {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "SetTop")
|
2022-10-04 13:21:05 +08:00
|
|
|
Proc(name).Call(instance, uintptr(value))
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _GetWidth 获取宽度
|
|
|
|
func _GetWidth(name string, instance uintptr) int32 {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "GetWidth")
|
2022-10-04 13:21:05 +08:00
|
|
|
ret, _, _ := Proc(name).Call(instance)
|
|
|
|
return int32(ret)
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _SetWidth 设置宽度
|
|
|
|
func _SetWidth(name string, instance uintptr, value int32) {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "SetWidth")
|
2022-10-04 13:21:05 +08:00
|
|
|
Proc(name).Call(instance, uintptr(value))
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _GetHeight 获取高度
|
|
|
|
func _GetHeight(name string, instance uintptr) int32 {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "GetHeight")
|
2022-10-04 13:21:05 +08:00
|
|
|
ret, _, _ := Proc(name).Call(instance)
|
|
|
|
return int32(ret)
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _SetHeight 设置高度
|
|
|
|
func _SetHeight(name string, instance uintptr, value int32) {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "SetHeight")
|
2022-10-04 13:21:05 +08:00
|
|
|
Proc(name).Call(instance, uintptr(value))
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _GetBoundsRect
|
|
|
|
func _GetBoundsRect(name string, instance uintptr) types.TRect {
|
2022-10-04 13:21:05 +08:00
|
|
|
var ret types.TRect
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "GetBoundsRect")
|
2022-10-04 13:21:05 +08:00
|
|
|
Proc(name).Call(instance, uintptr(unsafe.Pointer(&ret)))
|
|
|
|
return ret
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _SetBoundsRect
|
|
|
|
func _SetBoundsRect(name string, instance uintptr, value types.TRect) {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "SetBoundsRect")
|
2022-10-04 13:21:05 +08:00
|
|
|
Proc(name).Call(instance, uintptr(unsafe.Pointer(&value)))
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _GetName 获取组件名称。
|
|
|
|
func _GetName(name string, instance uintptr) string {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "GetName")
|
2022-10-04 13:21:05 +08:00
|
|
|
ret, _, _ := Proc(name).Call(instance)
|
|
|
|
return api.DStrToGoStr(ret)
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:04:08 +08:00
|
|
|
// _SetName 设置组件名称。
|
|
|
|
func _SetName(name string, instance uintptr, value string) {
|
2022-10-04 22:34:57 +08:00
|
|
|
name = Proc_Concat_Name(name, "SetName")
|
2022-10-04 13:21:05 +08:00
|
|
|
Proc(name).Call(instance, api.GoStrToDStr(value))
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 通用 PROC --- end ---*/
|
|
|
|
|
|
|
|
// other
|
|
|
|
|
|
|
|
// 针对 MacOSX 设置命令行参数
|
|
|
|
//
|
|
|
|
//没找到什么好的方式,只能这样设置
|
|
|
|
func setMacOSXCommandLine(commandLine uintptr) {
|
|
|
|
Proc("SetMacOSXCommandLine").Call(commandLine)
|
|
|
|
}
|