示例#1
0
文件: tooltip.go 项目: wangch/walk
func (tt *ToolTip) RemoveTool(tool Widget) error {
	hwnd := tool.Handle()

	var ti win.TOOLINFO
	ti.CbSize = uint32(unsafe.Sizeof(ti))
	ti.Hwnd = hwnd
	ti.UId = uintptr(hwnd)

	tt.SendMessage(win.TTM_DELTOOL, 0, uintptr(unsafe.Pointer(&ti)))

	return nil
}
示例#2
0
文件: tooltip.go 项目: wangch/walk
func (tt *ToolTip) AddTool(tool Widget) error {
	hwnd := tool.Handle()

	var ti win.TOOLINFO
	ti.CbSize = uint32(unsafe.Sizeof(ti))
	ti.Hwnd = hwnd
	ti.UFlags = win.TTF_IDISHWND | win.TTF_SUBCLASS
	ti.UId = uintptr(hwnd)

	if win.FALSE == tt.SendMessage(win.TTM_ADDTOOL, 0, uintptr(unsafe.Pointer(&ti))) {
		return newError("TTM_ADDTOOL failed")
	}

	return nil
}
示例#3
0
文件: tooltip.go 项目: wangch/walk
func (tt *ToolTip) toolInfo(tool Widget) *win.TOOLINFO {
	var ti win.TOOLINFO
	var buf [80]uint16

	hwnd := tool.Handle()

	ti.CbSize = uint32(unsafe.Sizeof(ti))
	ti.Hwnd = hwnd
	ti.UId = uintptr(hwnd)
	ti.LpszText = &buf[0]

	if win.FALSE == tt.SendMessage(win.TTM_GETTOOLINFO, 0, uintptr(unsafe.Pointer(&ti))) {
		return nil
	}

	return &ti
}