Skip to content

Latest commit

 

History

History
314 lines (229 loc) · 10.1 KB

QuadLayout.md

File metadata and controls

314 lines (229 loc) · 10.1 KB

Classes

QuadLayout

Constants

CM : ConsoleManager

the instance of ConsoleManager (singleton)

page1Title : string

The application title.

page2Title : string

The title of page2.

page3Title : string

The title of page3.

page4Title : string

The title of page4.

Interfaces

DoubleLayoutOptions : Object

The type containing all the possible options for the QuadLayout.

DoubleLayoutOptions : Object

The type containing all the possible options for the QuadLayout.

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.

[page1Title] string

The title of the first page.

[page2Title] string

The title of the second page.

[page3Title] string

The title of the third page.

[page4Title] string

The title of the fourth page.

[pageRatio] Array.<number>

The ratio of the pages.

[fitHeight] boolean

If the height of the pages should be the same.

QuadLayout

Kind: global class

new QuadLayout(page1, page2, page3, page4, options, selected)

This class is a layout that has two pages.

quad layout

Param Type Description
page1 PageBuilder

The first page.

page2 PageBuilder

The second page.

page3 PageBuilder

The third page.

page4 PageBuilder

The fourth page.

options boolean

Layout options.

selected number

The selected page.

Example

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

quadLayout.setPage(page)

This function is used to overwrite the page content.

Kind: instance method of QuadLayout

Param Type Description
page PageBuilder

the page to be added

quadLayout.setPage1(page)

This function is used to overwrite the first page content.

Kind: instance method of QuadLayout

Param Type Description
page PageBuilder

the page to be added

quadLayout.setPage2(page)

This function is used to overwrite the second page content.

Kind: instance method of QuadLayout

Param Type Description
page PageBuilder

the page to be added

quadLayout.setPage3(page)

This function is used to overwrite the third page content.

Kind: instance method of QuadLayout

Param Type Description
page PageBuilder

the page to be added

quadLayout.setPage4(page)

This function is used to overwrite the forth page content.

Kind: instance method of QuadLayout

Param Type Description
page PageBuilder

the page to be added

quadLayout.setTitles(titles)

This function is used to set the page titles.

Kind: instance method of QuadLayout

Param Type Description
titles Array.<string>

the titles of the pages

Example

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

quadLayout.setTitle(title, index)

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

Kind: instance method of QuadLayout

Param Type Description
title string

the title of the page

index number

the index of the page

Example

layout.setTitle("Page 1", 0)

quadLayout.setBorder(border)

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

Kind: instance method of QuadLayout

Param Type Description
border boolean

enable or disable the border

quadLayout.setSelected(selected)

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

Kind: instance method of QuadLayout

Param Type Description
selected number

0 for page1, 1 for page2

quadLayout.getSelected() ⇒ number

This function is used to get the selected page.

Kind: instance method of QuadLayout
Returns: number -

0 for page1, 1 for page2


quadLayout.changeLayout() ⇒ void

This function is used to get switch the selected page.

Kind: instance method of QuadLayout

quadLayout.setRatio(ratio)

This function is used to change the page ratio.

Kind: instance method of QuadLayout

Param Type Description
ratio Array.<Array.<number>>

the ratio of pages

Example

layout.setRatio([[0.4, 0.6], [0.5, 0.5]])

quadLayout.increaseRatio(quantity)

This function is used to increase the page ratio of the selected row by the given ratio to add.

Kind: instance method of QuadLayout

Param Type Description
quantity number

the ratio to add

Example

layout.increaseRatio(0.01)

quadLayout.decreaseRatio(quantity)

This function is used to decrease the page ratio of the selected row by the given ratio to add.

Kind: instance method of QuadLayout

Param Type Description
quantity number

the ratio to subtract

Example

layout.decreaseRatio(0.01)

quadLayout.drawLine(line, secondLine, row) ⇒ 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 QuadLayout

Param Type Default Description
line Array.<StyledElement>

the line to be drawn

secondLine Array.<StyledElement>

the line to be drawn

row number 0

the row of the quad grid to be drawn

quadLayout.draw() ⇒ void

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

Kind: instance method of QuadLayout
Example

layout.draw()

CM : ConsoleManager

the instance of ConsoleManager (singleton)

Kind: global constant

page1Title : string

The application title.

Kind: global constant

page2Title : string

The title of page2.

Kind: global constant

page3Title : string

The title of page3.

Kind: global constant

page4Title : string

The title of page4.

Kind: global constant