mirror of
https://gitee.com/energye/energy.git
synced 2024-12-03 12:17:44 +08:00
A: displayRef proc api
This commit is contained in:
parent
f05d3df398
commit
12acb7e1b0
@ -1206,6 +1206,16 @@ const (
|
||||
CEFBrowserViewComponent_SetOnPopupBrowserViewCreated
|
||||
CEFBrowserViewComponent_SetOnGetChromeToolbarType
|
||||
// ICefDisplay
|
||||
CEFDisplayRef_Primary
|
||||
CEFDisplayRef_NearestPoint
|
||||
CEFDisplayRef_MatchingBounds
|
||||
CEFDisplayRef_GetCount
|
||||
CEFDisplayRef_GetAlls
|
||||
CEFDisplayRef_Get
|
||||
CEFDisplayRef_ScreenPointToPixels
|
||||
CEFDisplayRef_ScreenPointFromPixels
|
||||
CEFDisplayRef_ScreenRectToPixels
|
||||
CEFDisplayRef_ScreenRectFromPixels
|
||||
CEFDisplay_ID
|
||||
CEFDisplay_DeviceScaleFactor
|
||||
CEFDisplay_Rotation
|
||||
|
@ -1206,6 +1206,16 @@ func init() {
|
||||
dllimports.NewEnergyImport("CEFBrowserViewComponent_SetOnPopupBrowserViewCreated", 0),
|
||||
dllimports.NewEnergyImport("CEFBrowserViewComponent_SetOnGetChromeToolbarType", 0),
|
||||
//ICefDisplay
|
||||
dllimports.NewEnergyImport("CEFDisplayRef_Primary", 0),
|
||||
dllimports.NewEnergyImport("CEFDisplayRef_NearestPoint", 0),
|
||||
dllimports.NewEnergyImport("CEFDisplayRef_MatchingBounds", 0),
|
||||
dllimports.NewEnergyImport("CEFDisplayRef_GetCount", 0),
|
||||
dllimports.NewEnergyImport("CEFDisplayRef_GetAlls", 0),
|
||||
dllimports.NewEnergyImport("CEFDisplayRef_Get", 0),
|
||||
dllimports.NewEnergyImport("CEFDisplayRef_ScreenPointToPixels", 0),
|
||||
dllimports.NewEnergyImport("CEFDisplayRef_ScreenPointFromPixels", 0),
|
||||
dllimports.NewEnergyImport("CEFDisplayRef_ScreenRectToPixels", 0),
|
||||
dllimports.NewEnergyImport("CEFDisplayRef_ScreenRectFromPixels", 0),
|
||||
dllimports.NewEnergyImport("CEFDisplay_ID", 0),
|
||||
dllimports.NewEnergyImport("CEFDisplay_DeviceScaleFactor", 0),
|
||||
dllimports.NewEnergyImport("CEFDisplay_Rotation", 0),
|
||||
|
@ -13,9 +13,77 @@ package cef
|
||||
import (
|
||||
"github.com/energye/energy/v2/cef/internal/def"
|
||||
"github.com/energye/energy/v2/common/imports"
|
||||
"github.com/energye/golcl/lcl/api"
|
||||
"github.com/energye/golcl/lcl/types"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// DisplayRef -> ICefDisplay
|
||||
var DisplayRef display
|
||||
|
||||
type display uintptr
|
||||
|
||||
func (m *display) Primary() *ICefDisplay {
|
||||
var result uintptr
|
||||
imports.Proc(def.CEFDisplayRef_Primary).Call(uintptr(unsafe.Pointer(&result)))
|
||||
if result != 0 {
|
||||
return &ICefDisplay{instance: getInstance(result)}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *display) NearestPoint(point *TCefPoint, inputPixelCoords bool) *ICefDisplay {
|
||||
var result uintptr
|
||||
imports.Proc(def.CEFDisplayRef_NearestPoint).Call(uintptr(unsafe.Pointer(point)), api.PascalBool(inputPixelCoords), uintptr(unsafe.Pointer(&result)))
|
||||
if result != 0 {
|
||||
return &ICefDisplay{instance: getInstance(result)}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *display) MatchingBounds(point *TCefRect, inputPixelCoords bool) *ICefDisplay {
|
||||
var result uintptr
|
||||
imports.Proc(def.CEFDisplayRef_MatchingBounds).Call(uintptr(unsafe.Pointer(point)), api.PascalBool(inputPixelCoords), uintptr(unsafe.Pointer(&result)))
|
||||
if result != 0 {
|
||||
return &ICefDisplay{instance: getInstance(result)}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *display) GetCount() uint32 {
|
||||
r1, _, _ := imports.Proc(def.CEFDisplayRef_GetCount).Call()
|
||||
return uint32(r1)
|
||||
}
|
||||
|
||||
func (m *display) GetAlls() *ICefDisplayArray {
|
||||
var result uintptr
|
||||
r1, _, _ := imports.Proc(def.CEFDisplayRef_GetAlls).Call(uintptr(unsafe.Pointer(&result)))
|
||||
if r1 != 0 && result != 0 {
|
||||
return &ICefDisplayArray{instance: getInstance(result), count: m.GetCount()}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *display) ScreenPointToPixels(screenPoint *types.TPoint) (point types.TPoint) {
|
||||
imports.Proc(def.CEFDisplayRef_ScreenPointToPixels).Call(uintptr(unsafe.Pointer(screenPoint)), uintptr(unsafe.Pointer(&point)))
|
||||
return
|
||||
}
|
||||
|
||||
func (m *display) ScreenPointFromPixels(pixelsPoint *types.TPoint) (point types.TPoint) {
|
||||
imports.Proc(def.CEFDisplayRef_ScreenPointFromPixels).Call(uintptr(unsafe.Pointer(pixelsPoint)), uintptr(unsafe.Pointer(&point)))
|
||||
return
|
||||
}
|
||||
|
||||
func (m *display) ScreenRectToPixels(screenRect *types.TRect) (rect types.TRect) {
|
||||
imports.Proc(def.CEFDisplayRef_ScreenRectToPixels).Call(uintptr(unsafe.Pointer(screenRect)), uintptr(unsafe.Pointer(&rect)))
|
||||
return
|
||||
}
|
||||
|
||||
func (m *display) ScreenRectFromPixels(pixelsRect *types.TRect) (rect types.TRect) {
|
||||
imports.Proc(def.CEFDisplayRef_ScreenRectFromPixels).Call(uintptr(unsafe.Pointer(pixelsRect)), uintptr(unsafe.Pointer(&rect)))
|
||||
return
|
||||
}
|
||||
|
||||
func (m *ICefDisplay) ID() (result int64) {
|
||||
if !m.IsValid() {
|
||||
return 0
|
||||
@ -74,3 +142,41 @@ func (m *ICefDisplay) IsValid() bool {
|
||||
}
|
||||
return m.instance != nil
|
||||
}
|
||||
|
||||
func (m *ICefDisplayArray) Instance() uintptr {
|
||||
return uintptr(m.instance)
|
||||
}
|
||||
|
||||
func (m *ICefDisplayArray) Free() {
|
||||
if m.instance != nil {
|
||||
m.instance = nil
|
||||
}
|
||||
}
|
||||
|
||||
func (m *ICefDisplayArray) IsValid() bool {
|
||||
if m == nil || m.instance == nil {
|
||||
return false
|
||||
}
|
||||
return m.instance != nil
|
||||
}
|
||||
|
||||
func (m *ICefDisplayArray) Get(index uint32) *ICefDisplay {
|
||||
if !m.IsValid() {
|
||||
return nil
|
||||
}
|
||||
if index < m.count {
|
||||
var result uintptr
|
||||
r1, _, _ := imports.Proc(def.CEFDisplayRef_Get).Call(m.Instance(), uintptr(index), uintptr(unsafe.Pointer(&result)))
|
||||
if r1 != 0 && result != 0 {
|
||||
return &ICefDisplay{instance: getInstance(result)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ICefDisplayArray) Count() uint32 {
|
||||
if !m.IsValid() {
|
||||
return 0
|
||||
}
|
||||
return m.count
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ func (m *ICefX509Certificate) GetDEREncodedIssuerChain(chainCount uint32) *TCefB
|
||||
return nil
|
||||
}
|
||||
var result uintptr
|
||||
imports.Proc(def.CefX509Certificate_GetDEREncodedIssuerChain).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
|
||||
imports.Proc(def.CefX509Certificate_GetDEREncodedIssuerChain).Call(m.Instance(), uintptr(chainCount), uintptr(unsafe.Pointer(&result)))
|
||||
if result != 0 {
|
||||
return &TCefBinaryValueArray{count: chainCount, instance: unsafe.Pointer(result)}
|
||||
}
|
||||
@ -170,7 +170,7 @@ func (m *ICefX509Certificate) GetPEMEncodedIssuerChain(chainCount uint32) *TCefB
|
||||
return nil
|
||||
}
|
||||
var result uintptr
|
||||
imports.Proc(def.CefX509Certificate_GetPEMEncodedIssuerChain).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
|
||||
imports.Proc(def.CefX509Certificate_GetPEMEncodedIssuerChain).Call(m.Instance(), uintptr(chainCount), uintptr(unsafe.Pointer(&result)))
|
||||
if result != 0 {
|
||||
return &TCefBinaryValueArray{count: chainCount, instance: unsafe.Pointer(result)}
|
||||
}
|
||||
|
@ -345,6 +345,14 @@ type ICefDictionaryValue struct {
|
||||
listValues map[string]*ICefListValue
|
||||
}
|
||||
|
||||
// ICefDisplayArray
|
||||
// []ICefDisplayArray
|
||||
type ICefDisplayArray struct {
|
||||
instance unsafe.Pointer
|
||||
binaryValues []*ICefDisplayArray
|
||||
count uint32
|
||||
}
|
||||
|
||||
// ICefDisplay
|
||||
type ICefDisplay struct {
|
||||
base TCefBaseRefCounted
|
||||
|
Loading…
Reference in New Issue
Block a user