2022-10-04 13:21:05 +08:00
|
|
|
//----------------------------------------
|
|
|
|
//
|
|
|
|
// Copyright © yanghy. All Rights Reserved.
|
|
|
|
//
|
2022-10-04 16:38:43 +08:00
|
|
|
// Licensed under GNU General Public License v3.0
|
2022-10-04 13:21:05 +08:00
|
|
|
//
|
|
|
|
//----------------------------------------
|
|
|
|
|
|
|
|
package cef
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/energye/golcl/lcl"
|
|
|
|
"github.com/energye/golcl/lcl/types"
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
type BaseWinControl struct {
|
|
|
|
lcl.IWinControl
|
|
|
|
procName string
|
|
|
|
instance uintptr
|
|
|
|
ptr unsafe.Pointer
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *BaseWinControl) IsValid() bool {
|
|
|
|
return m.instance != 0
|
|
|
|
}
|
|
|
|
|
|
|
|
// 获取组件名称。
|
|
|
|
func (m *BaseWinControl) Name() string {
|
2022-11-29 20:04:08 +08:00
|
|
|
return _GetName(m.procName, m.instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// 设置组件名称。
|
|
|
|
func (m *BaseWinControl) SetName(value string) {
|
2022-11-29 20:04:08 +08:00
|
|
|
_SetName(m.procName, m.instance, value)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *BaseWinControl) Free() {
|
|
|
|
if m.instance != 0 {
|
2022-11-29 20:04:08 +08:00
|
|
|
_Free(m.procName, m.instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
m.instance, m.ptr = 0, nullptr
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Instance 当前实例地址
|
|
|
|
func (m *BaseWinControl) Instance() uintptr {
|
|
|
|
return m.instance
|
|
|
|
}
|
|
|
|
|
|
|
|
// 设置控件父容器。
|
|
|
|
func (m *BaseWinControl) SetParent(value lcl.IWinControl) {
|
2022-11-29 20:04:08 +08:00
|
|
|
_SetParent(m.procName, m.instance, lcl.CheckPtr(value))
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//Align 获取控件自动调整。
|
|
|
|
func (m *BaseWinControl) Align() types.TAlign {
|
2022-11-29 20:04:08 +08:00
|
|
|
return _Align(m.procName, m.instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//SetAlign 设置控件自动调整。
|
|
|
|
func (m *BaseWinControl) SetAlign(value types.TAlign) {
|
2022-11-29 20:04:08 +08:00
|
|
|
_SetAlign(m.procName, m.instance, value)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//Anchors 获取四个角位置的锚点。
|
|
|
|
func (m *BaseWinControl) Anchors() types.TAnchors {
|
2022-11-29 20:04:08 +08:00
|
|
|
return _Anchors(m.procName, m.instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//SetAnchors 设置四个角位置的锚点。
|
|
|
|
func (m *BaseWinControl) SetAnchors(value types.TAnchors) {
|
2022-11-29 20:04:08 +08:00
|
|
|
_SetAnchors(m.procName, m.instance, value)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//Visible 获取控件可视。
|
|
|
|
func (m *BaseWinControl) Visible() bool {
|
2022-11-29 20:04:08 +08:00
|
|
|
return _GetVisible(m.procName, m.instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//SetVisible 设置控件可视。
|
|
|
|
func (m *BaseWinControl) SetVisible(value bool) {
|
2022-11-29 20:04:08 +08:00
|
|
|
_SetVisible(m.procName, m.instance, value)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//Enabled 获取是否启用
|
|
|
|
func (m *BaseWinControl) Enabled() bool {
|
2022-11-29 20:04:08 +08:00
|
|
|
return _GetEnabled(m.procName, m.instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//SetEnabled 设置是否启用
|
|
|
|
func (m *BaseWinControl) SetEnabled(value bool) {
|
2022-11-29 20:04:08 +08:00
|
|
|
_SetEnabled(m.procName, m.instance, value)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//Left 获取左边距
|
|
|
|
func (m *BaseWinControl) Left() int32 {
|
2022-11-29 20:04:08 +08:00
|
|
|
return _GetLeft(m.procName, m.instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//SetLeft 设置左边距
|
|
|
|
func (m *BaseWinControl) SetLeft(value int32) {
|
2022-11-29 20:04:08 +08:00
|
|
|
_SetLeft(m.procName, m.instance, value)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//Top 获取上边距
|
|
|
|
func (m *BaseWinControl) Top() int32 {
|
2022-11-29 20:04:08 +08:00
|
|
|
return _GetTop(m.procName, m.instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//SetTop 设置上边距
|
|
|
|
func (m *BaseWinControl) SetTop(value int32) {
|
2022-11-29 20:04:08 +08:00
|
|
|
_SetTop(m.procName, m.instance, value)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//Width 获取宽度
|
|
|
|
func (m *BaseWinControl) Width() int32 {
|
2022-11-29 20:04:08 +08:00
|
|
|
return _GetWidth(m.procName, m.instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//SetWidth 设置宽度
|
|
|
|
func (m *BaseWinControl) SetWidth(value int32) {
|
2022-11-29 20:04:08 +08:00
|
|
|
_SetWidth(m.procName, m.instance, value)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//Height 获取高度
|
|
|
|
func (m *BaseWinControl) Height() int32 {
|
2022-11-29 20:04:08 +08:00
|
|
|
return _GetHeight(m.procName, m.instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//SetHeight 设置高度
|
|
|
|
func (m *BaseWinControl) SetHeight(value int32) {
|
2022-11-29 20:04:08 +08:00
|
|
|
_SetHeight(m.procName, m.instance, value)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *BaseWinControl) BoundsRect() types.TRect {
|
2022-11-29 20:04:08 +08:00
|
|
|
return _GetBoundsRect(m.procName, m.instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *BaseWinControl) SetBoundsRect(value types.TRect) {
|
2022-11-29 20:04:08 +08:00
|
|
|
_SetBoundsRect(m.procName, m.instance, value)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|