events.go 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright 2016 The G3N Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package gui
  5. import (
  6. "github.com/g3n/engine/window"
  7. )
  8. // Core events sent by the GUI manager.
  9. // The target panel is the panel immediately under the mouse cursor.
  10. const (
  11. // Events sent to target panel's lowest subscribed ancestor
  12. OnMouseDown = window.OnMouseDown // Any mouse button is pressed
  13. OnMouseUp = window.OnMouseUp // Any mouse button is released
  14. OnScroll = window.OnScroll // Scrolling mouse wheel
  15. // Events sent to all panels except the ancestors of the target panel
  16. OnMouseDownOut = "gui.OnMouseDownOut" // Any mouse button is pressed
  17. OnMouseUpOut = "gui.OnMouseUpOut" // Any mouse button is released
  18. // Event sent to new target panel and all of its ancestors up to (not including) the common ancestor of the new and old targets
  19. OnCursorEnter = "gui.OnCursorEnter" // Cursor entered the panel or a descendant
  20. // Event sent to old target panel and all of its ancestors up to (not including) the common ancestor of the new and old targets
  21. OnCursorLeave = "gui.OnCursorLeave" // Cursor left the panel or a descendant
  22. // Event sent to the cursor-focused IDispatcher if any, else sent to target panel's lowest subscribed ancestor
  23. OnCursor = window.OnCursor // Cursor is over the panel
  24. // Event sent to the new key-focused IDispatcher, specified on a call to gui.Manager().SetKeyFocus(core.IDispatcher)
  25. OnFocus = "gui.OnFocus" // All keyboard events will be exclusively sent to the receiving IDispatcher
  26. // Event sent to the previous key-focused IDispatcher when another panel is key-focused
  27. OnFocusLost = "gui.OnFocusLost" // Keyboard events will stop being sent to the receiving IDispatcher
  28. // Events sent to the key-focused IDispatcher
  29. OnKeyDown = window.OnKeyDown // A key is pressed
  30. OnKeyUp = window.OnKeyUp // A key is released
  31. OnKeyRepeat = window.OnKeyRepeat // A key was pressed and is now automatically repeating
  32. OnChar = window.OnChar // A unicode key is pressed
  33. )
  34. const (
  35. OnResize = "gui.OnResize" // Panel size changed (no parameters)
  36. OnEnable = "gui.OnEnable" // Panel enabled/disabled (no parameters)
  37. OnClick = "gui.OnClick" // Widget clicked by mouse left button or via key press
  38. OnChange = "gui.OnChange" // Value was changed. Emitted by List, DropDownList, CheckBox and Edit
  39. OnRadioGroup = "gui.OnRadioGroup" // Radio button within a group changed state
  40. )