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, &)
Sourcenew(*args, **kwargs, &)
SourceInstance methods
clear_drag_broken
Sourceclear_draw
Sourceclear_key_event
Sourceclear_mouse_crossed
Sourceclear_mouse_event
Sourceclear_scroll_event
Sourcedrag_broken
Sourcedrag_broken(callback : Nil) : Nil
Sourcedraw
Sourcedraw(callback : Nil) : Nil
Sourcekey_event
Sourcekey_event(callback : Nil) : Nil
Sourcemouse_crossed
Sourcemouse_crossed(callback : Nil) : Nil
Sourcemouse_event
Sourcemouse_event(callback : Nil) : Nil
Sourcescroll_event
Receives wheel and trackpad movement. Return true to consume it, or false to allow a scrolling Area to scroll normally.
scroll_event(callback : Nil) : Nil
Sourceto_unsafe
Source