module BBS::Window::Events
How a Window takes a keyboard or mouse event: a chain of small handlers, each returning nil when it leaves the event to the next.
Constants
- HANDLERS
-
The handlers
handle_eventtries in order.
Public Instance Methods
Source
# File lib/bbs/window/events.rb, line 27 def handle_event(event) HANDLERS.each do |handler| result = send(handler, event) return result if result end nil end
Handles a keyboard or mouse event for the window, in this order: keyboard move/size mode, an ongoing mouse drag, the ZOOM_KEYS and MOVE_KEYS, left clicks on the gadgets, title bar and size corner (a click elsewhere focuses the focusable widget under it), wheel events for the widget under the pointer, focus keys and the focused widget (a modified arrow or paging key nothing took is retried plain), a button hotkey, and finally close_key.
Returns :close_window when the window should close, :halt or :handled as the widgets return them, or nil when nothing used the event.