docs/src/framework.md

20 lines · 1060 bytes

 1# Framework
 2
 3At the core of this TUI, is the framework from the <a href="https://crates.io/crates/tui-additions" target=_blank>`tui-additions`</a> crate, it allows the program to *render* onto the screen, *take inputs* (mouse and keyboard) in an orderly fashion.
 4
 5## Items
 6
 7Items are placed across the screen *in rows*, each item is <u>individual</u> and changing of one should not affect others in anyway.
 8
 9Each item has a set of funcitons (from the trait `FrameworkItem`), or handlers.
10
11|Function|Return type|Purpose|
12|---|---|---|
13|`selectable`|Boolean|Check if the item can be selected, and should the user be able to hover the cursor over the item.<br><br>(E.g. Message bar is not selectable)|
14|`render`|None|The item renders itself within a given area of the screen.|
15|`key_event`|Result|The item handles the keyboard input when it is selected, if an `Err(_)` is returned then the error will be displayed in the message bar.|
16|`mouse_event`|Boolean|The selected item handles the mouse click event when being clicked on.|
17
18Todo...
19
20![](./images/rows.svg)