Exemplo n.º 1
0
func (e *DropFilesEvent) Detach(handle int) {
	e.handlers[handle] = nil
	for _, h := range e.handlers {
		if h != nil {
			return
		}
	}
	win.DragAcceptFiles(e.hWnd, false)
}
Exemplo n.º 2
0
func (e *DropFilesEvent) Attach(handler DropFilesEventHandler) int {
	if len(e.handlers) == 0 {
		win.DragAcceptFiles(e.hWnd, true)
	}
	for i, h := range e.handlers {
		if h == nil {
			e.handlers[i] = handler
			return i
		}
	}

	e.handlers = append(e.handlers, handler)
	return len(e.handlers) - 1
}