energy/cef/types-display.go

76 lines
1.6 KiB
Go
Raw Normal View History

2023-02-20 14:42:17 +08:00
// ----------------------------------------
//
// Copyright © yanghy. All Rights Reserved.
//
2023-02-20 14:42:17 +08:00
// # Licensed under Apache License Version 2.0, January 2004
//
// https://www.apache.org/licenses/LICENSE-2.0
//
2023-02-20 14:42:17 +08:00
// ----------------------------------------
2022-12-29 18:42:16 +08:00
package cef
import (
2023-05-31 18:00:34 +08:00
"github.com/energye/energy/v2/common/imports"
2022-12-29 18:42:16 +08:00
"unsafe"
)
func (m *ICefDisplay) ID() (result int64) {
2023-05-31 17:41:14 +08:00
if !m.IsValid() {
return 0
}
2023-03-13 18:12:55 +08:00
imports.Proc(internale_CEFDisplay_ID).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
2022-12-29 18:42:16 +08:00
return
}
2023-03-01 13:38:43 +08:00
func (m *ICefDisplay) DeviceScaleFactor() float32 {
2023-05-31 17:41:14 +08:00
if !m.IsValid() {
return 0
}
2023-03-01 13:38:43 +08:00
var result uintptr
2023-03-13 18:12:55 +08:00
imports.Proc(internale_CEFDisplay_DeviceScaleFactor).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
2023-03-01 13:38:43 +08:00
return *(*float32)(unsafe.Pointer(result))
2022-12-29 18:42:16 +08:00
}
func (m *ICefDisplay) Rotation() int32 {
2023-05-31 17:41:14 +08:00
if !m.IsValid() {
return 0
}
2023-03-13 18:12:55 +08:00
r1, _, _ := imports.Proc(internale_CEFDisplay_Rotation).Call(m.Instance())
2022-12-29 18:42:16 +08:00
return int32(r1)
}
func (m *ICefDisplay) Bounds() (result TCefRect) {
2023-05-31 17:41:14 +08:00
if !m.IsValid() {
return
}
2023-03-13 18:12:55 +08:00
imports.Proc(internale_CEFDisplay_Bounds).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
2022-12-29 18:42:16 +08:00
return
}
func (m *ICefDisplay) WorkArea() (result TCefRect) {
2023-05-31 17:41:14 +08:00
if !m.IsValid() {
return
}
2023-03-13 18:12:55 +08:00
imports.Proc(internale_CEFDisplay_WorkArea).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
2022-12-29 18:42:16 +08:00
return
}
2023-03-13 18:12:55 +08:00
func (m *ICefDisplay) Instance() uintptr {
return uintptr(m.instance)
}
func (m *ICefDisplay) Free() {
if m.instance != nil {
m.base.Free(m.Instance())
m.instance = nil
}
}
2023-05-31 17:41:14 +08:00
func (m *ICefDisplay) IsValid() bool {
if m == nil || m.instance == nil {
return false
}
return m.instance != nil
}