class

UIng::Area::Handler

Inherits UIng::BlockConstructor < Reference < Object

Drawing and input callbacks with closure support. Area retains the Handler and its Procs; native UserData points back to it. Keep captured native resources unfreed while callbacks use them. Direct LibUI callers must retain the Handler themselves.

handler = Area::Handler.new do draw { |area, params| puts "Drawing..." } key_event { |area, event| true } # Return true if handled end

Constants

SCROLL_CALLBACK = ->(ah : ::Pointer(LibUI::AreaHandler), area : ::Pointer(LibUI::Area), event : ::Pointer(LibUI::AreaScrollEvent)) : LibC::Int do begin handler = ::Box(Handler).unbox(ah.value.user_data) callback = handler.scroll_event_callback || (return 0) area_wrapper = ((ControlRegistry.lookup(area)).as?(Area)) || (Area.new(area, borrowed: true)) callback.call(area_wrapper, Area::ScrollEvent.new(event)) ? 1 : 0 rescue e UIng.handle_callback_error(e, "Area scroll_event") 0 end end

Constructors

new(*args, &)
Source
new(*args, **kwargs, &)
Source
new

ameba:disable Metrics/CyclomaticComplexity

Source

Instance methods

clear_drag_broken
Source
clear_draw
Source
clear_key_event
Source
clear_mouse_crossed
Source
clear_mouse_event
Source
clear_scroll_event
Source
drag_broken
Source
drag_broken(callback : Nil) : Nil
Source
draw
Source
draw(callback : Nil) : Nil
Source
key_event
Source
key_event(callback : Nil) : Nil
Source
mouse_crossed
Source
mouse_crossed(callback : Nil) : Nil
Source
mouse_event
Source
mouse_event(callback : Nil) : Nil
Source
scroll_event

Receives wheel and trackpad movement. Return true to consume it, or false to allow a scrolling Area to scroll normally.

Source
scroll_event(callback : Nil) : Nil
Source
to_unsafe
Source