class

Opal::UI::CharacterGrid

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

Interactive, highly configurable 2D character grid control. Renders regular horizontal and vertical grid lines with customizable intervals, glyph styles (solid, heavy, double, dashed, dotted, crosses, etc.), major/minor lines, panning offsets, interval scaling (zoom), mouse dragging, and coordinate rulers.

Constructors

new(interval_x : Int32 = 8, interval_y : Int32 = 4, offset_x : Int32 = 0, offset_y : Int32 = 0, style : Symbol | Graphics::GridStylePreset | Graphics::GridGlyphs = :solid, fg : Color = Color.hex("#6272A4"), bg : Color = Color.none, intersection_fg : Color | Nil = Color.hex("#8BE9FD"), major_interval_x : Int32 | Nil = nil, major_interval_y : Int32 | Nil = nil, major_fg : Color | Nil = Color.hex("#BD93F9"), show_horizontal : Bool = true, show_vertical : Bool = true, show_coordinates : Bool = false, show_border : Bool = true, border_color : Color = Color.hex("#6272A4"), border_style : Symbol = :rounded, title : String | Nil = "Character Grid", width : Int32 | Nil = 30, height : Int32 | Nil = 12)
Source

Instance methods

adjust_interval(d_x : Int32, d_y : Int32) : Nil

Adjusts grid intervals (zoom)

Source
bg=(bg : Color)
Source
border_color
Source
border_color=(border_color : Color)
Source
border_style
Source
border_style=(border_style : Symbol)
Source
current_style
Source
current_style=(current_style : Graphics::GridStylePreset)
Source
cycle_colors

Cycles between built-in color palettes

Source
cycle_style

Cycles through all 10 available presets

Source
fg=(fg : Color)
Source
glyphs
Source
glyphs=(glyphs : Graphics::GridGlyphs)
Source
handle_key(key : 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
height
Source
height=(height : Int32)
Source
initial_interval_x
Source
initial_interval_x=(initial_interval_x : Int32)
Source
initial_interval_y
Source
initial_interval_y=(initial_interval_y : Int32)
Source
intersection_fg
Source
intersection_fg=(intersection_fg : Color | Nil)
Source
interval_x
Source
interval_x=(interval_x : Int32)
Source
interval_y
Source
interval_y=(interval_y : Int32)
Source
last_h
Source
last_h=(last_h : Int32)
Source
last_w
Source
last_w=(last_w : Int32)
Source
last_x
Source
last_x=(last_x : Int32)
Source
last_y
Source
last_y=(last_y : Int32)
Source
major_fg
Source
major_fg=(major_fg : Color | Nil)
Source
major_interval_x
Source
major_interval_x=(major_interval_x : Int32 | Nil)
Source
major_interval_y
Source
major_interval_y=(major_interval_y : Int32 | Nil)
Source
offset_x
Source
offset_x=(offset_x : Int32)
Source
offset_y
Source
offset_y=(offset_y : Int32)
Source
on_interval_change
Source
on_interval_change=(on_interval_change : Proc(Int32, Int32, Nil) | Nil)
Source
on_pan

Callbacks

Source
on_pan=(on_pan : Proc(Int32, Int32, Nil) | Nil)

Callbacks

Source
on_style_change
Source
on_style_change=(on_style_change : Proc(Graphics::GridStylePreset, Nil) | Nil)
Source
pan(dx : Int32, dy : Int32) : Nil

Pans the grid view by (dx, dy)

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
render(buffer : Buffer) : Nil
Source
reset

Resets pan offsets and intervals to initial creation values

Source
set_style(preset : Graphics::GridStylePreset | Symbol | String) : Nil

Changes the active grid style preset

Source
show_border=(show_border : Bool)
Source
show_border?
Source
show_coordinates=(show_coordinates : Bool)
Source
show_coordinates?
Source
show_horizontal=(show_horizontal : Bool)
Source
show_horizontal?
Source
show_vertical=(show_vertical : Bool)
Source
show_vertical?
Source
title
Source
title=(title : String | Nil)
Source
width
Source
width=(width : Int32)
Source