energy/cef/types-extension.go

180 lines
4.0 KiB
Go
Raw Normal View History

2023-05-31 17:41:14 +08:00
//----------------------------------------
//
// 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"
2023-05-31 18:00:34 +08:00
"github.com/energye/energy/v2/common/imports"
2023-05-31 17:41:14 +08:00
"github.com/energye/golcl/lcl/api"
"unsafe"
)
// Instance 实例
func (m *ICefExtension) Instance() uintptr {
if m == nil {
return 0
}
return uintptr(m.instance)
}
func (m *ICefExtension) Free() {
if m.instance != nil {
m.base.Free(m.Instance())
m.instance = nil
}
}
func (m *ICefExtension) IsValid() bool {
if m == nil || m.instance == nil {
return false
}
return m.instance != nil
}
func (m *ICefExtension) GetIdentifier() string {
if !m.IsValid() {
return ""
}
r1, _, _ := imports.Proc(def.CefExtension_GetIdentifier).Call(m.Instance())
2023-05-31 17:41:14 +08:00
return api.GoStr(r1)
}
func (m *ICefExtension) GetPath() string {
if !m.IsValid() {
return ""
}
r1, _, _ := imports.Proc(def.CefExtension_GetPath).Call(m.Instance())
2023-05-31 17:41:14 +08:00
return api.GoStr(r1)
}
func (m *ICefExtension) GetManifest() *ICefDictionaryValue {
if !m.IsValid() {
return nil
}
var result uintptr
imports.Proc(def.CefExtension_GetManifest).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
2023-05-31 17:41:14 +08:00
if result != 0 {
return &ICefDictionaryValue{instance: unsafe.Pointer(result)}
}
return nil
}
func (m *ICefExtension) IsSame(that *ICefExtension) bool {
if !m.IsValid() || !that.IsValid() {
return false
}
r1, _, _ := imports.Proc(def.CefExtension_IsSame).Call(m.Instance(), that.Instance())
2023-05-31 17:41:14 +08:00
return api.GoBool(r1)
}
func (m *ICefExtension) GetHandler() *ICefExtensionHandler {
if !m.IsValid() {
return nil
}
var result uintptr
imports.Proc(def.CefExtension_GetHandler).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
2023-05-31 17:41:14 +08:00
if result != 0 {
return &ICefExtensionHandler{instance: unsafe.Pointer(result)}
}
return nil
}
func (m *ICefExtension) GetLoaderContext() *ICefRequestContext {
if !m.IsValid() {
return nil
}
var result uintptr
imports.Proc(def.CefExtension_GetLoaderContext).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
2023-05-31 17:41:14 +08:00
if result != 0 {
return &ICefRequestContext{instance: unsafe.Pointer(result)}
}
return nil
}
func (m *ICefExtension) IsLoaded() bool {
if !m.IsValid() {
return false
}
r1, _, _ := imports.Proc(def.CefExtension_IsLoaded).Call(m.Instance())
2023-05-31 17:41:14 +08:00
return api.GoBool(r1)
}
func (m *ICefExtension) unload() {
if !m.IsValid() {
return
}
imports.Proc(def.CefExtension_unload).Call(m.Instance())
2023-05-31 17:41:14 +08:00
}
func (m *ICefExtension) GetBrowserActionPopup() string {
if !m.IsValid() {
return ""
}
r1, _, _ := imports.Proc(def.CefExtension_GetBrowserActionPopup).Call(m.Instance())
2023-05-31 17:41:14 +08:00
return api.GoStr(r1)
}
func (m *ICefExtension) GetBrowserActionIcon() string {
if !m.IsValid() {
return ""
}
r1, _, _ := imports.Proc(def.CefExtension_GetBrowserActionIcon).Call(m.Instance())
2023-05-31 17:41:14 +08:00
return api.GoStr(r1)
}
func (m *ICefExtension) GetPageActionPopup() string {
if !m.IsValid() {
return ""
}
r1, _, _ := imports.Proc(def.CefExtension_GetPageActionPopup).Call(m.Instance())
2023-05-31 17:41:14 +08:00
return api.GoStr(r1)
}
func (m *ICefExtension) GetPageActionIcon() string {
if !m.IsValid() {
return ""
}
r1, _, _ := imports.Proc(def.CefExtension_GetPageActionIcon).Call(m.Instance())
2023-05-31 17:41:14 +08:00
return api.GoStr(r1)
}
func (m *ICefExtension) GetOptionsPage() string {
if !m.IsValid() {
return ""
}
r1, _, _ := imports.Proc(def.CefExtension_GetOptionsPage).Call(m.Instance())
2023-05-31 17:41:14 +08:00
return api.GoStr(r1)
}
func (m *ICefExtension) GetOptionsUIPage() string {
if !m.IsValid() {
return ""
}
r1, _, _ := imports.Proc(def.CefExtension_GetOptionsUIPage).Call(m.Instance())
2023-05-31 17:41:14 +08:00
return api.GoStr(r1)
}
func (m *ICefExtension) GetBackgroundPage() string {
if !m.IsValid() {
return ""
}
r1, _, _ := imports.Proc(def.CefExtension_GetBackgroundPage).Call(m.Instance())
2023-05-31 17:41:14 +08:00
return api.GoStr(r1)
}
func (m *ICefExtension) GetURL() string {
if !m.IsValid() {
return ""
}
r1, _, _ := imports.Proc(def.CefExtension_GetURL).Call(m.Instance())
2023-05-31 17:41:14 +08:00
return api.GoStr(r1)
}