controls

package
v0.0.0-...-f588240 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Run

func Run(form MainForm)

Types

type BaseContainer

type BaseContainer struct {
	Childs map[uintptr]Child
	// contains filtered or unexported fields
}

BaseContainer 容器基类,管理子控件的布局和锚定

func (*BaseContainer) AddChild

func (_this *BaseContainer) AddChild(child Child)

添加子控件

func (*BaseContainer) Init

func (_this *BaseContainer) Init(container Container) *BaseContainer

初始化容器

func (*BaseContainer) RemoveChild

func (_this *BaseContainer) RemoveChild(child Child)

移除子控件

type BaseUI

type BaseUI struct {
	EvLoad map[string]func(s GUI)
	OnLoad func()

	EvDestroy map[string]func(s GUI)
	OnDestroy func()

	EvKeyDown map[string]func(s GUI, e *fm.KeyEvArgs)
	OnKeyDown func(e *fm.KeyEvArgs)

	EvKeyUp map[string]func(s GUI, e *fm.KeyEvArgs)
	OnKeyUp func(e *fm.KeyEvArgs)

	EvKeyPress map[string]func(s GUI, e *fm.KeyPressEvArgs)
	OnKeyPress func(e *fm.KeyPressEvArgs)

	EvShow map[string]func(s GUI)
	OnShow func()

	EvResize map[string]func(s GUI, e fm.Rect)
	OnResize func(e fm.Rect)

	EvMove map[string]func(s GUI, e fm.Point)
	OnMove func(e fm.Point)

	EvMouseMove map[string]func(s GUI, e *fm.MouseEvArgs)
	OnMouseMove func(e *fm.MouseEvArgs)

	EvMouseDown map[string]func(s GUI, e *fm.MouseEvArgs)
	OnMouseDown func(e *fm.MouseEvArgs)

	EvMouseUp map[string]func(s GUI, e *fm.MouseEvArgs)
	OnMouseUp func(e *fm.MouseEvArgs)

	EvMouseWheel map[string]func(s GUI, e *fm.MouseEvArgs)
	OnMouseWheel func(e *fm.MouseEvArgs)

	EvMouseClick map[string]func(s GUI, e *fm.MouseEvArgs)
	OnMouseClick func(e *fm.MouseEvArgs)

	EvPaint map[string]func(s GUI, e fm.PaintEvArgs)
	OnPaint func(e fm.PaintEvArgs)

	EvFocus map[string]func(s GUI)
	OnFocus func()

	EvLostFocus map[string]func(s GUI)
	OnLostFocus func()

	OnSetCursor           func() bool
	OnImeStartComposition func() bool
	// contains filtered or unexported fields
}

BaseUI UI 控件基类,提供事件处理和基本功能

func (*BaseUI) CreateGraphics

func (_this *BaseUI) CreateGraphics() fm.Graphics

创建图形绘制对象

func (*BaseUI) Enable

func (_this *BaseUI) Enable(enable bool)

启用或禁用组件

func (*BaseUI) GetBound

func (_this *BaseUI) GetBound() fm.Bound

获取组件边界信息

func (*BaseUI) GetCursor

func (_this *BaseUI) GetCursor() fm.CursorType

获取光标类型

func (*BaseUI) GetHandle

func (_this *BaseUI) GetHandle() uintptr

获取组件句柄

func (*BaseUI) GetOwner

func (_this *BaseUI) GetOwner() GUI

获取所属组件

func (*BaseUI) GetParent

func (_this *BaseUI) GetParent() GUI

获取父组件

func (*BaseUI) Hide

func (_this *BaseUI) Hide()

隐藏组件

func (*BaseUI) Init

func (_this *BaseUI) Init(instance GUI, impl br.Window) *BaseUI

初始化基础 UI 组件

func (*BaseUI) Invoke

func (_this *BaseUI) Invoke(fn func())

在主线程中异步调用函数

func (*BaseUI) InvokeEx

func (_this *BaseUI) InvokeEx(fn func(state interface{}), state interface{})

在主线程中异步调用函数(带状态参数)

func (*BaseUI) IsEnable

func (_this *BaseUI) IsEnable() bool

检查组件是否启用

func (*BaseUI) SetBgColor

func (_this *BaseUI) SetBgColor(color int32)

设置背景颜色

func (*BaseUI) SetCursor

func (_this *BaseUI) SetCursor(cursor fm.CursorType)

设置光标类型

func (*BaseUI) SetLocation

func (_this *BaseUI) SetLocation(x, y int)

设置组件位置

func (*BaseUI) SetSize

func (_this *BaseUI) SetSize(width, height int)

设置组件大小

func (*BaseUI) Show

func (_this *BaseUI) Show()

显示组件

type Child

type Child interface {
	GUI

	GetAnchor() fm.AnchorStyle
	SetAnchor(style fm.AnchorStyle)
	// contains filtered or unexported methods
}

Child 子控件接口

type Container

type Container interface {
	GUI
	// contains filtered or unexported methods
}

Container 容器接口

type Control

type Control struct {
	BaseUI
	// contains filtered or unexported fields
}

Control 控件基类

func (*Control) GetAnchor

func (_this *Control) GetAnchor() fm.AnchorStyle

获取控件的锚定样式

func (*Control) Init

func (_this *Control) Init() *Control

初始化控件

func (*Control) SetAnchor

func (_this *Control) SetAnchor(style fm.AnchorStyle)

设置控件的锚定样式

type Form

type Form struct {
	BaseUI
	BaseContainer

	EvState map[string]func(s GUI, state fm.FormState)
	OnState func(state fm.FormState)
	// contains filtered or unexported fields
}

Form 窗体类

func (*Form) Close

func (_this *Form) Close()

关闭窗体

func (*Form) GetBorderStyle

func (_this *Form) GetBorderStyle() fm.FormBorder

获取窗体边框样式

func (*Form) GetState

func (_this *Form) GetState() fm.FormState

获取窗体状态

func (*Form) Init

func (_this *Form) Init() *Form

初始化窗体

func (*Form) InitEx

func (_this *Form) InitEx(param br.FormParam) *Form

使用参数初始化窗体

func (*Form) NoneBorderResize

func (_this *Form) NoneBorderResize()

启用无边框窗口的调整大小功能

func (*Form) SetBorderStyle

func (_this *Form) SetBorderStyle(style fm.FormBorder)

设置窗体边框样式

func (*Form) SetIcon

func (_this *Form) SetIcon(file string)

设置窗体图标(从文件)

func (*Form) SetIconData

func (_this *Form) SetIconData(iconData []byte)

设置窗体图标(从数据)

func (*Form) SetMaximizeBox

func (_this *Form) SetMaximizeBox(isShow bool)

设置是否显示最大化按钮

func (*Form) SetMinimizeBox

func (_this *Form) SetMinimizeBox(isShow bool)

设置是否显示最小化按钮

func (*Form) SetStartPosition

func (_this *Form) SetStartPosition(pos fm.FormStart)

设置窗体启动位置

func (*Form) SetState

func (_this *Form) SetState(state fm.FormState)

设置窗体状态

func (*Form) SetTitle

func (_this *Form) SetTitle(title string)

设置窗体标题

func (*Form) SetTopMost

func (_this *Form) SetTopMost(isTop bool)

设置窗体是否置顶

func (*Form) ShowDialog

func (_this *Form) ShowDialog()

以模态方式显示窗体

type GUI

type GUI interface {
	GetHandle() uintptr
	GetBound() fm.Bound
	SetSize(width, height int)
	SetLocation(x, y int)
	SetBgColor(color int32)
	Invoke(fn func())
	InvokeEx(fn func(state interface{}), state interface{})
	Enable(b bool)
	IsEnable() bool
	GetParent() GUI
	GetOwner() GUI
}

GUI 图形用户界面接口

type MainForm

type MainForm interface {
	// contains filtered or unexported methods
}

MainForm 主窗体接口

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL