class GUI::Component

Included Modules

Direct Known Subclasses

Defined in:

component.cr

Constructors

Instance Method Summary

Macro Summary

Constructor Detail

def self.new(label : String) #

[View source]
def self.new #

[View source]

Instance Method Detail

def animator : GUI::Animator #

[View source]
def 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

[View source]
def children : Array(GUI::Component) #

[View source]
def children=(children : Array(GUI::Component)) #

[View source]
def color : GUI::Color #

[View source]
def color=(color : GUI::Color) #

[View source]
def each(&block : Component -> ) #

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


[View source]
def each_constraint(&block : Kiwi::Constraint -> ) #

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


[View source]
def intersects_point?(x, y) : Bool #

Checks if the component intersects the point x, y


[View source]
def on_hover(event : HoverEvent) #

Executed on the "hover" event.


[View source]
def on_hover(&block : HoverEvent -> ) #

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


[View source]
def on_input(event : InputEvent) #

Executed on the "input" event.


[View source]
def on_input(&block : InputEvent -> ) #

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


[View source]
def on_key_down(event : KeyDownEvent) #

Executed on the "key_down" event.


[View source]
def on_key_down(&block : KeyDownEvent -> ) #

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


[View source]
def on_key_up(event : KeyUpEvent) #

Executed on the "key_up" event.


[View source]
def on_key_up(&block : KeyUpEvent -> ) #

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


[View source]
def on_mouse_down(event : MouseDownEvent) #

Executed on the "mouse_down" event.


[View source]
def on_mouse_down(&block : MouseDownEvent -> ) #

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


[View source]
def on_mouse_in(event : MouseInEvent) #

Executed on the "mouse_in" event.


[View source]
def on_mouse_in(&block : MouseInEvent -> ) #

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


[View source]
def on_mouse_out(event : MouseOutEvent) #

Executed on the "mouse_out" event.


[View source]
def on_mouse_out(&block : MouseOutEvent -> ) #

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


[View source]
def on_mouse_up(event : MouseUpEvent) #

Executed on the "mouse_up" event.


[View source]
def on_mouse_up(&block : MouseUpEvent -> ) #

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


[View source]
def transformation(viewport_height vh, viewport_width vw) #

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


[View source]

Macro Detail

macro method_missing(call) #

[View source]