Documentation ¶
Overview ¶
Package mouse defines mouse events, for the GoGi GUI system. The most important distinction for mouse events is moving versus static -- many GI elements don't need to know about motion, and they are high-volume events, so it is important to split those out.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DoubleClickMSec = 500
DoubleClickMSec is the maximum time interval in msec between button press events to count as a double-click -- can set this global variable to change. This is also in gi.Prefs and updated from there
var DoubleClickWait = true
DoubleClickWait causes the event system to wait for a possible double-click event before sending single clicks. This causes a delay, but avoids many sources of potential difficulty in dealing with double-clicking, as described here: https://blogs.msdn.microsoft.com/oldnewthing/20041015-00/?p=37553
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action int32
Action taken with the mouse button -- different ones are applicable to different mouse event types
func StringToAction ¶
type DragEvent ¶
type DragEvent struct {
MoveEvent
}
mouse.DragEvent is for mouse movement, with button down -- action is Drag -- many receivers will be interested in Drag events but not Move events, which is why these are separate
type Event ¶
type Event struct { oswin.EventBase // Where is the mouse location, in raw display dots (raw, actual pixels) Where image.Point // Button is the mouse button being pressed or released. Its value may be // ButtonNone (zero), for a mouse move with no button Button Button // Action taken on the mouse button: Press, Release, DoubleClick, Drag or Move Action Action // Modifiers is a bitmask representing a set of modifier keys: // key.ModShift, key.ModAlt, etc. -- bit positions are key.Modifiers Modifiers int32 }
mouse.Event is a basic mouse event for button presses, but not motion or scrolling
func (*Event) SetModifiers ¶
SetModifiers sets the bitflags based on a list of key.Modifiers
type FocusEvent ¶
type FocusEvent struct {
Event
}
mouse.FocusEvent records actions of Enter and Exit of mouse into a given widget bounding box -- generated from mouse.MoveEvents in gi.Window, which knows about widget bounding boxes
func (FocusEvent) Type ¶
func (ev FocusEvent) Type() oswin.EventType
type MoveEvent ¶
type MoveEvent struct { Event // From is the previous location of the mouse From image.Point // LastTime is the time of the previous event LastTime time.Time }
mouse.MoveEvent is for mouse movement, without button down -- action is Move
type ScrollEvent ¶
type ScrollEvent struct { Event // Delta is the amount of scrolling in each axis Delta image.Point }
mouse.ScrollEvent is for mouse scrolling, recording the delta of the scroll
func (ScrollEvent) NonZeroDelta ¶
func (e ScrollEvent) NonZeroDelta(prefX bool) int
NonZeroDelta attempts to find a non-zero delta -- often only get Y dimension scrolling and want to use that for X if prefX is true
func (ScrollEvent) Type ¶
func (ev ScrollEvent) Type() oswin.EventType