class

GUI::Component

Inherits GUI::Eventable < Reference < Object

Constructors

new(label : String)
Source

Instance methods

animator
Source
build(display : 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
Source
children
Source
children=(children : Array(GUI::Component))
Source
color
Source
color=(color : GUI::Color)
Source
each

Enumerate over all Components in this Component's hierarchy. This first yields the component itself, then it's children.

Source
each_constraint

Enumerate over all Kiwi::Constraints in this Component's hierarchy

Source
intersects_point?(x, y) : Bool

Checks if the component intersects the point x, y

Source
on_hover(event : HoverEvent)

Executed on the "hover" event.

Source
on_hover

Sets the callback to execute when the hover event is received. The block provided here will be executed within #on_hover.

Source
on_input(event : InputEvent)

Executed on the "input" event.

Source
on_input

Sets the callback to execute when the input event is received. The block provided here will be executed within #on_input.

Source
on_key_down(event : KeyDownEvent)

Executed on the "key_down" event.

Source
on_key_down

Sets the callback to execute when the key_down event is received. The block provided here will be executed within #on_key_down.

Source
on_key_up(event : KeyUpEvent)

Executed on the "key_up" event.

Source
on_key_up

Sets the callback to execute when the key_up event is received. The block provided here will be executed within #on_key_up.

Source
on_mouse_down(event : MouseDownEvent)

Executed on the "mouse_down" event.

Source
on_mouse_down

Sets the callback to execute when the mouse_down event is received. The block provided here will be executed within #on_mouse_down.

Source
on_mouse_in(event : MouseInEvent)

Executed on the "mouse_in" event.

Source
on_mouse_in

Sets the callback to execute when the mouse_in event is received. The block provided here will be executed within #on_mouse_in.

Source
on_mouse_out(event : MouseOutEvent)

Executed on the "mouse_out" event.

Source
on_mouse_out

Sets the callback to execute when the mouse_out event is received. The block provided here will be executed within #on_mouse_out.

Source
on_mouse_up(event : MouseUpEvent)

Executed on the "mouse_up" event.

Source
on_mouse_up

Sets the callback to execute when the mouse_up event is received. The block provided here will be executed within #on_mouse_up.

Source
transformation(viewport_height vh, viewport_width vw)

Generates the matrix transformation used for drawing the component within the viewpoint.

Source

Macros

method_missing(call)
Source

Nested types