module BBS::Widgets
The stock widgets: labels, buttons, text fields, check boxes, lists and scrolling text, one class per file under widgets/. Each takes the BBS::Widget keyword arguments (id, bounds, theme) besides its own.
Constants
- WHEEL_STEP
-
The mouse wheelβs step: the rows a list or a view moves per notch.
Public Class Methods
Source
# File lib/bbs/widgets.rb, line 16 def self.click_in?(event, bounds) event.mouse? && event.mouse.kind == :press && event.mouse.button == :left && bounds.contains?(event.x, event.y) end
Whether event is a left click inside bounds.
Source
# File lib/bbs/widgets.rb, line 22 def self.wheel(event, bounds) return nil unless event.mouse? && event.mouse.kind == :wheel && bounds.contains?(event.x, event.y) event.mouse.button == :up ? -WHEEL_STEP : WHEEL_STEP end
The rows the mouse wheel of event moves inside bounds: minus WHEEL_STEP up, WHEEL_STEP down; nil for any other event.