energy/cef/cef-linked-window-parent.go

207 lines
6.6 KiB
Go
Raw Normal View History

//----------------------------------------
//
// Copyright © yanghy. All Rights Reserved.
//
// 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
// CEFWindowParent组件
// MacOSX, Linux
2022-10-26 19:52:55 +08:00
package cef
import (
"github.com/energye/energy/common/imports"
2022-10-26 19:52:55 +08:00
"github.com/energye/energy/consts"
"github.com/energye/golcl/lcl"
"github.com/energye/golcl/lcl/api"
"github.com/energye/golcl/lcl/types"
"unsafe"
)
2023-02-20 14:42:17 +08:00
// TCEFLinkedWindowParent 组件
2022-10-26 19:52:55 +08:00
type TCEFLinkedWindowParent struct {
BaseWinControl
}
2023-02-20 14:42:17 +08:00
// NewCEFLinkedWindowParent 创建一个新的WindowParent组件
2022-10-26 19:52:55 +08:00
func NewCEFLinkedWindowParent(owner lcl.IComponent) *TCEFLinkedWindowParent {
m := new(TCEFLinkedWindowParent)
r1, _, _ := imports.Proc(internale_CEFLinkedWindow_Create).Call(lcl.CheckPtr(owner))
2022-12-05 10:44:24 +08:00
m.instance = unsafe.Pointer(r1)
2022-10-26 19:52:55 +08:00
return m
}
2023-02-20 14:42:17 +08:00
// Handle 组件句柄
2022-10-26 19:52:55 +08:00
func (m *TCEFLinkedWindowParent) Handle() types.HWND {
ret, _, _ := imports.Proc(internale_CEFLinkedWindow_GetHandle).Call(m.Instance())
2022-12-05 10:44:24 +08:00
return types.HWND(ret)
2022-10-26 19:52:55 +08:00
}
2023-02-20 14:42:17 +08:00
// UpdateSize 更新组件大小
2022-10-26 19:52:55 +08:00
func (m *TCEFLinkedWindowParent) UpdateSize() {
imports.Proc(internale_CEFLinkedWindow_UpdateSize).Call(m.Instance())
2022-10-26 19:52:55 +08:00
}
2023-02-20 14:42:17 +08:00
// Type 组件类型, 这里返回 TCEFLinkedWindowParent 类型
2022-10-26 19:52:55 +08:00
func (m *TCEFLinkedWindowParent) Type() consts.TCefWindowHandleType {
return consts.Wht_LinkedWindowParent
}
2023-02-20 14:42:17 +08:00
// SetChromium 设置 IChromium, 只 TCEFLinkedWindowParent 有效
func (m *TCEFLinkedWindowParent) SetChromium(chromium IChromium, tag int32) {
imports.Proc(internale_CEFLinkedWindow_SetChromium).Call(uintptr(m.instance), chromium.Instance(), uintptr(tag))
2022-10-26 19:52:55 +08:00
}
2023-02-20 14:42:17 +08:00
// HandleAllocated 处理所有
2022-10-26 19:52:55 +08:00
func (m *TCEFLinkedWindowParent) HandleAllocated() bool {
ret, _, _ := imports.Proc(internale_CEFLinkedWindow_HandleAllocated).Call(m.Instance())
2022-12-05 10:44:24 +08:00
return api.GoBool(ret)
2022-10-26 19:52:55 +08:00
}
2023-02-20 14:42:17 +08:00
// CreateHandle 创建句柄
2022-10-26 19:52:55 +08:00
func (m *TCEFLinkedWindowParent) CreateHandle() {
imports.Proc(internale_CEFLinkedWindow_CreateHandle).Call(m.Instance())
2022-10-26 19:52:55 +08:00
}
2023-02-20 14:42:17 +08:00
// DestroyChildWindow 销毁子窗口
2022-10-26 19:52:55 +08:00
func (m *TCEFLinkedWindowParent) DestroyChildWindow() bool {
ret, _, _ := imports.Proc(internale_CEFLinkedWindow_DestroyChildWindow).Call(m.Instance())
2022-12-05 10:44:24 +08:00
return api.GoBool(ret)
2022-10-26 19:52:55 +08:00
}
2023-02-20 14:42:17 +08:00
// SetOnEnter 进入事件
2022-10-26 19:52:55 +08:00
func (m *TCEFLinkedWindowParent) SetOnEnter(fn lcl.TNotifyEvent) {
imports.Proc(internale_CEFLinkedWindow_OnEnter).Call(m.Instance(), api.MakeEventDataPtr(fn))
2022-10-26 19:52:55 +08:00
}
2023-02-20 14:42:17 +08:00
// SetOnExit 退出事件
2022-10-26 19:52:55 +08:00
func (m *TCEFLinkedWindowParent) SetOnExit(fn lcl.TNotifyEvent) {
imports.Proc(internale_CEFLinkedWindow_OnExit).Call(m.Instance(), api.MakeEventDataPtr(fn))
2022-10-26 19:52:55 +08:00
}
2022-10-30 00:35:04 +08:00
2023-02-20 14:42:17 +08:00
// Free 释放
2022-10-30 00:35:04 +08:00
func (m *TCEFLinkedWindowParent) Free() {
2022-12-05 10:44:24 +08:00
if m.IsValid() {
imports.Proc(internale_CEFLinkedWindow_Free).Call(m.Instance())
2022-12-05 10:44:24 +08:00
m.instance = nullptr
}
}
2023-02-20 14:42:17 +08:00
// Name 获取组件名称
2022-12-05 10:44:24 +08:00
func (m *TCEFLinkedWindowParent) Name() string {
ret, _, _ := imports.Proc(internale_CEFLinkedWindow_GetName).Call(m.Instance())
2022-12-05 10:44:24 +08:00
return api.GoStr(ret)
}
2023-02-20 14:42:17 +08:00
// SetName 设置组件名称
2022-12-05 10:44:24 +08:00
func (m *TCEFLinkedWindowParent) SetName(value string) {
imports.Proc(internale_CEFLinkedWindow_SetName).Call(m.Instance(), api.PascalStr(value))
2022-12-05 10:44:24 +08:00
}
2023-02-20 14:42:17 +08:00
// SetParent 设置控件父容器
2022-12-05 10:44:24 +08:00
func (m *TCEFLinkedWindowParent) SetParent(value lcl.IWinControl) {
imports.Proc(internale_CEFLinkedWindow_SetParent).Call(m.Instance(), lcl.CheckPtr(value))
2022-12-05 10:44:24 +08:00
}
2023-02-20 14:42:17 +08:00
// Align Align 获取控件自动调整
2022-12-05 10:44:24 +08:00
func (m *TCEFLinkedWindowParent) Align() types.TAlign {
ret, _, _ := imports.Proc(internale_CEFLinkedWindow_GetAlign).Call(m.Instance())
2022-12-05 10:44:24 +08:00
return types.TAlign(ret)
}
2023-02-20 14:42:17 +08:00
// SetAlign 设置控件自动调整
2022-12-05 10:44:24 +08:00
func (m *TCEFLinkedWindowParent) SetAlign(value types.TAlign) {
imports.Proc(internale_CEFLinkedWindow_SetAlign).Call(m.Instance(), uintptr(value))
2022-12-05 10:44:24 +08:00
}
2023-02-20 14:42:17 +08:00
// Anchors 获取四个角位置的锚点
2022-12-05 10:44:24 +08:00
func (m *TCEFLinkedWindowParent) Anchors() types.TAnchors {
ret, _, _ := imports.Proc(internale_CEFLinkedWindow_GetAnchors).Call(m.Instance())
2022-12-05 10:44:24 +08:00
return types.TAnchors(ret)
}
2023-02-20 14:42:17 +08:00
// SetAnchors 设置四个角位置的锚点
2022-12-05 10:44:24 +08:00
func (m *TCEFLinkedWindowParent) SetAnchors(value types.TAnchors) {
imports.Proc(internale_CEFLinkedWindow_SetAnchors).Call(m.Instance(), uintptr(value))
2022-12-05 10:44:24 +08:00
}
2023-02-20 14:42:17 +08:00
// Visible 获取控件可视
2022-12-05 10:44:24 +08:00
func (m *TCEFLinkedWindowParent) Visible() bool {
ret, _, _ := imports.Proc(internale_CEFLinkedWindow_GetVisible).Call(m.Instance())
2022-12-05 10:44:24 +08:00
return api.GoBool(ret)
}
2023-02-20 14:42:17 +08:00
// SetVisible 设置控件可视
2022-12-05 10:44:24 +08:00
func (m *TCEFLinkedWindowParent) SetVisible(value bool) {
imports.Proc(internale_CEFLinkedWindow_SetVisible).Call(m.Instance(), api.PascalBool(value))
2022-12-05 10:44:24 +08:00
}
// Enabled 获取是否启用
2022-12-05 10:44:24 +08:00
func (m *TCEFLinkedWindowParent) Enabled() bool {
ret, _, _ := imports.Proc(internale_CEFLinkedWindow_GetEnabled).Call(m.Instance())
2022-12-05 10:44:24 +08:00
return api.GoBool(ret)
}
// SetEnabled 设置是否启用
2022-12-05 10:44:24 +08:00
func (m *TCEFLinkedWindowParent) SetEnabled(value bool) {
imports.Proc(internale_CEFLinkedWindow_SetEnabled).Call(m.Instance(), api.PascalBool(value))
2022-12-05 10:44:24 +08:00
}
// Left 获取左边距
2022-12-05 10:44:24 +08:00
func (m *TCEFLinkedWindowParent) Left() int32 {
ret, _, _ := imports.Proc(internale_CEFLinkedWindow_GetLeft).Call(m.Instance())
2022-12-05 10:44:24 +08:00
return int32(ret)
}
// SetLeft 设置左边距
2022-12-05 10:44:24 +08:00
func (m *TCEFLinkedWindowParent) SetLeft(value int32) {
imports.Proc(internale_CEFLinkedWindow_SetLeft).Call(m.Instance(), uintptr(value))
2022-12-05 10:44:24 +08:00
}
// Top 获取上边距
2022-12-05 10:44:24 +08:00
func (m *TCEFLinkedWindowParent) Top() int32 {
ret, _, _ := imports.Proc(internale_CEFLinkedWindow_GetTop).Call(m.Instance())
2022-12-05 10:44:24 +08:00
return int32(ret)
}
// SetTop 设置上边距
2022-12-05 10:44:24 +08:00
func (m *TCEFLinkedWindowParent) SetTop(value int32) {
imports.Proc(internale_CEFLinkedWindow_SetTop).Call(m.Instance(), uintptr(value))
2022-12-05 10:44:24 +08:00
}
// Width 获取宽度
2022-12-05 10:44:24 +08:00
func (m *TCEFLinkedWindowParent) Width() int32 {
ret, _, _ := imports.Proc(internale_CEFLinkedWindow_GetWidth).Call(m.Instance())
2022-12-05 10:44:24 +08:00
return int32(ret)
}
// SetWidth 设置宽度
2022-12-05 10:44:24 +08:00
func (m *TCEFLinkedWindowParent) SetWidth(value int32) {
imports.Proc(internale_CEFLinkedWindow_SetWidth).Call(m.Instance(), uintptr(value))
2022-12-05 10:44:24 +08:00
}
// Height 获取高度
2022-12-05 10:44:24 +08:00
func (m *TCEFLinkedWindowParent) Height() int32 {
ret, _, _ := imports.Proc(internale_CEFLinkedWindow_GetHeight).Call(m.Instance())
2022-12-05 10:44:24 +08:00
return int32(ret)
}
// SetHeight 设置高度
2022-12-05 10:44:24 +08:00
func (m *TCEFLinkedWindowParent) SetHeight(value int32) {
imports.Proc(internale_CEFLinkedWindow_SetHeight).Call(m.Instance(), uintptr(value))
2022-12-05 10:44:24 +08:00
}
2023-02-20 14:42:17 +08:00
// BoundsRect 获取矩形边界
2022-12-05 10:44:24 +08:00
func (m *TCEFLinkedWindowParent) BoundsRect() (result types.TRect) {
imports.Proc(internale_CEFLinkedWindow_GetBoundsRect).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
2022-12-05 10:44:24 +08:00
return result
}
2023-02-20 14:42:17 +08:00
// SetBoundsRect 设置矩形边界
2022-12-05 10:44:24 +08:00
func (m *TCEFLinkedWindowParent) SetBoundsRect(value types.TRect) {
imports.Proc(internale_CEFLinkedWindow_SetBoundsRect).Call(m.Instance(), uintptr(unsafe.Pointer(&value)))
2022-10-30 00:35:04 +08:00
}