github.com/jmigpin/editor@v1.6.0/util/uiutil/event/events.go (about) 1 package event 2 3 import ( 4 "image" 5 ) 6 7 type Event interface{} 8 9 //---------- 10 11 type WindowClose struct{} 12 type WindowResize struct{ Rect image.Rectangle } 13 type WindowExpose struct{ Rect image.Rectangle } // empty = full area 14 15 type WindowInput struct { 16 Point image.Point 17 Event Event 18 } 19 20 //---------- 21 22 type MouseEnter struct{} 23 type MouseLeave struct{} 24 25 type MouseDown struct { 26 Point image.Point 27 Button MouseButton 28 Buttons MouseButtons // contains Button 29 Mods KeyModifiers 30 } 31 type MouseUp struct { 32 Point image.Point 33 Button MouseButton 34 Buttons MouseButtons // contains Button 35 Mods KeyModifiers 36 } 37 type MouseMove struct { 38 Point image.Point 39 Buttons MouseButtons 40 Mods KeyModifiers 41 } 42 43 type MouseDragStart struct { 44 Point image.Point // starting (press) point (older then point2) 45 Point2 image.Point // current point (move detection) (newest point) 46 Button MouseButton 47 Buttons MouseButtons // contains Button 48 Mods KeyModifiers 49 } 50 type MouseDragEnd struct { 51 Point image.Point 52 Button MouseButton 53 Buttons MouseButtons // contains Button 54 Mods KeyModifiers 55 } 56 type MouseDragMove struct { 57 Point image.Point 58 Buttons MouseButtons 59 Mods KeyModifiers 60 } 61 62 type MouseClick struct { 63 Point image.Point 64 Button MouseButton 65 Buttons MouseButtons // contains Button 66 Mods KeyModifiers 67 } 68 type MouseDoubleClick struct { 69 Point image.Point 70 Button MouseButton 71 Buttons MouseButtons // contains Button 72 Mods KeyModifiers 73 } 74 type MouseTripleClick struct { 75 Point image.Point 76 Button MouseButton 77 Buttons MouseButtons // contains Button 78 Mods KeyModifiers 79 } 80 81 //---------- 82 83 type KeyDown struct { 84 Point image.Point 85 KeySym KeySym 86 Mods KeyModifiers 87 Buttons MouseButtons 88 Rune rune 89 } 90 91 type KeyUp struct { 92 Point image.Point 93 KeySym KeySym 94 Mods KeyModifiers 95 Buttons MouseButtons 96 Rune rune 97 } 98 99 //---------- 100 101 // drag and drop 102 103 type DndPosition struct { 104 Point image.Point 105 Types []DndType 106 Reply func(DndAction) 107 } 108 type DndDrop struct { 109 Point image.Point 110 ReplyAccept func(bool) 111 RequestData func(DndType) ([]byte, error) 112 } 113 114 type DndAction int 115 116 const ( 117 DndADeny DndAction = iota 118 DndACopy 119 DndAMove 120 DndALink 121 DndAAsk 122 DndAPrivate 123 ) 124 125 type DndType int 126 127 const ( 128 TextURLListDndT DndType = iota // a list separated by '\n' 129 ) 130 131 //---------- 132 133 type ClipboardIndex int 134 135 const ( 136 CIPrimary ClipboardIndex = iota 137 CIClipboard 138 ) 139 140 // Deprecated: in favor of ClipboardIndex 141 type CopyPasteIndex int 142 143 const ( 144 CPIPrimary = CopyPasteIndex(CIPrimary) 145 CPIClipboard = CopyPasteIndex(CIClipboard) 146 ) 147 148 //---------- 149 150 type Handled bool