Skip to content

Latest commit

 

History

History
222 lines (161 loc) · 7.41 KB

DoubleLayout.md

File metadata and controls

222 lines (161 loc) · 7.41 KB

Classes

DoubleLayout

Constants

CM : ConsoleManager

the instance of ConsoleManager (singleton)

page2Title : string

The title of page2.

page1Title : string

The application title.

Interfaces

DoubleLayoutOptions : Object

The type containing all the possible options for the DoubleLayout.

DoubleLayoutOptions : Object

The type containing all the possible options for the DoubleLayout.

Kind: global interface
Properties

Name Type Description
[showTitle] boolean

If the title should be shown.

[boxed] boolean

If the layout should be boxed.

[boxColor] ForegroundColorName | HEX | RGB | ""

The color of the box taken from the chalk library.

[boxStyle] "bold"

If the border of the box should be bold.

[changeFocusKey] string

The key that should be pressed to change the focus.

[direction] "horizontal" | "vertical"

The direction of the layout.

[page1Title] string

The title of the first page.

[page2Title] string

The title of the second page.

[pageRatio] Array.<number>

The ratio of the pages. (in horizontal direction)

[fitHeight] boolean

If the height of the pages should be the same.

DoubleLayout

Kind: global class

new DoubleLayout(page1, page2, options, selected)

This class is a layout that has two pages.

double layout

Param Type Description
page1 PageBuilder

The first page.

page2 PageBuilder

The second page.

options boolean

Layout options.

selected number

The selected page.

Example

const layout = new DoubleLayout(page1, page2, true, 0)

doubleLayout.setPage(page)

This function is used to overwrite the page content.

Kind: instance method of DoubleLayout

Param Type Description
page PageBuilder

the page to be added

doubleLayout.setPage1(page)

This function is used to overwrite the page content.

Kind: instance method of DoubleLayout

Param Type Description
page PageBuilder

the page to be added

doubleLayout.setPage2(page)

This function is used to overwrite the page content.

Kind: instance method of DoubleLayout

Param Type Description
page PageBuilder

the page to be added

doubleLayout.setTitles(titles)

This function is used to set the page titles.

Kind: instance method of DoubleLayout

Param Type Description
titles Array.<string>

the titles of the pages

Example

layout.setTitles(["Page 1", "Page 2"])

doubleLayout.setTitle(title, index)

This function is used to set the page title at the given index.

Kind: instance method of DoubleLayout

Param Type Description
title string

the title of the page

index number

the index of the page

Example

layout.setTitle("Page 1", 0)

doubleLayout.setBorder(border)

This function is used to enable or disable the layout border.

Kind: instance method of DoubleLayout

Param Type Description
border boolean

enable or disable the border

doubleLayout.setSelected(selected)

This function is used to choose the page to be highlighted.

Kind: instance method of DoubleLayout

Param Type Description
selected number

0 for page1, 1 for page2

doubleLayout.getSelected() ⇒ number

This function is used to get the selected page.

Kind: instance method of DoubleLayout
Returns: number -

0 for page1, 1 for page2


doubleLayout.changeLayout() ⇒ void

This function is used to get switch the selected page.

Kind: instance method of DoubleLayout

doubleLayout.drawLine(line, lineIndex) ⇒ void

This function is used to draw a single line of the layout to the screen. It also trim the line if it is too long.

Kind: instance method of DoubleLayout

Param Type Description
line Array.<StyledElement>

the line to be drawn

lineIndex number

the index of the selected line

doubleLayout.draw() ⇒ void

This function is used to draw the layout to the screen.

Kind: instance method of DoubleLayout
Example

layout.draw()

CM : ConsoleManager

the instance of ConsoleManager (singleton)

Kind: global constant

page2Title : string

The title of page2.

Kind: global constant

page1Title : string

The application title.

Kind: global constant