class

Opal::UI::GridContainer

Inherits Opal::UI::Control < Opal::UI::InputHookable < Opal::UI::Element < Opal::UI::Themable < Reference < Object

Modern 2D CSS-style Grid container inspired by Python Textual's Grid layout. Distributes cells across rows and columns using fractional (fr) units, fixed widths, spans, and gutters.

Constructors

new(columns : Array(GridTrack | Int32 | Float64 | String) = [GridTrack.fr(1.0)], rows : Array(GridTrack | Int32 | Float64 | String) = [GridTrack.fr(1.0)], gutter_x : Int32 = 1, gutter_y : Int32 = 0)
Source

Instance methods

add(element : Element, col : Int32, row : Int32, col_span : Int32 = 1, row_span : Int32 = 1) : self

Adds child element to specific grid coordinate with optional spans

Source
add(element : Element) : self

Adds child placing it automatically in the next open cell

Source
children

Returns child elements for hierarchical tree traversal and DOM querying

Source
columns
Source
columns=(columns : Array(GridTrack))
Source
compute_col_widths(available_w : Int32) : Array(Int32)

Computes pixel column widths given available width

Source
compute_row_heights(available_h : Int32) : Array(Int32)

Computes pixel row heights given available height

Source
gutter_x
Source
gutter_x=(gutter_x : Int32)
Source
gutter_y
Source
gutter_y=(gutter_y : Int32)
Source
handle_key(event : Terminal::KeyEvent) : Bool

Default key event handler. Override in subclasses if not using @default_input_proc.

Source
handle_mouse(event : Terminal::MouseEvent) : Bool

Default mouse event handler. Override in subclasses if not using @default_input_proc.

Source
items
Source
preferred_size(available_w : Int32, available_h : Int32) : Tuple(Int32, Int32)
Source
render(buffer : Buffer, x : Int32, y : Int32, width : Int32, height : Int32) : Nil
Source
rows
Source
rows=(rows : Array(GridTrack))
Source