2023-02-27 11:33:00 +08:00
|
|
|
//----------------------------------------
|
|
|
|
//
|
|
|
|
// Copyright © yanghy. All Rights Reserved.
|
|
|
|
//
|
|
|
|
// Licensed under Apache License Version 2.0, January 2004
|
|
|
|
//
|
|
|
|
// https://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
//----------------------------------------
|
|
|
|
|
2023-02-26 23:21:44 +08:00
|
|
|
package cef
|
|
|
|
|
2023-02-27 11:33:00 +08:00
|
|
|
import (
|
2023-06-11 00:10:55 +08:00
|
|
|
"github.com/energye/energy/v2/cef/internal/def"
|
2023-05-31 18:00:34 +08:00
|
|
|
"github.com/energye/energy/v2/common/imports"
|
2023-02-27 11:33:00 +08:00
|
|
|
"github.com/energye/golcl/lcl/api"
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
// PostDataRef -> ICefPostData
|
|
|
|
var PostDataRef postData
|
|
|
|
|
|
|
|
// postData
|
|
|
|
type postData uintptr
|
|
|
|
|
|
|
|
func (m *postData) New() *ICefPostData {
|
|
|
|
var result uintptr
|
2023-06-11 00:10:55 +08:00
|
|
|
imports.Proc(def.CefPostDataRef_Create).Call(uintptr(unsafe.Pointer(&result)))
|
2023-02-27 11:33:00 +08:00
|
|
|
return &ICefPostData{instance: unsafe.Pointer(result)}
|
|
|
|
}
|
|
|
|
|
2023-03-04 11:58:35 +08:00
|
|
|
func (m *postData) UnWrap(data *ICefPostData) *ICefPostData {
|
|
|
|
var result uintptr
|
2023-06-11 00:10:55 +08:00
|
|
|
imports.Proc(def.CefPostDataRef_UnWrap).Call(data.Instance(), uintptr(unsafe.Pointer(&result)))
|
2023-03-04 11:58:35 +08:00
|
|
|
data.instance = unsafe.Pointer(result)
|
|
|
|
return data
|
|
|
|
}
|
|
|
|
|
2023-02-26 23:21:44 +08:00
|
|
|
// Instance 实例
|
|
|
|
func (m *ICefPostData) Instance() uintptr {
|
|
|
|
if m == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
return uintptr(m.instance)
|
|
|
|
}
|
2023-02-27 11:33:00 +08:00
|
|
|
|
|
|
|
func (m *ICefPostData) IsValid() bool {
|
|
|
|
if m == nil || m.instance == nil {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *ICefPostData) IsReadOnly() bool {
|
|
|
|
if !m.IsValid() {
|
|
|
|
return false
|
|
|
|
}
|
2023-06-11 00:10:55 +08:00
|
|
|
r1, _, _ := imports.Proc(def.CefPostData_IsReadOnly).Call(m.Instance())
|
2023-02-27 11:33:00 +08:00
|
|
|
return api.GoBool(r1)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *ICefPostData) HasExcludedElements() bool {
|
|
|
|
if !m.IsValid() {
|
|
|
|
return false
|
|
|
|
}
|
2023-06-11 00:10:55 +08:00
|
|
|
r1, _, _ := imports.Proc(def.CefPostData_HasExcludedElements).Call(m.Instance())
|
2023-02-27 11:33:00 +08:00
|
|
|
return api.GoBool(r1)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *ICefPostData) GetElementCount() uint32 {
|
|
|
|
if !m.IsValid() {
|
|
|
|
return 0
|
|
|
|
}
|
2023-06-11 00:10:55 +08:00
|
|
|
r1, _, _ := imports.Proc(def.CefPostData_GetElementCount).Call(m.Instance())
|
2023-02-27 11:33:00 +08:00
|
|
|
return uint32(r1)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *ICefPostData) GetElements() *TCefPostDataElementArray {
|
|
|
|
if !m.IsValid() {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
var elementsCount = m.GetElementCount()
|
|
|
|
if elementsCount <= 0 {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
var result uintptr
|
2023-06-11 00:10:55 +08:00
|
|
|
imports.Proc(def.CefPostData_GetElements).Call(m.Instance(), uintptr(elementsCount), uintptr(unsafe.Pointer(&result)))
|
2023-02-27 11:33:00 +08:00
|
|
|
return &TCefPostDataElementArray{instance: unsafe.Pointer(result), postDataElement: result, postDataElementLength: elementsCount}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *ICefPostData) RemoveElement(postDataElement *ICefPostDataElement) bool {
|
|
|
|
if !m.IsValid() {
|
|
|
|
return false
|
|
|
|
}
|
2023-06-11 00:10:55 +08:00
|
|
|
r1, _, _ := imports.Proc(def.CefPostData_RemoveElement).Call(m.Instance(), postDataElement.Instance())
|
2023-02-27 11:33:00 +08:00
|
|
|
return api.GoBool(r1)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *ICefPostData) AddElement(postDataElement *ICefPostDataElement) bool {
|
|
|
|
if !m.IsValid() {
|
|
|
|
return false
|
|
|
|
}
|
2023-06-11 00:10:55 +08:00
|
|
|
r1, _, _ := imports.Proc(def.CefPostData_AddElement).Call(m.Instance(), postDataElement.Instance())
|
2023-02-27 11:33:00 +08:00
|
|
|
return api.GoBool(r1)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *ICefPostData) RemoveElements() {
|
|
|
|
if !m.IsValid() {
|
|
|
|
return
|
|
|
|
}
|
2023-06-11 00:10:55 +08:00
|
|
|
imports.Proc(def.CefPostData_RemoveElements).Call(m.Instance())
|
2023-02-27 11:33:00 +08:00
|
|
|
}
|