FTXUI 6.1.9 C++ functional terminal UI.

Loading...
Searching...
No Matches
examples/component/resizable_split.cpp
Go to the documentation of this file.
1// Copyright 2020 Arthur Sonzogni. All rights reserved.
2// Use of this source code is governed by the MIT license that can be found in
3// the LICENSE file.
4#include <memory> // for shared_ptr, allocator, __shared_ptr_access
5
6#include "ftxui/component/captured_mouse.hpp" // for ftxui
7#include "ftxui/component/component.hpp" // for Renderer, ResizableSplitBottom, ResizableSplitLeft, ResizableSplitRight, ResizableSplitTop
8#include "ftxui/component/component_base.hpp" // for ComponentBase
9#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
10#include "ftxui/dom/elements.hpp" // for Element, operator|, text, center, border
11
12 using namespace ftxui;
13
14 int main() {
15 auto screen = ScreenInteractive::Fullscreen();
16
17 auto middle = Renderer([] { return text("middle") | center; });
18 auto left = Renderer([] { return text("Left") | center; });
19 auto right = Renderer([] { return text("right") | center; });
20 auto top = Renderer([] { return text("top") | center; });
21 auto bottom = Renderer([] { return text("bottom") | center; });
22
23 int left_size = 20;
24 int right_size = 20;
25 int top_size = 10;
26 int bottom_size = 10;
27
28 auto container = middle;
29 container = ResizableSplitLeft(left, container, &left_size);
30 container = ResizableSplitRight(right, container, &right_size);
31 container = ResizableSplitTop(top, container, &top_size);
32 container = ResizableSplitBottom(bottom, container, &bottom_size);
33
34 auto renderer =
35 Renderer(container, [&] { return container->Render() | border; });
36
37 screen.Loop(renderer);
38}
captured_mouse.hpp
component.hpp
component_base.hpp
elements.hpp
main
int main()
Definition examples/component/resizable_split.cpp:14
ftxui::ScreenInteractive::Fullscreen
static ScreenInteractive Fullscreen()
Definition screen_interactive.cpp:376
ftxui::ResizableSplitTop
Component ResizableSplitTop(Component main, Component back, int *main_size)
An vertical split in between two components, configurable using the mouse.
Definition src/ftxui/component/resizable_split.cpp:283
ftxui::Renderer
Component Renderer(Component child, std::function< Element()>)
Return a new Component, similar to |child|, but using |render| as the Component::Render() event.
Definition src/ftxui/component/renderer.cpp:61
ftxui::ResizableSplitRight
Component ResizableSplitRight(Component main, Component back, int *main_size)
An horizontal split in between two components, configurable using the mouse.
Definition src/ftxui/component/resizable_split.cpp:249
ftxui::ResizableSplitBottom
Component ResizableSplitBottom(Component main, Component back, int *main_size)
An vertical split in between two components, configurable using the mouse.
Definition src/ftxui/component/resizable_split.cpp:317
ftxui::ResizableSplitLeft
Component ResizableSplitLeft(Component main, Component back, int *main_size)
An horizontal split in between two components, configurable using the mouse.
Definition src/ftxui/component/resizable_split.cpp:215
ftxui::center
Element center(Element)
Center an element horizontally and vertically.
Definition composite_decorator.cpp:31
ftxui::text
Element text(std::wstring text)
Display a piece of unicode text.
Definition text.cpp:160
ftxui::border
Element border(Element)
Draw a border around the element.
Definition src/ftxui/dom/border.cpp:227
ftxui
The FTXUI ftxui:: namespace.
Definition animation.hpp:10
top
std::uint8_t top
Definition screen.cpp:130
left
std::uint8_t left
Definition screen.cpp:129
right
std::uint8_t right
Definition screen.cpp:131
screen_interactive.hpp