78 Star 308 Fork 54

不在乎y / govcl

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
component.go 6.32 KB
一键复制 编辑 原始数据 按行查看 历史
//----------------------------------------
// The code is automatically generated by the GenlibLcl tool.
// Copyright © ying32. All Rights Reserved.
//
// Licensed under Apache License 2.0
//
//----------------------------------------
package vcl
import (
. "github.com/ying32/govcl/vcl/api"
. "github.com/ying32/govcl/vcl/types"
"unsafe"
)
type TComponent struct {
IComponent
instance uintptr
// 特殊情况下使用,主要应对Go的GC问题,与LCL没有太多关系。
ptr unsafe.Pointer
}
// 创建一个新的对象。
//
// Create a new object.
func NewComponent(owner IComponent) *TComponent {
c := new(TComponent)
c.instance = Component_Create(CheckPtr(owner))
c.ptr = unsafe.Pointer(c.instance)
return c
}
// 动态转换一个已存在的对象实例。
//
// Dynamically convert an existing object instance.
func AsComponent(obj interface{}) *TComponent {
instance, ptr := getInstance(obj)
if instance == 0 { return nil }
return &TComponent{instance: instance, ptr: ptr}
}
// -------------------------- Deprecated begin --------------------------
// 新建一个对象来自已经存在的对象实例指针。
//
// Create a new object from an existing object instance pointer.
// Deprecated: use AsComponent.
func ComponentFromInst(inst uintptr) *TComponent {
return AsComponent(inst)
}
// 新建一个对象来自已经存在的对象实例。
//
// Create a new object from an existing object instance.
// Deprecated: use AsComponent.
func ComponentFromObj(obj IObject) *TComponent {
return AsComponent(obj)
}
// 新建一个对象来自不安全的地址。注意:使用此函数可能造成一些不明情况,慎用。
//
// Create a new object from an unsecured address. Note: Using this function may cause some unclear situations and be used with caution..
// Deprecated: use AsComponent.
func ComponentFromUnsafePointer(ptr unsafe.Pointer) *TComponent {
return AsComponent(ptr)
}
// -------------------------- Deprecated end --------------------------
// 释放对象。
//
// Free object.
func (c *TComponent) Free() {
if c.instance != 0 {
Component_Free(c.instance)
c.instance, c.ptr = 0, nullptr
}
}
// 返回对象实例指针。
//
// Return object instance pointer.
func (c *TComponent) Instance() uintptr {
return c.instance
}
// 获取一个不安全的地址。
//
// Get an unsafe address.
func (c *TComponent) UnsafeAddr() unsafe.Pointer {
return c.ptr
}
// 检测地址是否为空。
//
// Check if the address is empty.
func (c *TComponent) IsValid() bool {
return c.instance != 0
}
// 检测当前对象是否继承自目标对象。
//
// Checks whether the current object is inherited from the target object.
func (c *TComponent) Is() TIs {
return TIs(c.instance)
}
// 动态转换当前对象为目标对象。
//
// Dynamically convert the current object to the target object.
//func (c *TComponent) As() TAs {
// return TAs(c.instance)
//}
// 获取类信息指针。
//
// Get class information pointer.
func TComponentClass() TClass {
return Component_StaticClassType()
}
// 查找指定名称的组件。
//
// Find the component with the specified name.
func (c *TComponent) FindComponent(AName string) *TComponent {
return AsComponent(Component_FindComponent(c.instance, AName))
}
// 获取类名路径。
//
// Get the class name path.
func (c *TComponent) GetNamePath() string {
return Component_GetNamePath(c.instance)
}
// 是否有父容器。
//
// Is there a parent container.
func (c *TComponent) HasParent() bool {
return Component_HasParent(c.instance)
}
// 复制一个对象,如果对象实现了此方法的话。
//
// Copy an object, if the object implements this method.
func (c *TComponent) Assign(Source IObject) {
Component_Assign(c.instance, CheckPtr(Source))
}
// 获取类的类型信息。
//
// Get class type information.
func (c *TComponent) ClassType() TClass {
return Component_ClassType(c.instance)
}
// 获取当前对象类名称。
//
// Get the current object class name.
func (c *TComponent) ClassName() string {
return Component_ClassName(c.instance)
}
// 获取当前对象实例大小。
//
// Get the current object instance size.
func (c *TComponent) InstanceSize() int32 {
return Component_InstanceSize(c.instance)
}
// 判断当前类是否继承自指定类。
//
// Determine whether the current class inherits from the specified class.
func (c *TComponent) InheritsFrom(AClass TClass) bool {
return Component_InheritsFrom(c.instance, AClass)
}
// 与一个对象进行比较。
//
// Compare with an object.
func (c *TComponent) Equals(Obj IObject) bool {
return Component_Equals(c.instance, CheckPtr(Obj))
}
// 获取类的哈希值。
//
// Get the hash value of the class.
func (c *TComponent) GetHashCode() int32 {
return Component_GetHashCode(c.instance)
}
// 文本类信息。
//
// Text information.
func (c *TComponent) ToString() string {
return Component_ToString(c.instance)
}
// 获取组件总数。
//
// Get the total number of components.
func (c *TComponent) ComponentCount() int32 {
return Component_GetComponentCount(c.instance)
}
// 获取组件索引。
//
// Get component index.
func (c *TComponent) ComponentIndex() int32 {
return Component_GetComponentIndex(c.instance)
}
// 设置组件索引。
//
// Set component index.
func (c *TComponent) SetComponentIndex(value int32) {
Component_SetComponentIndex(c.instance, value)
}
// 获取组件所有者。
//
// Get component owner.
func (c *TComponent) Owner() *TComponent {
return AsComponent(Component_GetOwner(c.instance))
}
// 获取组件名称。
//
// Get the component name.
func (c *TComponent) Name() string {
return Component_GetName(c.instance)
}
// 设置组件名称。
//
// Set the component name.
func (c *TComponent) SetName(value string) {
Component_SetName(c.instance, value)
}
// 获取对象标记。
//
// Get the control tag.
func (c *TComponent) Tag() int {
return Component_GetTag(c.instance)
}
// 设置对象标记。
//
// Set the control tag.
func (c *TComponent) SetTag(value int) {
Component_SetTag(c.instance, value)
}
// 获取指定索引组件。
//
// Get the specified index component.
func (c *TComponent) Components(AIndex int32) *TComponent {
return AsComponent(Component_GetComponents(c.instance, AIndex))
}
Go
1
https://gitee.com/ying32/govcl.git
git@gitee.com:ying32/govcl.git
ying32
govcl
govcl
v2.2.0

搜索帮助

53164aa7 5694891 3bd8fe86 5694891