class GUI::Drawer

Overview

This is a sample composed component

Defined in:

engine.cr

Instance Method Summary

Instance methods inherited from class GUI::Component

animator : GUI::Animator animator, build(display : Component) build, children : Array(GUI::Component) children, children=(children : Array(GUI::Component)) children=, color : GUI::Color color, color=(color : GUI::Color) color=, each(&block : Component -> ) each, each_constraint(&block : Kiwi::Constraint -> ) each_constraint, intersects_point?(x, y) : Bool intersects_point?, on_hover(event : HoverEvent)
on_hover(&block : HoverEvent -> )
on_hover
, on_input(event : InputEvent)
on_input(&block : InputEvent -> )
on_input
, on_key_down(event : KeyDownEvent)
on_key_down(&block : KeyDownEvent -> )
on_key_down
, on_key_up(event : KeyUpEvent)
on_key_up(&block : KeyUpEvent -> )
on_key_up
, on_mouse_down(event : MouseDownEvent)
on_mouse_down(&block : MouseDownEvent -> )
on_mouse_down
, on_mouse_in(event : MouseInEvent)
on_mouse_in(&block : MouseInEvent -> )
on_mouse_in
, on_mouse_out(event : MouseOutEvent)
on_mouse_out(&block : MouseOutEvent -> )
on_mouse_out
, on_mouse_up(event : MouseUpEvent)
on_mouse_up(&block : MouseUpEvent -> )
on_mouse_up
, transformation(viewport_height vh, viewport_width vw) transformation

Constructor methods inherited from class GUI::Component

new(label : String)
new
new

Instance Method Detail

def build(display : Component) #
Description copied from class GUI::Component

Override this to compose complex components.

You'll have access to the root display Component so that you can use the display dimensions in constraints if needed.

When composing your custom component you must add the sub-components to @children otherwise they won't be picked up by the constraint solver.

Example

def build(display : Component)
 child = MySubComponent.new
 # set some constraints...
 @children << child
end

[View source]