abstract class TUI::Widget

Direct Known Subclasses

Defined in:

tui/widget.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(parent : TUI::Widget | Nil = nil) #

[View source]

Instance Method Detail

def <<(win : Widget) #

[View source]
def app : Application #

[View source]
def app=(app : Application | Nil) #

[View source]
def bind(key : Key | Char, &block : Event::Key -> Bool) : self #

[View source]
def bind(mouse : MouseStatus, &block : Event::Mouse -> Bool) : self #

[View source]
def border : Border #

[View source]
def border=(border : Border | Nil) #

[View source]
def dirty : Bool #

[View source]
def dirty=(v : Bool) #

[View source]
def dirty? : Bool #

[View source]
def dump_tree_rect(io : IO, e : Event::Mouse, far = 0) #

[View source]
def focused : Bool #

[View source]
def focused=(focused : Bool) #

[View source]
def h(*args, **options) #

[View source]
def h(*args, **options, &) #

[View source]
def handle(event : Event::Resize) : Bool #

[View source]
def handle(event : Event::Draw) : Bool #

[View source]
def handle(event : Event::Key) : Bool #

Handle an event:

  • Firstly see if it has been bound
  • Secondly pass to the overwritable key method
  • Then pass to the parent recursively

When there are no parent, false is returned and the event is left unhandled


[View source]
def handle(event : Event::Mouse) : Bool #

ditto


[View source]
def height(w : Int32) : Int32 | Nil #

[View source]
def height : Int32 | Nil #

[View source]
def hover : Tuple(Int32, Int32) | Nil #

[View source]
def hover=(hover : Tuple(Int32, Int32) | Nil) #

[View source]
def key(event : Event::Key) : Bool #

Overwrite to handle other unknown key presses


[View source]
def layout : Layout #

[View source]
def layout=(layout : Layout | Nil) #

[View source]
def mouse(event : Event::Mouse) : Bool #

Overwrite to handle other unknown mouse events


[View source]
def paint(surface : Painter) : Bool #

Override to draw in the widget


[View source]
def parent : Widget | Nil #

[View source]
def parent! : Widget #

[View source]
def parent=(new_parent : TUI::Widget | Nil) #

[View source]
def rect : Rect #

def rect=(rect : Rect) #

[View source]
def rect? : Rect | Nil #

def set_focused(val : Bool) #

[View source]
def set_hover(e : Event::Mouse) #

[View source]
def set_hover(xy : Tuple(Int32, Int32) | Nil) #

[View source]
def tree_focused? : Bool #

[View source]
def unbind(key : Key | Char) : self #

[View source]
def unbind(mouse : MouseStatus) : self #

[View source]
def unbind_all : self #

[View source]
def unbind_keys : self #

[View source]
def unbind_mouse : self #

[View source]
def w(*args, **options) #

[View source]
def w(*args, **options, &) #

[View source]
def width(h : Int32) : Int32 | Nil #

[View source]
def width : Int32 | Nil #

[View source]
def x(*args, **options) #

[View source]
def x(*args, **options, &) #

[View source]
def y(*args, **options) #

[View source]
def y(*args, **options, &) #

[View source]