package ui import "opslag.de/schobers/geom" type DragDropEventTarget interface { DragEnter(geom.PointF32, []string) DragMove(geom.PointF32) DragLeave() Drop(geom.PointF32, []string) } type DragDropProvider interface { Register(windowHandle uintptr, target DragDropEventTarget) } var DefaultDragDropProvider DragDropProvider = nil type dragDropEventTarget struct { renderer Renderer events []Event } func (t *dragDropEventTarget) eventBase() EventBase { return EventBase{StampInSeconds: t.renderer.Stamp()} } func (t *dragDropEventTarget) pushEvent(e Event) { t.events = append(t.events, e) t.renderer.Refresh() } func (t *dragDropEventTarget) DragEnter(pos geom.PointF32, files []string) { t.pushEvent(&DisplayDragEnterEvent{EventBase: t.eventBase(), X: pos.X, Y: pos.Y, Files: files}) } func (t *dragDropEventTarget) DragMove(pos geom.PointF32) { t.pushEvent(&DisplayDragMoveEvent{EventBase: t.eventBase(), X: pos.X, Y: pos.Y}) } func (t *dragDropEventTarget) DragLeave() { t.pushEvent(&DisplayDragLeaveEvent{EventBase: t.eventBase()}) } func (t *dragDropEventTarget) Drop(pos geom.PointF32, files []string) { t.pushEvent(&DisplayDropEvent{EventBase: t.eventBase(), X: pos.X, Y: pos.Y, Files: files}) }