A: TCEFViewComponent Proc

This commit is contained in:
杨红岩 2023-07-03 12:09:25 +08:00
parent 7eb11561b8
commit eb1eb32459
9 changed files with 595 additions and 0 deletions

View File

@ -27,6 +27,9 @@ type browserView uintptr
func (*browserView) New(client *ICefClient, url string, browserSettings *TCefBrowserSettings, extraInfo *ICefDictionaryValue, requestContext *ICefRequestContext, delegate *ICefBrowserViewDelegate) *ICefBrowserView {
var browserSettingsPtr = browserSettings.ToPtr()
var result uintptr
if extraInfo == nil {
extraInfo = DictionaryValueRef.New()
}
imports.Proc(def.CefBrowserViewRef_Create).Call(client.Instance(), api.PascalStr(url), uintptr(unsafe.Pointer(&browserSettingsPtr)), extraInfo.Instance(), requestContext.Instance(), delegate.Instance(), uintptr(unsafe.Pointer(&result)))
if result != 0 {
return &ICefBrowserView{&ICefView{instance: unsafe.Pointer(result)}}

View File

@ -2321,4 +2321,57 @@ const (
View_ConvertPointFromWindow
View_ConvertPointToView
View_ConvertPointFromView
// TCEFViewComponent
ViewComponent_Create
ViewComponent_Free
ViewComponent_ToStringEx
ViewComponent_IsSame
ViewComponent_SizeToPreferredSize
ViewComponent_InvalidateLayout
ViewComponent_RequestFocus
ViewComponent_ConvertPointToScreen
ViewComponent_ConvertPointFromScreen
ViewComponent_ConvertPointToWindow
ViewComponent_ConvertPointFromWindow
ViewComponent_ConvertPointToView
ViewComponent_ConvertPointFromView
ViewComponent_GetInitialized
ViewComponent_GetAsView
ViewComponent_GetAsBrowserView
ViewComponent_GetAsButton
ViewComponent_GetAsPanel
ViewComponent_GetAsScrollView
ViewComponent_GetAsTextfield
ViewComponent_GetViewForID
ViewComponent_GetValid
ViewComponent_GetAttached
ViewComponent_GetDelegate
ViewComponent_GetWindow
ViewComponent_GetParentView
ViewComponent_GetBoundsInScreen
ViewComponent_GetPreferredSize
ViewComponent_GetMinimumSize
ViewComponent_GetMaximumSize
ViewComponent_GetVisible
ViewComponent_SetVisible
ViewComponent_GetDrawn
ViewComponent_GetEnabled
ViewComponent_SetEnabled
ViewComponent_GetFocusable
ViewComponent_SetFocusable
ViewComponent_GetAccessibilityFocusable
ViewComponent_GetBackgroundColor
ViewComponent_SetBackgroundColor
ViewComponent_GetID
ViewComponent_SetID
ViewComponent_GetGroupID
ViewComponent_SetGroupID
ViewComponent_GetBounds
ViewComponent_SetBounds
ViewComponent_GetSize
ViewComponent_SetSize
ViewComponent_GetPosition
ViewComponent_SetPosition
ViewComponent_GetTypeString
ViewComponent_GetHeightForWidth
) //end

View File

@ -2321,6 +2321,59 @@ func init() {
dllimports.NewEnergyImport("View_ConvertPointFromWindow", 0),
dllimports.NewEnergyImport("View_ConvertPointToView", 0),
dllimports.NewEnergyImport("View_ConvertPointFromView", 0),
// TCEFViewComponent
dllimports.NewEnergyImport("ViewComponent_Create", 0),
dllimports.NewEnergyImport("ViewComponent_Free", 0),
dllimports.NewEnergyImport("ViewComponent_ToStringEx", 0),
dllimports.NewEnergyImport("ViewComponent_IsSame", 0),
dllimports.NewEnergyImport("ViewComponent_SizeToPreferredSize", 0),
dllimports.NewEnergyImport("ViewComponent_InvalidateLayout", 0),
dllimports.NewEnergyImport("ViewComponent_RequestFocus", 0),
dllimports.NewEnergyImport("ViewComponent_ConvertPointToScreen", 0),
dllimports.NewEnergyImport("ViewComponent_ConvertPointFromScreen", 0),
dllimports.NewEnergyImport("ViewComponent_ConvertPointToWindow", 0),
dllimports.NewEnergyImport("ViewComponent_ConvertPointFromWindow", 0),
dllimports.NewEnergyImport("ViewComponent_ConvertPointToView", 0),
dllimports.NewEnergyImport("ViewComponent_ConvertPointFromView", 0),
dllimports.NewEnergyImport("ViewComponent_GetInitialized", 0),
dllimports.NewEnergyImport("ViewComponent_GetAsView", 0),
dllimports.NewEnergyImport("ViewComponent_GetAsBrowserView", 0),
dllimports.NewEnergyImport("ViewComponent_GetAsButton", 0),
dllimports.NewEnergyImport("ViewComponent_GetAsPanel", 0),
dllimports.NewEnergyImport("ViewComponent_GetAsScrollView", 0),
dllimports.NewEnergyImport("ViewComponent_GetAsTextfield", 0),
dllimports.NewEnergyImport("ViewComponent_GetViewForID", 0),
dllimports.NewEnergyImport("ViewComponent_GetValid", 0),
dllimports.NewEnergyImport("ViewComponent_GetAttached", 0),
dllimports.NewEnergyImport("ViewComponent_GetDelegate", 0),
dllimports.NewEnergyImport("ViewComponent_GetWindow", 0),
dllimports.NewEnergyImport("ViewComponent_GetParentView", 0),
dllimports.NewEnergyImport("ViewComponent_GetBoundsInScreen", 0),
dllimports.NewEnergyImport("ViewComponent_GetPreferredSize", 0),
dllimports.NewEnergyImport("ViewComponent_GetMinimumSize", 0),
dllimports.NewEnergyImport("ViewComponent_GetMaximumSize", 0),
dllimports.NewEnergyImport("ViewComponent_GetVisible", 0),
dllimports.NewEnergyImport("ViewComponent_SetVisible", 0),
dllimports.NewEnergyImport("ViewComponent_GetDrawn", 0),
dllimports.NewEnergyImport("ViewComponent_GetEnabled", 0),
dllimports.NewEnergyImport("ViewComponent_SetEnabled", 0),
dllimports.NewEnergyImport("ViewComponent_GetFocusable", 0),
dllimports.NewEnergyImport("ViewComponent_SetFocusable", 0),
dllimports.NewEnergyImport("ViewComponent_GetAccessibilityFocusable", 0),
dllimports.NewEnergyImport("ViewComponent_GetBackgroundColor", 0),
dllimports.NewEnergyImport("ViewComponent_SetBackgroundColor", 0),
dllimports.NewEnergyImport("ViewComponent_GetID", 0),
dllimports.NewEnergyImport("ViewComponent_SetID", 0),
dllimports.NewEnergyImport("ViewComponent_GetGroupID", 0),
dllimports.NewEnergyImport("ViewComponent_SetGroupID", 0),
dllimports.NewEnergyImport("ViewComponent_GetBounds", 0),
dllimports.NewEnergyImport("ViewComponent_SetBounds", 0),
dllimports.NewEnergyImport("ViewComponent_GetSize", 0),
dllimports.NewEnergyImport("ViewComponent_SetSize", 0),
dllimports.NewEnergyImport("ViewComponent_GetPosition", 0),
dllimports.NewEnergyImport("ViewComponent_SetPosition", 0),
dllimports.NewEnergyImport("ViewComponent_GetTypeString", 0),
dllimports.NewEnergyImport("ViewComponent_GetHeightForWidth", 0),
} //end
imports.SetEnergyImportDefs(energyImportDefs)
}

11
cef/types-button.go Normal file
View File

@ -0,0 +1,11 @@
//----------------------------------------
//
// Copyright © yanghy. All Rights Reserved.
//
// Licensed under Apache License Version 2.0, January 2004
//
// https//www.apache.org/licenses/LICENSE-2.0
//
//----------------------------------------
package cef

11
cef/types-panel.go Normal file
View File

@ -0,0 +1,11 @@
//----------------------------------------
//
// Copyright © yanghy. All Rights Reserved.
//
// Licensed under Apache License Version 2.0, January 2004
//
// https//www.apache.org/licenses/LICENSE-2.0
//
//----------------------------------------
package cef

11
cef/types-scrollview.go Normal file
View File

@ -0,0 +1,11 @@
//----------------------------------------
//
// Copyright © yanghy. All Rights Reserved.
//
// Licensed under Apache License Version 2.0, January 2004
//
// https//www.apache.org/licenses/LICENSE-2.0
//
//----------------------------------------
package cef

11
cef/types-textfield.go Normal file
View File

@ -0,0 +1,11 @@
//----------------------------------------
//
// Copyright © yanghy. All Rights Reserved.
//
// Licensed under Apache License Version 2.0, January 2004
//
// https//www.apache.org/licenses/LICENSE-2.0
//
//----------------------------------------
package cef

437
cef/types-viewcomponent.go Normal file
View File

@ -0,0 +1,437 @@
//----------------------------------------
//
// Copyright © yanghy. All Rights Reserved.
//
// Licensed under Apache License Version 2.0, January 2004
//
// https//www.apache.org/licenses/LICENSE-2.0
//
//----------------------------------------
package cef
import (
"github.com/energye/energy/v2/cef/internal/def"
"github.com/energye/energy/v2/common/imports"
"github.com/energye/energy/v2/types"
"github.com/energye/golcl/lcl"
"github.com/energye/golcl/lcl/api"
"unsafe"
)
// ViewComponentRef -> TCEFViewComponent
var ViewComponentRef viewComponent
type viewComponent uintptr
func (*viewComponent) New(AOwner lcl.IComponent) *TCEFViewComponent {
var result uintptr
imports.Proc(def.ViewComponent_Create).Call(AOwner.Instance(), uintptr(unsafe.Pointer(&result)))
if result != 0 {
return &TCEFViewComponent{instance: getInstance(result)}
}
return nil
}
// Instance 实例
func (m *TCEFViewComponent) Instance() uintptr {
if m == nil {
return 0
}
return uintptr(m.instance)
}
func (m *TCEFViewComponent) Free() {
if m.instance != nil {
imports.Proc(def.ViewComponent_Free).Call(m.Instance())
m.instance = nil
}
}
func (m *TCEFViewComponent) IsValid() bool {
if m == nil || m.instance == nil {
return false
}
r1, _, _ := imports.Proc(def.ViewComponent_GetValid).Call(m.Instance())
return api.GoBool(r1)
}
func (m *TCEFViewComponent) ToStringEx(includeChildren bool) string {
if !m.IsValid() {
return ""
}
r1, _, _ := imports.Proc(def.ViewComponent_ToStringEx).Call(m.Instance(), api.PascalBool(includeChildren))
return api.GoStr(r1)
}
func (m *TCEFViewComponent) IsSame(that *ICefView) bool {
if !m.IsValid() {
return false
}
r1, _, _ := imports.Proc(def.ViewComponent_IsSame).Call(m.Instance(), that.Instance())
return api.GoBool(r1)
}
func (m *TCEFViewComponent) SizeToPreferredSize() {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_SizeToPreferredSize).Call(m.Instance())
}
func (m *TCEFViewComponent) InvalidateLayout() {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_InvalidateLayout).Call(m.Instance())
}
func (m *TCEFViewComponent) RequestFocus() {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_RequestFocus).Call(m.Instance())
}
func (m *TCEFViewComponent) ConvertPointToScreen(point *TCefPoint) bool {
if !m.IsValid() {
return false
}
r1, _, _ := imports.Proc(def.ViewComponent_ConvertPointToScreen).Call(m.Instance(), uintptr(unsafe.Pointer(point)))
return api.GoBool(r1)
}
func (m *TCEFViewComponent) ConvertPointFromScreen(point *TCefPoint) bool {
if !m.IsValid() {
return false
}
r1, _, _ := imports.Proc(def.ViewComponent_ConvertPointFromScreen).Call(m.Instance(), uintptr(unsafe.Pointer(point)))
return api.GoBool(r1)
}
func (m *TCEFViewComponent) ConvertPointToWindow(point *TCefPoint) bool {
if !m.IsValid() {
return false
}
r1, _, _ := imports.Proc(def.ViewComponent_ConvertPointToWindow).Call(m.Instance(), uintptr(unsafe.Pointer(point)))
return api.GoBool(r1)
}
func (m *TCEFViewComponent) ConvertPointFromWindow(point *TCefPoint) bool {
if !m.IsValid() {
return false
}
r1, _, _ := imports.Proc(def.ViewComponent_ConvertPointFromWindow).Call(m.Instance(), uintptr(unsafe.Pointer(point)))
return api.GoBool(r1)
}
func (m *TCEFViewComponent) ConvertPointToView(view *ICefView, point *TCefPoint) bool {
if !m.IsValid() {
return false
}
r1, _, _ := imports.Proc(def.ViewComponent_ConvertPointToView).Call(m.Instance(), view.Instance(), uintptr(unsafe.Pointer(point)))
return api.GoBool(r1)
}
func (m *TCEFViewComponent) ConvertPointFromView(view *ICefView, point *TCefPoint) bool {
if !m.IsValid() {
return false
}
r1, _, _ := imports.Proc(def.ViewComponent_ConvertPointFromView).Call(m.Instance(), view.Instance(), uintptr(unsafe.Pointer(point)))
return api.GoBool(r1)
}
func (m *TCEFViewComponent) GetInitialized() bool {
if !m.IsValid() {
return false
}
r1, _, _ := imports.Proc(def.ViewComponent_GetInitialized).Call(m.Instance())
return api.GoBool(r1)
}
func (m *TCEFViewComponent) GetAsView() (result ICefView) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_GetAsView).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
return
}
func (m *TCEFViewComponent) GetAsBrowserView() (result ICefBrowserView) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_GetAsBrowserView).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
return
}
func (m *TCEFViewComponent) GetAsButton() (result ICefButton) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_GetAsButton).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
return
}
func (m *TCEFViewComponent) GetAsPanel() (result ICefPanel) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_GetAsPanel).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
return
}
func (m *TCEFViewComponent) GetAsScrollView() (result ICefScrollView) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_GetAsScrollView).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
return
}
func (m *TCEFViewComponent) GetAsTextfield() (result ICefTextfield) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_GetAsTextfield).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
return
}
func (m *TCEFViewComponent) GetViewForID(id int32) (result ICefView) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_GetViewForID).Call(m.Instance(), uintptr(id), uintptr(unsafe.Pointer(&result)))
return
}
func (m *TCEFViewComponent) GetAttached() bool {
if !m.IsValid() {
return false
}
r1, _, _ := imports.Proc(def.ViewComponent_GetAttached).Call(m.Instance())
return api.GoBool(r1)
}
func (m *TCEFViewComponent) GetDelegate() (result ICefViewDelegate) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_GetDelegate).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
return
}
func (m *TCEFViewComponent) GetWindow() (result ICefWindow) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_GetWindow).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
return
}
func (m *TCEFViewComponent) GetParentView() (result ICefView) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_GetParentView).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
return
}
func (m *TCEFViewComponent) GetBoundsInScreen() (result TCefRect) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_GetBoundsInScreen).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
return
}
func (m *TCEFViewComponent) GetPreferredSize() (result TCefSize) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_GetPreferredSize).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
return
}
func (m *TCEFViewComponent) GetMinimumSize() (result TCefSize) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_GetMinimumSize).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
return
}
func (m *TCEFViewComponent) GetMaximumSize() (result TCefSize) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_GetMaximumSize).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
return
}
func (m *TCEFViewComponent) GetVisible() bool {
if !m.IsValid() {
return false
}
r1, _, _ := imports.Proc(def.ViewComponent_GetVisible).Call(m.Instance())
return api.GoBool(r1)
}
func (m *TCEFViewComponent) SetVisible(visible bool) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_SetVisible).Call(m.Instance(), api.PascalBool(visible))
}
func (m *TCEFViewComponent) GetDrawn() bool {
if !m.IsValid() {
return false
}
r1, _, _ := imports.Proc(def.ViewComponent_GetDrawn).Call(m.Instance())
return api.GoBool(r1)
}
func (m *TCEFViewComponent) GetEnabled() bool {
if !m.IsValid() {
return false
}
r1, _, _ := imports.Proc(def.ViewComponent_GetEnabled).Call(m.Instance())
return api.GoBool(r1)
}
func (m *TCEFViewComponent) SetEnabled(enabled bool) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_SetEnabled).Call(m.Instance(), api.PascalBool(enabled))
}
func (m *TCEFViewComponent) GetFocusable() bool {
if !m.IsValid() {
return false
}
r1, _, _ := imports.Proc(def.ViewComponent_GetFocusable).Call(m.Instance())
return api.GoBool(r1)
}
func (m *TCEFViewComponent) SetFocusable(focusable bool) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_SetFocusable).Call(m.Instance(), api.PascalBool(focusable))
}
func (m *TCEFViewComponent) GetAccessibilityFocusable() bool {
if !m.IsValid() {
return false
}
r1, _, _ := imports.Proc(def.ViewComponent_GetAccessibilityFocusable).Call(m.Instance())
return api.GoBool(r1)
}
func (m *TCEFViewComponent) GetBackgroundColor() (result types.TCefColor) {
if !m.IsValid() {
return 0
}
imports.Proc(def.ViewComponent_GetBackgroundColor).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
return
}
func (m *TCEFViewComponent) SetBackgroundColor(color types.TCefColor) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_SetBackgroundColor).Call(m.Instance(), uintptr(color))
}
func (m *TCEFViewComponent) GetID() int32 {
if !m.IsValid() {
return 0
}
r1, _, _ := imports.Proc(def.ViewComponent_GetID).Call(m.Instance())
return int32(r1)
}
func (m *TCEFViewComponent) SetID(id int32) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_SetID).Call(m.Instance(), uintptr(id))
}
func (m *TCEFViewComponent) GetGroupID() int32 {
if !m.IsValid() {
return 0
}
r1, _, _ := imports.Proc(def.ViewComponent_GetGroupID).Call(m.Instance())
return int32(r1)
}
func (m *TCEFViewComponent) SetGroupID(groupId int32) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_SetGroupID).Call(m.Instance(), uintptr(groupId))
}
func (m *TCEFViewComponent) GetBounds() (result TCefRect) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_GetBounds).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
return
}
func (m *TCEFViewComponent) SetBounds(bounds TCefRect) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_SetBounds).Call(m.Instance(), uintptr(unsafe.Pointer(&bounds)))
}
func (m *TCEFViewComponent) GetSize() (result TCefSize) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_GetSize).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
return
}
func (m *TCEFViewComponent) SetSize(size TCefSize) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_SetSize).Call(m.Instance(), uintptr(unsafe.Pointer(&size)))
}
func (m *TCEFViewComponent) GetPosition() (result TCefPoint) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_GetPosition).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
return
}
func (m *TCEFViewComponent) SetPosition(position TCefPoint) {
if !m.IsValid() {
return
}
imports.Proc(def.ViewComponent_SetPosition).Call(m.Instance(), uintptr(unsafe.Pointer(&position)))
}
func (m *TCEFViewComponent) GetTypeString() string {
if !m.IsValid() {
return ""
}
r1, _, _ := imports.Proc(def.ViewComponent_GetTypeString).Call(m.Instance())
return api.GoStr(r1)
}
func (m *TCEFViewComponent) GetHeightForWidth(width int32) int32 {
if !m.IsValid() {
return 0
}
r1, _, _ := imports.Proc(def.ViewComponent_GetHeightForWidth).Call(m.Instance(), uintptr(width))
return int32(r1)
}

View File

@ -518,6 +518,11 @@ type ICefViewDelegate struct {
instance unsafe.Pointer
}
// TCEFViewComponent
type TCEFViewComponent struct {
instance unsafe.Pointer
}
// TCefX509CertificateArray
// []ICefX509Certificate
type TCefX509CertificateArray struct {