2019-03-05 20:52:18 +00:00
|
|
|
package ui
|
|
|
|
|
|
|
|
import "opslag.de/schobers/geom"
|
|
|
|
|
|
|
|
type DisplayCloseEvent struct {
|
|
|
|
EventBase
|
|
|
|
}
|
|
|
|
|
2021-06-04 15:17:22 +00:00
|
|
|
type DisplayDragEnterEvent struct {
|
|
|
|
EventBase
|
|
|
|
X, Y float32
|
|
|
|
Files []string
|
|
|
|
}
|
|
|
|
|
2021-06-07 05:48:24 +00:00
|
|
|
func (e DisplayDragEnterEvent) Pos() geom.PointF32 {
|
|
|
|
return geom.PtF32(e.X, e.Y)
|
|
|
|
}
|
|
|
|
|
2021-06-04 15:17:22 +00:00
|
|
|
type DisplayDragLeaveEvent struct {
|
|
|
|
EventBase
|
|
|
|
}
|
|
|
|
|
2021-06-07 05:48:24 +00:00
|
|
|
type DisplayDragMoveEvent struct {
|
2021-06-04 15:17:22 +00:00
|
|
|
EventBase
|
|
|
|
X, Y float32
|
|
|
|
}
|
|
|
|
|
2021-06-07 05:48:24 +00:00
|
|
|
func (e DisplayDragMoveEvent) Pos() geom.PointF32 {
|
|
|
|
return geom.PtF32(e.X, e.Y)
|
|
|
|
}
|
|
|
|
|
2021-06-04 15:17:22 +00:00
|
|
|
type DisplayDropEvent struct {
|
|
|
|
EventBase
|
|
|
|
X, Y float32
|
|
|
|
Files []string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e DisplayDropEvent) Pos() geom.PointF32 {
|
|
|
|
return geom.PtF32(e.X, e.Y)
|
|
|
|
}
|
|
|
|
|
2020-05-17 13:30:52 +00:00
|
|
|
type DisplayMoveEvent struct {
|
|
|
|
EventBase
|
|
|
|
Bounds geom.RectangleF32
|
|
|
|
}
|
|
|
|
|
2019-03-05 21:51:57 +00:00
|
|
|
type DisplayResizeEvent struct {
|
|
|
|
EventBase
|
|
|
|
Bounds geom.RectangleF32
|
|
|
|
}
|
|
|
|
|
2019-03-05 20:52:18 +00:00
|
|
|
type Event interface {
|
|
|
|
Stamp() float64
|
|
|
|
}
|
|
|
|
|
|
|
|
type EventBase struct {
|
|
|
|
StampInSeconds float64
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EventBase) Stamp() float64 {
|
|
|
|
return e.StampInSeconds
|
|
|
|
}
|
|
|
|
|
2019-04-10 19:23:56 +00:00
|
|
|
type KeyModifier int
|
|
|
|
|
|
|
|
const (
|
2019-04-11 20:22:23 +00:00
|
|
|
KeyModifierNone KeyModifier = 0
|
2019-04-10 19:23:56 +00:00
|
|
|
KeyModifierShift = 1 << iota
|
|
|
|
KeyModifierControl
|
|
|
|
KeyModifierAlt
|
2020-05-15 07:20:44 +00:00
|
|
|
KeyModifierOSCommand
|
2019-04-10 19:23:56 +00:00
|
|
|
)
|
|
|
|
|
2020-05-15 07:20:44 +00:00
|
|
|
type KeyDownEvent struct {
|
|
|
|
EventBase
|
|
|
|
Key Key
|
|
|
|
Modifiers KeyModifier
|
|
|
|
}
|
|
|
|
|
|
|
|
type KeyUpEvent struct {
|
2019-04-10 19:23:56 +00:00
|
|
|
EventBase
|
|
|
|
Key Key
|
|
|
|
Modifiers KeyModifier
|
|
|
|
}
|
|
|
|
|
2019-03-05 20:52:18 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2019-06-24 19:56:52 +00:00
|
|
|
type MouseEnterEvent struct {
|
|
|
|
MouseEvent
|
|
|
|
}
|
|
|
|
|
2019-03-05 20:52:18 +00:00
|
|
|
type MouseEvent struct {
|
|
|
|
EventBase
|
|
|
|
X, Y float32
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *MouseEvent) Pos() geom.PointF32 {
|
|
|
|
return geom.PtF32(e.X, e.Y)
|
|
|
|
}
|
|
|
|
|
2019-06-24 19:56:52 +00:00
|
|
|
type MouseLeaveEvent struct {
|
|
|
|
MouseEvent
|
|
|
|
}
|
|
|
|
|
2019-03-05 20:52:18 +00:00
|
|
|
type MouseMoveEvent struct {
|
|
|
|
MouseEvent
|
2019-03-05 21:42:57 +00:00
|
|
|
MouseWheel float32
|
2019-03-05 20:52:18 +00:00
|
|
|
}
|
2019-03-13 20:20:31 +00:00
|
|
|
|
|
|
|
type RefreshEvent struct {
|
|
|
|
EventBase
|
|
|
|
}
|
2020-05-15 07:20:44 +00:00
|
|
|
|
|
|
|
type TextInputEvent struct {
|
|
|
|
EventBase
|
|
|
|
Character rune
|
|
|
|
}
|