Updated Container API (markdown)

Jakub Sobon 2019-02-25 23:55:48 -05:00
parent 47841e017f
commit cc281bbb4a
1 changed files with 7 additions and 2 deletions

@ -4,11 +4,16 @@
The [container](https://github.com/mum4k/termdash/tree/master/container) package is used to establish and mutate the layout of the terminal. An instance of the container object is required to start the Termdash application, see the [[Termdash API|termdash-api]] for details.
The container splits the raw terminal into smaller portions (sub-containers). The developer decides how the splits are organised. Design of the container object is heavily inspired by the [i3 window manager](https://i3wm.org/), specifically by how the i3 wm organises the layout of application windows on the screen.
The container splits the raw terminal into smaller portions (sub-containers). The developer decides how the splits are organized. Design of the container object is heavily inspired by the [i3 window manager](https://i3wm.org/), specifically by how the i3 wm organizes the layout of application windows on the screen.
Developers can also use the container to customize the look of the Termdash application.
Apart from organising the terminal layout, the Termdash infrastructure uses the container to call the **Draw** method on all placed widgets and map virtual canvases given to widgets into the raw terminal. The container is also responsible for distributing events to individual widgets.
## Terminal layout
Layout of the terminal is organised in a binary tree structure. Each container is a node in this tree. Unless the node was created empty, it contains one of the following:
Layout of the terminal is organized in a binary tree structure. Each container is a node in this tree. Unless the node was created empty, it contains one of the following:
- two sub-containers; OR
- a widget.