class Tessell::Kit::Container

Direct Known Subclasses

Defined in:

tessell/kit/container.cr

Constructors

Instance Method Summary

Instance methods inherited from class Tessell::Kit::Component

a11y_active_cell : Bool | Nil a11y_active_cell, a11y_children_count : Int32 | Nil a11y_children_count, a11y_col : Int32 | Nil a11y_col, a11y_col_count : Int32 | Nil a11y_col_count, a11y_col_index_text : String | Nil a11y_col_index_text, a11y_enabled : Bool a11y_enabled, a11y_first_visible_index : Int32 | Nil a11y_first_visible_index, a11y_name : String a11y_name, a11y_role : A11y::Role a11y_role, a11y_row : Int32 | Nil a11y_row, a11y_row_count : Int32 | Nil a11y_row_count, a11y_row_index_text : String | Nil a11y_row_index_text, a11y_scroll_offset : Int32 a11y_scroll_offset, a11y_selected : Bool | Nil a11y_selected, a11y_value : String a11y_value, arrange(ctx : Context, bounds : Rect) : Nil arrange, attach(child : Component) : Component attach, bounds : Rect bounds, bounds=(bounds : Rect) bounds=, clip_bounds : Rect | Nil clip_bounds, collect_components(sink : Array(Component)) : Nil collect_components, dispose : Nil dispose, emit(b : UI::Builder, ctx : Context) : Nil emit, enabled : Bool enabled, enabled=(enabled : Bool) enabled=, focusable? : Bool focusable?, focused : Bool focused, focused=(focused : Bool) focused=, handle(event : Event, ctx : Context) : Bool handle, hit?(point : Point) : Bool hit?, key : UI::UiKey key, mark_structure_dirty : Nil mark_structure_dirty, measure(ctx : Context, constraints : Constraints) : Size measure, on_focus_changed(focused : Bool) : Nil on_focus_changed, paint(p : Painter, ctx : Context) : Nil paint, paint_token : UInt32 paint_token, parent : Component | Nil parent, parent=(value : Component | Nil) : Nil parent=, signal_owner : Tessell::Signal::Owner signal_owner, signal_owner? : Tessell::Signal::Owner | Nil signal_owner?, structure_dirty : Bool structure_dirty, structure_dirty=(structure_dirty : Bool) structure_dirty=, take_structure_dirty : Bool take_structure_dirty, tick(now_ms : Int64, ctx : Context) : Nil tick, tooltip_delay_ms : Int32 tooltip_delay_ms, tooltip_delay_ms=(tooltip_delay_ms : Int32) tooltip_delay_ms=, tooltip_text : String | Nil tooltip_text, tooltip_text=(tooltip_text : String | Nil) tooltip_text=, visible : Bool visible, visible=(visible : Bool) visible=, wants_tab? : Bool wants_tab?, watch(&handler : -> Nil) : Tessell::Signal::Effect watch

Constructor methods inherited from class Tessell::Kit::Component

new(key : UI::UiKey, enabled : Bool = true, visible : Bool = true) new

Constructor Detail

def self.new(key : UI::UiKey, direction : Layout::Direction = Layout::Direction::Vertical, padding : Insets = Insets.new, spacing : Float32 = 0.0_f32, alignment : Alignment = Alignment::Stretch, enabled : Bool = true) #

[View source]

Instance Method Detail

def add(child : Component, grow : Float32) : Component #

便捷重载(issue #49):add 的同时登记弹性权重


[View source]
def add(child : Component) : Component #

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

[View source]
def alignment : Alignment #

[View source]
def alignment=(alignment : Alignment) #

[View source]
def arrange(ctx : Context, bounds : Rect) : Nil #

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

[View source]
def collect_components(sink : Array(Component)) : Nil #
Description copied from class Tessell::Kit::Component

Root 用它遍历整棵树建立 Node ↔ Component 映射。 用显式 sink 而不是递归 block:Crystal 对 yield 转发块会内联展开。


[View source]
def direction : Layout::Direction #

[View source]
def emit(b : UI::Builder, ctx : Context) : Nil #

[View source]
def grow_of(child : Component) : Float32 #

[View source]
def measure(ctx : Context, constraints : Constraints) : Size #

[View source]
def padding : Insets #

[View source]
def padding=(padding : Insets) #

[View source]
def paint(p : Painter, ctx : Context) : Nil #

[View source]
def remove(child : Component) : Bool #

移除子组件(动态树,issue #44):detach + 断父链。返回是否存在。 Root#build 会对移出的组件调用 dispose(停其 Signal Owner)。


[View source]
def set_grow(child : Component, weight : Float32) : Component #

弹性权重(issue #49):weight>0 的子项在主轴有界时按权重分享 「主轴 inner − 固定子项 − spacing」的剩余空间,紧约束(min=max=share, Flutter Expanded 语义);weight<=0 取消。可先 set 后 add。 权重变化打结构脏标记,Root#build 自动补 arrange。


[View source]
def spacing : Float32 #

[View source]
def spacing=(spacing : Float32) #

[View source]