mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-01 21:01:45 +08:00
Improve documentation and examples.
This commit is contained in:
@@ -44,6 +44,6 @@ int main(int argc, const char* argv[]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Copyright 2020 Arthur Sonzogni. All rights reserved.
|
||||
// Copyright 2021 Arthur Sonzogni. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be found in
|
||||
// the LICENSE file.
|
||||
|
@@ -124,18 +124,32 @@ class GridBox : public Node {
|
||||
std::vector<Elements> lines_;
|
||||
};
|
||||
|
||||
/// @brief A container displaying elements horizontally one by one.
|
||||
/// @param children The elements in the container
|
||||
/// @brief A container displaying a grid of elements.
|
||||
/// @param lines A list of lines, each line being a list of elements.
|
||||
/// @return The container.
|
||||
///
|
||||
/// #### Example
|
||||
///
|
||||
/// ```cpp
|
||||
/// hbox({
|
||||
/// text("Left"),
|
||||
/// text("Right"),
|
||||
/// auto cell = [](const char* t) { return text(t) | border; };
|
||||
/// auto document = gridbox({
|
||||
/// {cell("north-west") , cell("north") , cell("north-east")} ,
|
||||
/// {cell("west") , cell("center") , cell("east")} ,
|
||||
/// {cell("south-west") , cell("south") , cell("south-east")} ,
|
||||
/// });
|
||||
/// ```
|
||||
/// Output:
|
||||
/// ```
|
||||
///╭──────────╮╭──────╮╭──────────╮
|
||||
///│north-west││north ││north-east│
|
||||
///╰──────────╯╰──────╯╰──────────╯
|
||||
///╭──────────╮╭──────╮╭──────────╮
|
||||
///│west ││center││east │
|
||||
///╰──────────╯╰──────╯╰──────────╯
|
||||
///╭──────────╮╭──────╮╭──────────╮
|
||||
///│south-west││south ││south-east│
|
||||
///╰──────────╯╰──────╯╰──────────╯
|
||||
/// ```
|
||||
Element gridbox(std::vector<Elements> lines) {
|
||||
return std::make_shared<GridBox>(std::move(lines));
|
||||
}
|
||||
|
Reference in New Issue
Block a user