class

Crab::Panel

Inherits Crab::Renderable / Reference / Object

A class to create a panel with a title and text It can be used to create a box with text inside

Constructors

new(width : Int32 = 28, length : Int32 = 7, text : String = "", title : String = "", crab_codes : String = "", box_crab_codes : String = "", hpos : String = "center", vpos : String = "center", style : String = "default")

Create a new Panel object It's parameters are: width: The width of the panel, is possible use Crab.get_cols for this length: The length of the panel, it is the number of lines it will have text: The text to be display inside the panel default is "" title: The title of the panel, it will be displayed on top of the panel, default is "" crab_codes: A string with the crab codes to apply to the text inside the panel, default is "", example "#[red]#[blue, bg]" box_crab_codes: A string with the crab codes to apply to the box of the panel, default is "", example "#[red]#[blue, bg]" hpos: A string to set the horizontal position of the text, it can be right, left or center, defaults to center. vpos: A string to set the vertical position of the text, it can be top, bottom or center, defaults to center. style: A string to set the style of the panel, it can be default, double, ascii, defaults to default.

Source

Instance methods

box_crab_codes
Source
box_crab_codes=(box_crab_codes : String)
Source
crab_codes
Source
crab_codes=(crab_codes : String)
Source
hpos
Source
hpos=(hpos : String)
Source
length
Source
length=(length : Int32)
Source
paragraph_setter(text : String) : String

A method to set paragraphs based on the width of the panel it has 1 parameter, text is the text to set as paragraphs it returns a string with the text set as paragraphs separated by newlines Please do not call this method directly

Source
render

Render the Panel to a String to be Parsed by an Crab::Ansi_Parser, if possible do not call directly

Source
string_setter(text : String, is_title : Bool = false) : String

A method to align text based on the width of the panel it has 2 parameters, text is the text to align, is_title is a boolean that tells if the text is a title, if not passed it defaults to false it returns a string with the text aligned Please do not call this method directly

Source
style
Source
style=(style : String)
Source
text
Source
text=(text : String)
Source
title
Source
title=(title : String)
Source
vpos
Source
vpos=(vpos : String)
Source
width
Source
width=(width : Int32)
Source