-
Notifications
You must be signed in to change notification settings - Fork 22
/
types_window_parent_other.go
266 lines (219 loc) · 7.93 KB
/
types_window_parent_other.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
//----------------------------------------
//
// Copyright © yanghy. All Rights Reserved.
//
// Licensed under Apache License Version 2.0, January 2004
//
// https://www.apache.org/licenses/LICENSE-2.0
//
//----------------------------------------
//go:build !windows
// +build !windows
// CEFWindowParent组件
// MacOSX, Linux
package cef
import (
"github.com/energye/energy/v2/cef/internal/def"
"github.com/energye/energy/v2/common/imports"
"github.com/energye/energy/v2/consts"
"github.com/energye/golcl/lcl"
"github.com/energye/golcl/lcl/api"
"github.com/energye/golcl/lcl/types"
"unsafe"
)
// TCEFLinkedWindowParent 组件
type TCEFLinkedWindowParent struct {
BaseWinControl
x, y, w, h int32
}
// NewCEFWindowParent 创建一个新的 TCEFLinkedWindowParent 组件
func NewCEFWindowParent(owner lcl.IComponent) *TCEFLinkedWindowParent {
m := new(TCEFLinkedWindowParent)
r1, _, _ := imports.Proc(def.CEFLinkedWindow_Create).Call(lcl.CheckPtr(owner))
m.instance = unsafe.Pointer(r1)
return m
}
func (m *TCEFLinkedWindowParent) Instance() uintptr {
return uintptr(m.instance)
}
// Handle 组件句柄
func (m *TCEFLinkedWindowParent) Handle() types.HWND {
ret, _, _ := imports.Proc(def.CEFLinkedWindow_GetHandle).Call(m.Instance())
return types.HWND(ret)
}
// UpdateSize 更新组件大小
func (m *TCEFLinkedWindowParent) UpdateSize() {
imports.Proc(def.CEFLinkedWindow_UpdateSize).Call(m.Instance())
}
func (m *TCEFLinkedWindowParent) Repaint() {
imports.Proc(def.CEFLinkedWindow_Repaint).Call(m.Instance())
}
// Type 组件类型, 这里返回 TCEFLinkedWindowParent 类型
func (m *TCEFLinkedWindowParent) Type() consts.TCefWindowHandleType {
return consts.Wht_LinkedWindowParent
}
// SetChromium 设置 IChromium, 只 TCEFLinkedWindowParent 有效
func (m *TCEFLinkedWindowParent) SetChromium(chromium IChromium, tag int32) {
imports.Proc(def.CEFLinkedWindow_SetChromium).Call(uintptr(m.instance), chromium.Instance(), uintptr(tag))
}
// HandleAllocated 处理所有
func (m *TCEFLinkedWindowParent) HandleAllocated() bool {
ret, _, _ := imports.Proc(def.CEFLinkedWindow_HandleAllocated).Call(m.Instance())
return api.GoBool(ret)
}
// CreateHandle 创建句柄
func (m *TCEFLinkedWindowParent) CreateHandle() {
imports.Proc(def.CEFLinkedWindow_CreateHandle).Call(m.Instance())
}
// DestroyChildWindow 销毁子窗口
func (m *TCEFLinkedWindowParent) DestroyChildWindow() bool {
ret, _, _ := imports.Proc(def.CEFLinkedWindow_DestroyChildWindow).Call(m.Instance())
return api.GoBool(ret)
}
// SetOnEnter 进入事件
func (m *TCEFLinkedWindowParent) SetOnEnter(fn lcl.TNotifyEvent) {
imports.Proc(def.CEFLinkedWindow_OnEnter).Call(m.Instance(), api.MakeEventDataPtr(fn))
}
// SetOnExit 退出事件
func (m *TCEFLinkedWindowParent) SetOnExit(fn lcl.TNotifyEvent) {
imports.Proc(def.CEFLinkedWindow_OnExit).Call(m.Instance(), api.MakeEventDataPtr(fn))
}
// Free 释放
func (m *TCEFLinkedWindowParent) Free() {
if m.IsValid() {
imports.Proc(def.CEFLinkedWindow_Free).Call(m.Instance())
m.instance = nil
}
}
// Name 获取组件名称
func (m *TCEFLinkedWindowParent) Name() string {
ret, _, _ := imports.Proc(def.CEFLinkedWindow_GetName).Call(m.Instance())
return api.GoStr(ret)
}
// SetName 设置组件名称
func (m *TCEFLinkedWindowParent) SetName(value string) {
imports.Proc(def.CEFLinkedWindow_SetName).Call(m.Instance(), api.PascalStr(value))
}
// SetParent 设置控件父容器
func (m *TCEFLinkedWindowParent) SetParent(value lcl.IWinControl) {
imports.Proc(def.CEFLinkedWindow_SetParent).Call(m.Instance(), lcl.CheckPtr(value))
}
// RevertCustomAnchors 恢复到自定义四角锚点定位
func (m *TCEFLinkedWindowParent) RevertCustomAnchors() {
m.SetAlign(types.AlCustom)
m.SetAnchors(types.NewSet())
}
// DefaultAnchors 恢复到默认四角锚点定位
func (m *TCEFLinkedWindowParent) DefaultAnchors() {
m.SetAlign(types.AlClient)
m.SetAnchors(types.NewSet(types.AkTop, types.AkLeft, types.AkRight, types.AkBottom))
}
// Align Align 获取控件自动调整
func (m *TCEFLinkedWindowParent) Align() types.TAlign {
ret, _, _ := imports.Proc(def.CEFLinkedWindow_GetAlign).Call(m.Instance())
return types.TAlign(ret)
}
// SetAlign 设置控件自动调整
func (m *TCEFLinkedWindowParent) SetAlign(value types.TAlign) {
imports.Proc(def.CEFLinkedWindow_SetAlign).Call(m.Instance(), uintptr(value))
}
// Anchors 获取四个角位置的锚点
func (m *TCEFLinkedWindowParent) Anchors() types.TAnchors {
ret, _, _ := imports.Proc(def.CEFLinkedWindow_GetAnchors).Call(m.Instance())
return types.TAnchors(ret)
}
// SetAnchors 设置四个角位置的锚点
func (m *TCEFLinkedWindowParent) SetAnchors(value types.TAnchors) {
imports.Proc(def.CEFLinkedWindow_SetAnchors).Call(m.Instance(), uintptr(value))
}
// Visible 获取控件可视
func (m *TCEFLinkedWindowParent) Visible() bool {
ret, _, _ := imports.Proc(def.CEFLinkedWindow_GetVisible).Call(m.Instance())
return api.GoBool(ret)
}
// SetVisible 设置控件可视
func (m *TCEFLinkedWindowParent) SetVisible(value bool) {
imports.Proc(def.CEFLinkedWindow_SetVisible).Call(m.Instance(), api.PascalBool(value))
}
// Enabled 获取是否启用
func (m *TCEFLinkedWindowParent) Enabled() bool {
ret, _, _ := imports.Proc(def.CEFLinkedWindow_GetEnabled).Call(m.Instance())
return api.GoBool(ret)
}
// SetEnabled 设置是否启用
func (m *TCEFLinkedWindowParent) SetEnabled(value bool) {
imports.Proc(def.CEFLinkedWindow_SetEnabled).Call(m.Instance(), api.PascalBool(value))
}
// Left 获取左边距
func (m *TCEFLinkedWindowParent) Left() int32 {
ret, _, _ := imports.Proc(def.CEFLinkedWindow_GetLeft).Call(m.Instance())
return int32(ret)
}
// SetLeft 设置左边距
func (m *TCEFLinkedWindowParent) SetLeft(value int32) {
m.x = value
imports.Proc(def.CEFLinkedWindow_SetLeft).Call(m.Instance(), uintptr(value))
}
// Top 获取上边距
func (m *TCEFLinkedWindowParent) Top() int32 {
ret, _, _ := imports.Proc(def.CEFLinkedWindow_GetTop).Call(m.Instance())
return int32(ret)
}
// SetTop 设置上边距
func (m *TCEFLinkedWindowParent) SetTop(value int32) {
m.y = value
imports.Proc(def.CEFLinkedWindow_SetTop).Call(m.Instance(), uintptr(value))
}
// Width 获取宽度
func (m *TCEFLinkedWindowParent) Width() int32 {
ret, _, _ := imports.Proc(def.CEFLinkedWindow_GetWidth).Call(m.Instance())
return int32(ret)
}
// SetWidth 设置宽度
func (m *TCEFLinkedWindowParent) SetWidth(value int32) {
m.w = value
imports.Proc(def.CEFLinkedWindow_SetWidth).Call(m.Instance(), uintptr(value))
}
// Height 获取高度
func (m *TCEFLinkedWindowParent) Height() int32 {
ret, _, _ := imports.Proc(def.CEFLinkedWindow_GetHeight).Call(m.Instance())
return int32(ret)
}
// SetHeight 设置高度
func (m *TCEFLinkedWindowParent) SetHeight(value int32) {
m.h = value
imports.Proc(def.CEFLinkedWindow_SetHeight).Call(m.Instance(), uintptr(value))
}
// BoundsRect 获取矩形边界
func (m *TCEFLinkedWindowParent) BoundsRect() (result types.TRect) {
imports.Proc(def.CEFLinkedWindow_GetBoundsRect).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
return result
}
// SetBoundsRect 设置矩形边界
func (m *TCEFLinkedWindowParent) SetBoundsRect(value types.TRect) {
m.x = value.Left
m.y = value.Top
m.w = value.Width()
m.h = value.Height()
imports.Proc(def.CEFLinkedWindow_SetBoundsRect).Call(m.Instance(), uintptr(unsafe.Pointer(&value)))
}
func (m *TCEFLinkedWindowParent) SetTag(tag int) {
imports.Proc(def.CEFLinkedWindow_SetTag).Call(m.Instance(), uintptr(int32(tag)))
}
func (m *TCEFLinkedWindowParent) Tag() int {
r1, _, _ := imports.Proc(def.CEFLinkedWindow_GetTag).Call(m.Instance())
return int(int32(r1))
}
func (m *TCEFLinkedWindowParent) point() (x, y int32) {
return m.x, m.y
}
func (m *TCEFLinkedWindowParent) size() (w, h int32) {
return m.w, m.h
}
func (m *TCEFLinkedWindowParent) SetFocus() {
imports.Proc(def.CEFLinkedWindow_SetFocus).Call(m.Instance())
}
func (m *TCEFLinkedWindowParent) CanFocus() bool {
r1, _, _ := imports.Proc(def.CEFLinkedWindow_CanFocus).Call(m.Instance())
return api.GoBool(r1)
}