Sander Schobers
1aad3bf11a
Fixed bug where copy/cut/paste/select all weren't executed. Fixed bug where start/end of selection wasn't properly set when typing. Removed SetClipboard.
85 lines
1.1 KiB
Go
85 lines
1.1 KiB
Go
package ui
|
|
|
|
import "opslag.de/schobers/geom"
|
|
|
|
type DisplayCloseEvent struct {
|
|
EventBase
|
|
}
|
|
|
|
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
|
|
)
|
|
|
|
type KeyPressEvent struct {
|
|
EventBase
|
|
Key Key
|
|
Modifiers KeyModifier
|
|
Character rune
|
|
}
|
|
|
|
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
|
|
}
|