zntg/ui/event.go
Sander Schobers 3c89748eac Added drag & drop addon.
- Drop addon is based on WM_DROPFILES, dragdrop addon is based on the OLE IDragDrop interface and thus can registerer more interactions.
- The allg5ui implementation will try to fall back on the drop addon (because the dragdrop addon wouldn't work properly).
- Drop addon is refactored to use the same interface as the dragdrop addon.
2021-06-04 17:17:22 +02:00

126 lines
1.7 KiB
Go

package ui
import "opslag.de/schobers/geom"
type DisplayCloseEvent struct {
EventBase
}
type DisplayDragEnterEvent struct {
EventBase
X, Y float32
Files []string
}
type DisplayDragLeaveEvent struct {
EventBase
}
type DisplayDragMoveEnter struct {
EventBase
X, Y float32
}
type DisplayDropEvent struct {
EventBase
X, Y float32
Files []string
}
func (e DisplayDropEvent) Pos() geom.PointF32 {
return geom.PtF32(e.X, e.Y)
}
type DisplayMoveEvent struct {
EventBase
Bounds geom.RectangleF32
}
type DisplayResizeEvent struct {
EventBase
Bounds geom.RectangleF32
}
type Event interface {
Stamp() float64
}
type EventBase struct {
StampInSeconds float64
}
func (e *EventBase) Stamp() float64 {
return e.StampInSeconds
}
type KeyModifier int
const (
KeyModifierNone KeyModifier = 0
KeyModifierShift = 1 << iota
KeyModifierControl
KeyModifierAlt
KeyModifierOSCommand
)
type KeyDownEvent struct {
EventBase
Key Key
Modifiers KeyModifier
}
type KeyUpEvent struct {
EventBase
Key Key
Modifiers KeyModifier
}
type MouseButton int
const (
MouseButtonLeft MouseButton = 1
MouseButtonRight MouseButton = 2
MouseButtonMiddle MouseButton = 3
)
type MouseButtonDownEvent struct {
MouseEvent
Button MouseButton
}
type MouseButtonUpEvent struct {
MouseEvent
Button MouseButton
}
type MouseEnterEvent struct {
MouseEvent
}
type MouseEvent struct {
EventBase
X, Y float32
}
func (e *MouseEvent) Pos() geom.PointF32 {
return geom.PtF32(e.X, e.Y)
}
type MouseLeaveEvent struct {
MouseEvent
}
type MouseMoveEvent struct {
MouseEvent
MouseWheel float32
}
type RefreshEvent struct {
EventBase
}
type TextInputEvent struct {
EventBase
Character rune
}