- 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.
- DoubleLayoutOptions :
Object
The type containing all the possible options for the QuadLayout.
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. |
Kind: global class
- QuadLayout
- new QuadLayout(page1, page2, page3, page4, options, selected)
- .setPage(page)
- .setPage1(page)
- .setPage2(page)
- .setPage3(page)
- .setPage4(page)
- .setTitles(titles)
- .setTitle(title, index)
- .setBorder(border)
- .setSelected(selected)
- .getSelected() ⇒
number
- .changeLayout() ⇒
void
- .setRatio(ratio)
- .increaseRatio(quantity)
- .decreaseRatio(quantity)
- .drawLine(line, secondLine, row) ⇒
void
- .draw() ⇒
void
This class is a layout that has two pages.
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)
This function is used to overwrite the page content.
Kind: instance method of QuadLayout
Param | Type | Description |
---|---|---|
page | PageBuilder |
the page to be added |
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 |
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 |
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 |
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 |
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"])
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)
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 |
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 |
This function is used to get the selected page.
Kind: instance method of QuadLayout
Returns: number
-
0 for page1, 1 for page2
This function is used to get switch the selected page.
Kind: instance method of QuadLayout
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]])
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)
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)
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 |
This function is used to draw the layout to the screen.
Kind: instance method of QuadLayout
Example
layout.draw()
the instance of ConsoleManager (singleton)
The application title.
The title of page2.
The title of page3.
The title of page4.
Kind: global constant