Files
FTXUI/examples_2component_2flexbox_gallery_8cpp-example.html

421 lines
43 KiB
HTML
Raw Normal View History

<!-- HTML header for doxygen 1.9.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.12.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>FTXUI: examples/component/flexbox_gallery.cpp</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="doxygen-awesome-fragment-copy-button.js"></script>
<script type="text/javascript" src="doxygen-awesome-paragraph-link.js"></script>
<script type="text/javascript" src="doxygen-awesome-interactive-toc.js"></script>
<script type="text/javascript" src="doxygen-awesome-tabs.js"></script>
<script type="text/javascript">
DoxygenAwesomeFragmentCopyButton.init()
DoxygenAwesomeParagraphLink.init()
DoxygenAwesomeInteractiveToc.init()
DoxygenAwesomeTabs.init()
</script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
<link href="stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">FTXUI<span id="projectnumber">&#160;6.1.9</span>
</div>
<div id="projectbrief">C++ functional terminal UI.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.12.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search',true);
$(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){initNavTree('examples_2component_2flexbox_gallery_8cpp-example.html',''); initResizable(true); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="headertitle"><div class="title">examples/component/flexbox_gallery.cpp</div></div>
</div><!--header-->
<div class="contents">
<h1><a class="anchor" id="autotoc_md174"></a>
focus</h1>
<div class="fragment"><div class="line"><span class="comment">// Copyright 2020 Arthur Sonzogni. All rights reserved.</span></div>
<div class="line"><span class="comment">// Use of this source code is governed by the MIT license that can be found in</span></div>
<div class="line"><span class="comment">// the LICENSE file.</span></div>
<div class="line"><span class="preprocessor">#include &lt;memory&gt;</span> <span class="comment">// for allocator, shared_ptr, __shared_ptr_access</span></div>
<div class="line"><span class="preprocessor">#include &lt;string&gt;</span> <span class="comment">// for operator+, char_traits, to_string, string</span></div>
<div class="line"><span class="preprocessor">#include &lt;vector&gt;</span> <span class="comment">// for vector</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &quot;<a class="code" href="captured__mouse_8hpp.html">ftxui/component/captured_mouse.hpp</a>&quot;</span> <span class="comment">// for ftxui</span></div>
<div class="line"><span class="preprocessor">#include &quot;<a class="code" href="component_8hpp.html">ftxui/component/component.hpp</a>&quot;</span> <span class="comment">// for Slider, Renderer, Vertical</span></div>
<div class="line"><span class="preprocessor">#include &quot;<a class="code" href="component__base_8hpp.html">ftxui/component/component_base.hpp</a>&quot;</span> <span class="comment">// for ComponentBase</span></div>
<div class="line"><span class="preprocessor">#include &quot;<a class="code" href="screen__interactive_8hpp.html">ftxui/component/screen_interactive.hpp</a>&quot;</span> <span class="comment">// for ScreenInteractive</span></div>
<div class="line"><span class="preprocessor">#include &quot;<a class="code" href="elements_8hpp.html">ftxui/dom/elements.hpp</a>&quot;</span> <span class="comment">// for Elements, Element, operator|, separator, text, focusPositionRelative, size, border, flex, frame, bgcolor, gridbox, vbox, EQUAL, center, HEIGHT, WIDTH</span></div>
<div class="line"><span class="preprocessor">#include &quot;<a class="code" href="color_8hpp.html">ftxui/screen/color.hpp</a>&quot;</span> <span class="comment">// for Color</span></div>
<div class="line"> </div>
<div class="line"><span class="keyword">using namespace </span><a class="code hl_namespace" href="namespaceftxui.html">ftxui</a>;</div>
<div class="line"> </div>
<div class="line"><a class="code hl_typedef" href="namespaceftxui.html#a2bc31f2d685189e5c61d2293a1f51b4f">Element</a> <a id="a0" name="a0"></a><a class="code hl_function" href="examples_2component_2focus_8cpp.html#a9ffb8a33ec5d0133f63f791d526df1c7">make_box</a>(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y) {</div>
<div class="line"> std::string title = <span class="stringliteral">&quot;(&quot;</span> + std::to_string(x) + <span class="stringliteral">&quot;, &quot;</span> + std::to_string(y) + <span class="stringliteral">&quot;)&quot;</span>;</div>
<div class="line"> <span class="keywordflow">return</span> text(title) | center | size(WIDTH, EQUAL, 18) |</div>
<div class="line"> size(HEIGHT, EQUAL, 9) | border |</div>
<div class="line"> bgcolor(Color::HSV(x * 255 / 15, 255, y * 255 / 15));</div>
<div class="line">};</div>
<div class="line"> </div>
<div class="line"><a class="code hl_typedef" href="namespaceftxui.html#a2bc31f2d685189e5c61d2293a1f51b4f">Element</a> <a id="a1" name="a1"></a><a class="code hl_function" href="examples_2component_2focus_8cpp.html#a9543e1b98f00db8484ee0c856a1d4cca">make_grid</a>() {</div>
<div class="line"> std::vector&lt;Elements&gt; rows;</div>
<div class="line"> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; 15; i++) {</div>
<div class="line"> std::vector&lt;Element&gt; cols;</div>
<div class="line"> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j &lt; 15; j++) {</div>
<div class="line"> cols.push_back(<a class="code hl_function" href="examples_2component_2focus_8cpp.html#a9ffb8a33ec5d0133f63f791d526df1c7">make_box</a>(i, j));</div>
<div class="line"> }</div>
<div class="line"> rows.push_back(cols);</div>
<div class="line"> }</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">return</span> <a class="code hl_function" href="namespaceftxui.html#abcdf409d605edafd3191cd7ba47bcbd1">gridbox</a>(rows);</div>
<div class="line">};</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> <a id="a2" name="a2"></a><a class="code hl_function" href="examples_2component_2button_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a>() {</div>
<div class="line"> <span class="keywordtype">float</span> focus_x = 0.5f;</div>
<div class="line"> <span class="keywordtype">float</span> focus_y = 0.5f;</div>
<div class="line"> </div>
<div class="line"> <span class="keyword">auto</span> slider_x = <a class="code hl_function" href="namespaceftxui.html#aa3558d992a72679e5e9c9c7b67abd727">Slider</a>(<span class="stringliteral">&quot;x&quot;</span>, &amp;focus_x, 0.f, 1.f, 0.01f);</div>
<div class="line"> <span class="keyword">auto</span> slider_y = <a class="code hl_function" href="namespaceftxui.html#aa3558d992a72679e5e9c9c7b67abd727">Slider</a>(<span class="stringliteral">&quot;y&quot;</span>, &amp;focus_y, 0.f, 1.f, 0.01f);</div>
<div class="line"> </div>
<div class="line"> <span class="keyword">auto</span> renderer = <a class="code hl_function" href="namespaceftxui.html#a533e883e2aeea28de2b60564fcaf0361">Renderer</a>(</div>
<div class="line"> Container::Vertical({</div>
<div class="line"> slider_x,</div>
<div class="line"> slider_y,</div>
<div class="line"> }),</div>
<div class="line"> [&amp;] {</div>
<div class="line"> <span class="keyword">auto</span> title = <span class="stringliteral">&quot;focusPositionRelative(&quot;</span> + <span class="comment">//</span></div>
<div class="line"> std::to_string(focus_x) + <span class="stringliteral">&quot;, &quot;</span> + <span class="comment">//</span></div>
<div class="line"> std::to_string(focus_y) + <span class="stringliteral">&quot;)&quot;</span>; <span class="comment">//</span></div>
<div class="line"> <span class="keywordflow">return</span> <a class="code hl_function" href="namespaceftxui.html#afd28058f0ccbbdf34691a85a7cc9b2e3">vbox</a>({</div>
<div class="line"> <a class="code hl_function" href="namespaceftxui.html#a75baaa2734ed76a9f478beaafa87ae57">text</a>(title),</div>
<div class="line"> <a class="code hl_function" href="namespaceftxui.html#ac1ef1cf6bf7cd0759ffa195071edb2a0">separator</a>(),</div>
<div class="line"> slider_x-&gt;Render(),</div>
<div class="line"> slider_y-&gt;Render(),</div>
<div class="line"> <a class="code hl_function" href="namespaceftxui.html#ac1ef1cf6bf7cd0759ffa195071edb2a0">separator</a>(),</div>
<div class="line"> <a class="code hl_function" href="examples_2component_2focus_8cpp.html#a9543e1b98f00db8484ee0c856a1d4cca">make_grid</a>() | <a class="code hl_function" href="namespaceftxui.html#a13befad33cb4125e2143f2af3eddcc71">focusPositionRelative</a>(focus_x, focus_y) |</div>
<div class="line"> <a class="code hl_function" href="namespaceftxui.html#ad0d6a96f6e1fb6d67d9fa6323062a737">frame</a> | <a class="code hl_function" href="namespaceftxui.html#a257acd2bd47bab7db879cca2c0e67e23">flex</a>,</div>
<div class="line"> }) |</div>
<div class="line"> border;</div>
<div class="line"> });</div>
<div class="line"> </div>
<div class="line"> <span class="keyword">auto</span> screen = ScreenInteractive::Fullscreen();</div>
<div class="line"> screen.Loop(renderer);</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">return</span> 0;</div>
<div class="line">}</div>
<div class="ttc" id="acaptured__mouse_8hpp_html"><div class="ttname"><a href="captured__mouse_8hpp.html">captured_mouse.hpp</a></div></div>
<div class="ttc" id="acolor_8hpp_html"><div class="ttname"><a href="color_8hpp.html">color.hpp</a></div></div>
<div class="ttc" id="acomponent_8hpp_html"><div class="ttname"><a href="component_8hpp.html">component.hpp</a></div></div>
<div class="ttc" id="acomponent__base_8hpp_html"><div class="ttname"><a href="component__base_8hpp.html">component_base.hpp</a></div></div>
<div class="ttc" id="aelements_8hpp_html"><div class="ttname"><a href="elements_8hpp.html">elements.hpp</a></div></div>
<div class="ttc" id="aexamples_2component_2button_8cpp_html_ae66f6b31b5ad750f1fe042a706a4e3d4"><div class="ttname"><a href="examples_2component_2button_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a></div><div class="ttdeci">int main()</div><div class="ttdef"><b>Definition</b> <a href="examples_2component_2button_8cpp_source.html#l00004">examples/component/button.cpp:4</a></div></div>
<div class="ttc" id="aexamples_2component_2focus_8cpp_html_a9543e1b98f00db8484ee0c856a1d4cca"><div class="ttname"><a href="examples_2component_2focus_8cpp.html#a9543e1b98f00db8484ee0c856a1d4cca">make_grid</a></div><div class="ttdeci">Element make_grid()</div><div class="ttdef"><b>Definition</b> <a href="examples_2component_2focus_8cpp_source.html#l00024">examples/component/focus.cpp:24</a></div></div>
<div class="ttc" id="aexamples_2component_2focus_8cpp_html_a9ffb8a33ec5d0133f63f791d526df1c7"><div class="ttname"><a href="examples_2component_2focus_8cpp.html#a9ffb8a33ec5d0133f63f791d526df1c7">make_box</a></div><div class="ttdeci">Element make_box(int x, int y)</div><div class="ttdef"><b>Definition</b> <a href="examples_2component_2focus_8cpp_source.html#l00017">examples/component/focus.cpp:17</a></div></div>
<div class="ttc" id="anamespaceftxui_html"><div class="ttname"><a href="namespaceftxui.html">ftxui</a></div><div class="ttdef"><b>Definition</b> <a href="animation_8hpp_source.html#l00010">animation.hpp:10</a></div></div>
<div class="ttc" id="anamespaceftxui_html_a13befad33cb4125e2143f2af3eddcc71"><div class="ttname"><a href="namespaceftxui.html#a13befad33cb4125e2143f2af3eddcc71">ftxui::focusPositionRelative</a></div><div class="ttdeci">Decorator focusPositionRelative(float x, float y)</div><div class="ttdoc">Used inside a frame, this force the view to be scrolled toward a a given position....</div><div class="ttdef"><b>Definition</b> <a href="src_2ftxui_2dom_2focus_8cpp_source.html#l00031">src/ftxui/dom/focus.cpp:31</a></div></div>
<div class="ttc" id="anamespaceftxui_html_a257acd2bd47bab7db879cca2c0e67e23"><div class="ttname"><a href="namespaceftxui.html#a257acd2bd47bab7db879cca2c0e67e23">ftxui::flex</a></div><div class="ttdeci">Element flex(Element)</div><div class="ttdoc">Make a child element to expand proportionally to the space left in a container.</div><div class="ttdef"><b>Definition</b> <a href="flex_8cpp_source.html#l00123">flex.cpp:123</a></div></div>
<div class="ttc" id="anamespaceftxui_html_a2bc31f2d685189e5c61d2293a1f51b4f"><div class="ttname"><a href="namespaceftxui.html#a2bc31f2d685189e5c61d2293a1f51b4f">ftxui::Element</a></div><div class="ttdeci">std::shared_ptr&lt; Node &gt; Element</div><div class="ttdef"><b>Definition</b> <a href="elements_8hpp_source.html#l00022">elements.hpp:22</a></div></div>
<div class="ttc" id="anamespaceftxui_html_a533e883e2aeea28de2b60564fcaf0361"><div class="ttname"><a href="namespaceftxui.html#a533e883e2aeea28de2b60564fcaf0361">ftxui::Renderer</a></div><div class="ttdeci">Component Renderer(Component child, std::function&lt; Element()&gt;)</div><div class="ttdoc">Return a new Component, similar to |child|, but using |render| as the Component::Render() event.</div><div class="ttdef"><b>Definition</b> <a href="src_2ftxui_2component_2renderer_8cpp_source.html#l00061">src/ftxui/component/renderer.cpp:61</a></div></div>
<div class="ttc" id="anamespaceftxui_html_a75baaa2734ed76a9f478beaafa87ae57"><div class="ttname"><a href="namespaceftxui.html#a75baaa2734ed76a9f478beaafa87ae57">ftxui::text</a></div><div class="ttdeci">Element text(std::wstring text)</div><div class="ttdoc">Display a piece of unicode text.</div><div class="ttdef"><b>Definition</b> <a href="text_8cpp_source.html#l00160">text.cpp:160</a></div></div>
<div class="ttc" id="anamespaceftxui_html_aa3558d992a72679e5e9c9c7b67abd727"><div class="ttname"><a href="namespaceftxui.html#aa3558d992a72679e5e9c9c7b67abd727">ftxui::Slider</a></div><div class="ttdeci">Component Slider(SliderOption&lt; T &gt; options)</div><div class="ttdoc">A slider in any direction.</div><div class="ttdef"><b>Definition</b> <a href="src_2ftxui_2component_2slider_8cpp_source.html#l00346">src/ftxui/component/slider.cpp:346</a></div></div>
<div class="ttc" id="anamespaceftxui_html_abcdf409d605edafd3191cd7ba47bcbd1"><div class="ttname"><a href="namespaceftxui.html#abcdf409d605edafd3191cd7ba47bcbd1">ftxui::gridbox</a></div><div class="ttdeci">Element gridbox(std::vector&lt; Elements &gt; lines)</div><div class="ttdoc">A container displaying a grid of elements.</div><div class="ttdef"><b>Definition</b> <a href="src_2ftxui_2dom_2gridbox_8cpp_source.html#l00173">src/ftxui/dom/gridbox.cpp:173</a></div></div>
<div class="ttc" id="anamespaceftxui_html_ac1ef1cf6bf7cd0759ffa195071edb2a0"><div class="ttname"><a href="namespaceftxui.html#ac1ef1cf6bf7cd0759ffa195071edb2a0">ftxui::separator</a></div><div class="ttdeci">Element separator()</div><div class="ttdoc">Draw a vertical or horizontal separation in between two other elements.</div><div class="ttdef"><b>Definition</b> <a href="src_2ftxui_2dom_2separator_8cpp_source.html#l00134">src/ftxui/dom/separator.cpp:134</a></div></div>
<div class="ttc" id="anamespaceftxui_html_ad0d6a96f6e1fb6d67d9fa6323062a737"><div class="ttname"><a href="namespaceftxui.html#ad0d6a96f6e1fb6d67d9fa6323062a737">ftxui::frame</a></div><div class="ttdeci">Element frame(Element)</div><div class="ttdoc">Allow an element to be displayed inside a 'virtual' area. It size can be larger than its container....</div><div class="ttdef"><b>Definition</b> <a href="frame_8cpp_source.html#l00118">frame.cpp:118</a></div></div>
<div class="ttc" id="anamespaceftxui_html_afd28058f0ccbbdf34691a85a7cc9b2e3"><div class="ttname"><a href="namespaceftxui.html#afd28058f0ccbbdf34691a85a7cc9b2e3">ftxui::vbox</a></div><div class="ttdeci">Element vbox(Elements)</div><div class="ttdoc">A container displaying elements vertically one by one.</div><div class="ttdef"><b>Definition</b> <a href="vbox_8cpp_source.html#l00096">vbox.cpp:96</a></div></div>
<div class="ttc" id="ascreen__interactive_8hpp_html"><div class="ttname"><a href="screen__interactive_8hpp.html">screen_interactive.hpp</a></div></div>
</div><!-- fragment --><div class="fragment"><div class="line"><span class="comment">// Copyright 2020 Arthur Sonzogni. All rights reserved.</span></div>
<div class="line"><span class="comment">// Use of this source code is governed by the MIT license that can be found in</span></div>
<div class="line"><span class="comment">// the LICENSE file.</span></div>
<div class="line"><span class="preprocessor">#include &lt;stddef.h&gt;</span> <span class="comment">// for size_t</span></div>
<div class="line"><span class="preprocessor">#include &lt;memory&gt;</span> <span class="comment">// for shared_ptr, __shared_ptr_access, allocator</span></div>
<div class="line"><span class="preprocessor">#include &lt;string&gt;</span> <span class="comment">// for string, basic_string, to_string, operator+, char_traits</span></div>
<div class="line"><span class="preprocessor">#include &lt;vector&gt;</span> <span class="comment">// for vector</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &quot;<a class="code" href="captured__mouse_8hpp.html">ftxui/component/captured_mouse.hpp</a>&quot;</span> <span class="comment">// for ftxui</span></div>
<div class="line"><span class="preprocessor">#include &quot;<a class="code" href="component_8hpp.html">ftxui/component/component.hpp</a>&quot;</span> <span class="comment">// for Radiobox, Vertical, Checkbox, Horizontal, Renderer, ResizableSplitBottom, ResizableSplitRight</span></div>
<div class="line"><span class="preprocessor">#include &quot;<a class="code" href="component__base_8hpp.html">ftxui/component/component_base.hpp</a>&quot;</span> <span class="comment">// for ComponentBase</span></div>
<div class="line"><span class="preprocessor">#include &quot;<a class="code" href="screen__interactive_8hpp.html">ftxui/component/screen_interactive.hpp</a>&quot;</span> <span class="comment">// for ScreenInteractive</span></div>
<div class="line"><span class="preprocessor">#include &quot;<a class="code" href="elements_8hpp.html">ftxui/dom/elements.hpp</a>&quot;</span> <span class="comment">// for text, window, operator|, vbox, hbox, Element, flexbox, bgcolor, filler, flex, size, border, hcenter, color, EQUAL, bold, dim, notflex, xflex_grow, yflex_grow, HEIGHT, WIDTH</span></div>
<div class="line"><span class="preprocessor">#include &quot;<a class="code" href="flexbox__config_8hpp.html">ftxui/dom/flexbox_config.hpp</a>&quot;</span> <span class="comment">// for FlexboxConfig, FlexboxConfig::AlignContent, FlexboxConfig::JustifyContent, FlexboxConfig::AlignContent::Center, FlexboxConfig::AlignItems, FlexboxConfig::Direction, FlexboxConfig::JustifyContent::Center, FlexboxConfig::Wrap</span></div>
<div class="line"><span class="preprocessor">#include &quot;<a class="code" href="color_8hpp.html">ftxui/screen/color.hpp</a>&quot;</span> <span class="comment">// for Color, Color::Black</span></div>
<div class="line"> </div>
<div class="line"><span class="keyword">using namespace </span><a class="code hl_namespace" href="namespaceftxui.html">ftxui</a>;</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> <a class="code hl_function" href="examples_2component_2button_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a>() {</div>
<div class="line"> <span class="keyword">auto</span> screen = ScreenInteractive::Fullscreen();</div>
<div class="line"> </div>
<div class="line"> <span class="keywordtype">int</span> direction_index = 0;</div>
<div class="line"> <span class="keywordtype">int</span> wrap_index = 0;</div>
<div class="line"> <span class="keywordtype">int</span> justify_content_index = 0;</div>
<div class="line"> <span class="keywordtype">int</span> align_items_index = 0;</div>
<div class="line"> <span class="keywordtype">int</span> align_content_index = 0;</div>
<div class="line"> </div>
<div class="line"> std::vector&lt;std::string&gt; directions = {</div>
<div class="line"> <span class="stringliteral">&quot;Row&quot;</span>,</div>
<div class="line"> <span class="stringliteral">&quot;RowInversed&quot;</span>,</div>
<div class="line"> <span class="stringliteral">&quot;Column&quot;</span>,</div>
<div class="line"> <span class="stringliteral">&quot;ColumnInversed&quot;</span>,</div>
<div class="line"> };</div>
<div class="line"> </div>
<div class="line"> std::vector&lt;std::string&gt; wraps = {</div>
<div class="line"> <span class="stringliteral">&quot;NoWrap&quot;</span>,</div>
<div class="line"> <span class="stringliteral">&quot;Wrap&quot;</span>,</div>
<div class="line"> <span class="stringliteral">&quot;WrapInversed&quot;</span>,</div>
<div class="line"> };</div>
<div class="line"> </div>
<div class="line"> std::vector&lt;std::string&gt; justify_content = {</div>
<div class="line"> <span class="stringliteral">&quot;FlexStart&quot;</span>, <span class="stringliteral">&quot;FlexEnd&quot;</span>, <span class="stringliteral">&quot;Center&quot;</span>, <span class="stringliteral">&quot;Stretch&quot;</span>,</div>
<div class="line"> <span class="stringliteral">&quot;SpaceBetween&quot;</span>, <span class="stringliteral">&quot;SpaceAround&quot;</span>, <span class="stringliteral">&quot;SpaceEvenly&quot;</span>,</div>
<div class="line"> };</div>
<div class="line"> </div>
<div class="line"> std::vector&lt;std::string&gt; align_items = {</div>
<div class="line"> <span class="stringliteral">&quot;FlexStart&quot;</span>,</div>
<div class="line"> <span class="stringliteral">&quot;FlexEnd&quot;</span>,</div>
<div class="line"> <span class="stringliteral">&quot;Center&quot;</span>,</div>
<div class="line"> <span class="stringliteral">&quot;Stretch&quot;</span>,</div>
<div class="line"> };</div>
<div class="line"> </div>
<div class="line"> std::vector&lt;std::string&gt; align_content = {</div>
<div class="line"> <span class="stringliteral">&quot;FlexStart&quot;</span>, <span class="stringliteral">&quot;FlexEnd&quot;</span>, <span class="stringliteral">&quot;Center&quot;</span>, <span class="stringliteral">&quot;Stretch&quot;</span>,</div>
<div class="line"> <span class="stringliteral">&quot;SpaceBetween&quot;</span>, <span class="stringliteral">&quot;SpaceAround&quot;</span>, <span class="stringliteral">&quot;SpaceEvenly&quot;</span>,</div>
<div class="line"> };</div>
<div class="line"> </div>
<div class="line"> <span class="keyword">auto</span> radiobox_direction = Radiobox(&amp;directions, &amp;direction_index);</div>
<div class="line"> <span class="keyword">auto</span> radiobox_wrap = Radiobox(&amp;wraps, &amp;wrap_index);</div>
<div class="line"> <span class="keyword">auto</span> radiobox_justify_content =</div>
<div class="line"> Radiobox(&amp;justify_content, &amp;justify_content_index);</div>
<div class="line"> <span class="keyword">auto</span> radiobox_align_items = Radiobox(&amp;align_items, &amp;align_items_index);</div>
<div class="line"> <span class="keyword">auto</span> radiobox_align_content = Radiobox(&amp;align_content, &amp;align_content_index);</div>
<div class="line"> </div>
<div class="line"> <span class="keywordtype">bool</span> element_xflex_grow = <span class="keyword">false</span>;</div>
<div class="line"> <span class="keywordtype">bool</span> element_yflex_grow = <span class="keyword">false</span>;</div>
<div class="line"> <span class="keywordtype">bool</span> group_xflex_grow = <span class="keyword">true</span>;</div>
<div class="line"> <span class="keywordtype">bool</span> group_yflex_grow = <span class="keyword">true</span>;</div>
<div class="line"> <span class="keyword">auto</span> checkbox_element_xflex_grow =</div>
<div class="line"> Checkbox(<span class="stringliteral">&quot;element |= xflex_grow&quot;</span>, &amp;element_xflex_grow);</div>
<div class="line"> <span class="keyword">auto</span> checkbox_element_yflex_grow =</div>
<div class="line"> Checkbox(<span class="stringliteral">&quot;element |= yflex_grow&quot;</span>, &amp;element_yflex_grow);</div>
<div class="line"> <span class="keyword">auto</span> checkbox_group_xflex_grow =</div>
<div class="line"> Checkbox(<span class="stringliteral">&quot;group |= xflex_grow&quot;</span>, &amp;group_xflex_grow);</div>
<div class="line"> <span class="keyword">auto</span> checkbox_group_yflex_grow =</div>
<div class="line"> Checkbox(<span class="stringliteral">&quot;group |= yflex_grow&quot;</span>, &amp;group_yflex_grow);</div>
<div class="line"> </div>
<div class="line"> <span class="keyword">auto</span> <a class="code hl_function" href="examples_2component_2focus_8cpp.html#a9ffb8a33ec5d0133f63f791d526df1c7">make_box</a> = [&amp;](<span class="keywordtype">size_t</span> dimx, <span class="keywordtype">size_t</span> dimy, <span class="keywordtype">size_t</span> index) {</div>
<div class="line"> std::string title = std::to_string(dimx) + <span class="stringliteral">&quot;x&quot;</span> + std::to_string(dimy);</div>
<div class="line"> <span class="keyword">auto</span> element = window(text(title) | hcenter | bold,</div>
<div class="line"> text(std::to_string(index)) | hcenter | dim) |</div>
<div class="line"> size(WIDTH, EQUAL, dimx) | size(HEIGHT, EQUAL, dimy) |</div>
<div class="line"> bgcolor(Color::HSV(index * 25, 255, 255)) |</div>
<div class="line"> color(Color::Black);</div>
<div class="line"> <span class="keywordflow">if</span> (element_xflex_grow)</div>
<div class="line"> element = element | xflex_grow;</div>
<div class="line"> <span class="keywordflow">if</span> (element_yflex_grow)</div>
<div class="line"> element = element | yflex_grow;</div>
<div class="line"> <span class="keywordflow">return</span> element;</div>
<div class="line"> };</div>
<div class="line"> </div>
<div class="line"> <span class="keyword">auto</span> content_renderer = Renderer([&amp;] {</div>
<div class="line"> <a id="_a3" name="_a3"></a><a class="code hl_struct" href="structftxui_1_1FlexboxConfig.html">FlexboxConfig</a> config;</div>
<div class="line"> config.<a id="a4" name="a4"></a><a class="code hl_variable" href="structftxui_1_1FlexboxConfig.html#a53421c695d00016ab925777d423b4eb6">direction</a> = <span class="keyword">static_cast&lt;</span><a class="code hl_enumeration" href="structftxui_1_1FlexboxConfig.html#a224b9163917ac32fc95a60d8c1eec3aa">FlexboxConfig::Direction</a><span class="keyword">&gt;</span>(direction_index);</div>
<div class="line"> config.<a id="a5" name="a5"></a><a class="code hl_variable" href="structftxui_1_1FlexboxConfig.html#a68b5470ece4f0a492cc1d2057c9bd5e0">wrap</a> = <span class="keyword">static_cast&lt;</span><a class="code hl_enumeration" href="structftxui_1_1FlexboxConfig.html#a6c844a611650cf7e956dbe269a0e72ab">FlexboxConfig::Wrap</a><span class="keyword">&gt;</span>(wrap_index);</div>
<div class="line"> config.<a id="a6" name="a6"></a><a class="code hl_variable" href="structftxui_1_1FlexboxConfig.html#ab3173252829e796ee1c100b447243748">justify_content</a> =</div>
<div class="line"> <span class="keyword">static_cast&lt;</span><a class="code hl_enumeration" href="structftxui_1_1FlexboxConfig.html#ac6e5ab18dcac465ee2ac9a0d8b4a82d2">FlexboxConfig::JustifyContent</a><span class="keyword">&gt;</span>(justify_content_index);</div>
<div class="line"> config.<a id="a7" name="a7"></a><a class="code hl_variable" href="structftxui_1_1FlexboxConfig.html#a1514fd3d64965c521555fdc2cf2002ce">align_items</a> =</div>
<div class="line"> <span class="keyword">static_cast&lt;</span><a class="code hl_enumeration" href="structftxui_1_1FlexboxConfig.html#a821af961ece5fe13540ad48b54c7a9e7">FlexboxConfig::AlignItems</a><span class="keyword">&gt;</span>(align_items_index);</div>
<div class="line"> config.<a id="a8" name="a8"></a><a class="code hl_variable" href="structftxui_1_1FlexboxConfig.html#a103275cb09167852e469450cf8471256">align_content</a> =</div>
<div class="line"> <span class="keyword">static_cast&lt;</span><a class="code hl_enumeration" href="structftxui_1_1FlexboxConfig.html#a1f99410fd0fc632a5bc2497b6a447420">FlexboxConfig::AlignContent</a><span class="keyword">&gt;</span>(align_content_index);</div>
<div class="line"> </div>
<div class="line"> <span class="keyword">auto</span> group = flexbox(</div>
<div class="line"> {</div>
<div class="line"> <a class="code hl_function" href="examples_2component_2focus_8cpp.html#a9ffb8a33ec5d0133f63f791d526df1c7">make_box</a>(8, 4, 0),</div>
<div class="line"> <a class="code hl_function" href="examples_2component_2focus_8cpp.html#a9ffb8a33ec5d0133f63f791d526df1c7">make_box</a>(9, 6, 1),</div>
<div class="line"> <a class="code hl_function" href="examples_2component_2focus_8cpp.html#a9ffb8a33ec5d0133f63f791d526df1c7">make_box</a>(11, 6, 2),</div>
<div class="line"> <a class="code hl_function" href="examples_2component_2focus_8cpp.html#a9ffb8a33ec5d0133f63f791d526df1c7">make_box</a>(10, 4, 3),</div>
<div class="line"> <a class="code hl_function" href="examples_2component_2focus_8cpp.html#a9ffb8a33ec5d0133f63f791d526df1c7">make_box</a>(13, 7, 4),</div>
<div class="line"> <a class="code hl_function" href="examples_2component_2focus_8cpp.html#a9ffb8a33ec5d0133f63f791d526df1c7">make_box</a>(12, 4, 5),</div>
<div class="line"> <a class="code hl_function" href="examples_2component_2focus_8cpp.html#a9ffb8a33ec5d0133f63f791d526df1c7">make_box</a>(12, 5, 6),</div>
<div class="line"> <a class="code hl_function" href="examples_2component_2focus_8cpp.html#a9ffb8a33ec5d0133f63f791d526df1c7">make_box</a>(10, 4, 7),</div>
<div class="line"> <a class="code hl_function" href="examples_2component_2focus_8cpp.html#a9ffb8a33ec5d0133f63f791d526df1c7">make_box</a>(12, 4, 8),</div>
<div class="line"> <a class="code hl_function" href="examples_2component_2focus_8cpp.html#a9ffb8a33ec5d0133f63f791d526df1c7">make_box</a>(10, 5, 9),</div>
<div class="line"> },</div>
<div class="line"> config);</div>
<div class="line"> </div>
<div class="line"> group = group | bgcolor(Color::Black);</div>
<div class="line"> </div>
<div class="line"> group = group | notflex;</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">if</span> (!group_xflex_grow)</div>
<div class="line"> group = hbox(group, filler());</div>
<div class="line"> <span class="keywordflow">if</span> (!group_yflex_grow)</div>
<div class="line"> group = vbox(group, filler());</div>
<div class="line"> </div>
<div class="line"> group = group | flex;</div>
<div class="line"> <span class="keywordflow">return</span> group;</div>
<div class="line"> });</div>
<div class="line"> </div>
<div class="line"> <span class="keyword">auto</span> center = <a class="code hl_struct" href="structftxui_1_1FlexboxConfig.html">FlexboxConfig</a>()</div>
<div class="line"> .<a id="a9" name="a9"></a><a class="code hl_function" href="structftxui_1_1FlexboxConfig.html#ae47b5b0d793d0c2312e4805a1f40012a">Set</a>(FlexboxConfig::JustifyContent::Center)</div>
<div class="line"> .<a class="code hl_function" href="structftxui_1_1FlexboxConfig.html#ae47b5b0d793d0c2312e4805a1f40012a">Set</a>(FlexboxConfig::AlignContent::Center);</div>
<div class="line"> <span class="keywordtype">int</span> space_right = 10;</div>
<div class="line"> <span class="keywordtype">int</span> space_bottom = 1;</div>
<div class="line"> content_renderer = ResizableSplitRight(</div>
<div class="line"> Renderer([&amp;] { <span class="keywordflow">return</span> flexbox({text(<span class="stringliteral">&quot;resizable&quot;</span>)}, center); }),</div>
<div class="line"> content_renderer, &amp;space_right);</div>
<div class="line"> content_renderer = ResizableSplitBottom(</div>
<div class="line"> Renderer([&amp;] { <span class="keywordflow">return</span> flexbox({text(<span class="stringliteral">&quot;resizable&quot;</span>)}, center); }),</div>
<div class="line"> content_renderer, &amp;space_bottom);</div>
<div class="line"> </div>
<div class="line"> <span class="keyword">auto</span> main_container = Container::Vertical({</div>
<div class="line"> Container::Horizontal({</div>
<div class="line"> radiobox_direction,</div>
<div class="line"> radiobox_wrap,</div>
<div class="line"> Container::Vertical({</div>
<div class="line"> checkbox_element_xflex_grow,</div>
<div class="line"> checkbox_element_yflex_grow,</div>
<div class="line"> checkbox_group_xflex_grow,</div>
<div class="line"> checkbox_group_yflex_grow,</div>
<div class="line"> }),</div>
<div class="line"> }),</div>
<div class="line"> Container::Horizontal({</div>
<div class="line"> radiobox_justify_content,</div>
<div class="line"> radiobox_align_items,</div>
<div class="line"> radiobox_align_content,</div>
<div class="line"> }),</div>
<div class="line"> content_renderer,</div>
<div class="line"> });</div>
<div class="line"> </div>
<div class="line"> <span class="keyword">auto</span> main_renderer = Renderer(main_container, [&amp;] {</div>
<div class="line"> <span class="keywordflow">return</span> vbox({</div>
<div class="line"> vbox({hbox({</div>
<div class="line"> window(text(<span class="stringliteral">&quot;FlexboxConfig::Direction&quot;</span>),</div>
<div class="line"> radiobox_direction-&gt;Render()),</div>
<div class="line"> window(text(<span class="stringliteral">&quot;FlexboxConfig::Wrap&quot;</span>), radiobox_wrap-&gt;Render()),</div>
<div class="line"> window(text(<span class="stringliteral">&quot;Misc:&quot;</span>),</div>
<div class="line"> vbox({</div>
<div class="line"> checkbox_element_xflex_grow-&gt;Render(),</div>
<div class="line"> checkbox_element_yflex_grow-&gt;Render(),</div>
<div class="line"> checkbox_group_xflex_grow-&gt;Render(),</div>
<div class="line"> checkbox_group_yflex_grow-&gt;Render(),</div>
<div class="line"> })),</div>
<div class="line"> }),</div>
<div class="line"> hbox({</div>
<div class="line"> window(text(<span class="stringliteral">&quot;FlexboxConfig::JustifyContent&quot;</span>),</div>
<div class="line"> radiobox_justify_content-&gt;Render()),</div>
<div class="line"> window(text(<span class="stringliteral">&quot;FlexboxConfig::AlignItems&quot;</span>),</div>
<div class="line"> radiobox_align_items-&gt;Render()),</div>
<div class="line"> window(text(<span class="stringliteral">&quot;FlexboxConfig::AlignContent&quot;</span>),</div>
<div class="line"> radiobox_align_content-&gt;Render()),</div>
<div class="line"> })}),</div>
<div class="line"> content_renderer-&gt;Render() | flex | border,</div>
<div class="line"> });</div>
<div class="line"> });</div>
<div class="line"> </div>
<div class="line"> screen.Loop(main_renderer);</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">return</span> 0;</div>
<div class="line">}</div>
<div class="ttc" id="aflexbox__config_8hpp_html"><div class="ttname"><a href="flexbox__config_8hpp.html">flexbox_config.hpp</a></div></div>
<div class="ttc" id="astructftxui_1_1FlexboxConfig_html"><div class="ttname"><a href="structftxui_1_1FlexboxConfig.html">ftxui::FlexboxConfig</a></div><div class="ttdef"><b>Definition</b> <a href="flexbox__config_8hpp_source.html#l00015">flexbox_config.hpp:15</a></div></div>
<div class="ttc" id="astructftxui_1_1FlexboxConfig_html_a103275cb09167852e469450cf8471256"><div class="ttname"><a href="structftxui_1_1FlexboxConfig.html#a103275cb09167852e469450cf8471256">ftxui::FlexboxConfig::align_content</a></div><div class="ttdeci">AlignContent align_content</div><div class="ttdef"><b>Definition</b> <a href="flexbox__config_8hpp_source.html#l00093">flexbox_config.hpp:93</a></div></div>
<div class="ttc" id="astructftxui_1_1FlexboxConfig_html_a1514fd3d64965c521555fdc2cf2002ce"><div class="ttname"><a href="structftxui_1_1FlexboxConfig.html#a1514fd3d64965c521555fdc2cf2002ce">ftxui::FlexboxConfig::align_items</a></div><div class="ttdeci">AlignItems align_items</div><div class="ttdef"><b>Definition</b> <a href="flexbox__config_8hpp_source.html#l00077">flexbox_config.hpp:77</a></div></div>
<div class="ttc" id="astructftxui_1_1FlexboxConfig_html_a1f99410fd0fc632a5bc2497b6a447420"><div class="ttname"><a href="structftxui_1_1FlexboxConfig.html#a1f99410fd0fc632a5bc2497b6a447420">ftxui::FlexboxConfig::AlignContent</a></div><div class="ttdeci">AlignContent</div><div class="ttdef"><b>Definition</b> <a href="flexbox__config_8hpp_source.html#l00082">flexbox_config.hpp:82</a></div></div>
<div class="ttc" id="astructftxui_1_1FlexboxConfig_html_a224b9163917ac32fc95a60d8c1eec3aa"><div class="ttname"><a href="structftxui_1_1FlexboxConfig.html#a224b9163917ac32fc95a60d8c1eec3aa">ftxui::FlexboxConfig::Direction</a></div><div class="ttdeci">Direction</div><div class="ttdef"><b>Definition</b> <a href="flexbox__config_8hpp_source.html#l00020">flexbox_config.hpp:20</a></div></div>
<div class="ttc" id="astructftxui_1_1FlexboxConfig_html_a53421c695d00016ab925777d423b4eb6"><div class="ttname"><a href="structftxui_1_1FlexboxConfig.html#a53421c695d00016ab925777d423b4eb6">ftxui::FlexboxConfig::direction</a></div><div class="ttdeci">Direction direction</div><div class="ttdef"><b>Definition</b> <a href="flexbox__config_8hpp_source.html#l00027">flexbox_config.hpp:27</a></div></div>
<div class="ttc" id="astructftxui_1_1FlexboxConfig_html_a68b5470ece4f0a492cc1d2057c9bd5e0"><div class="ttname"><a href="structftxui_1_1FlexboxConfig.html#a68b5470ece4f0a492cc1d2057c9bd5e0">ftxui::FlexboxConfig::wrap</a></div><div class="ttdeci">Wrap wrap</div><div class="ttdef"><b>Definition</b> <a href="flexbox__config_8hpp_source.html#l00037">flexbox_config.hpp:37</a></div></div>
<div class="ttc" id="astructftxui_1_1FlexboxConfig_html_a6c844a611650cf7e956dbe269a0e72ab"><div class="ttname"><a href="structftxui_1_1FlexboxConfig.html#a6c844a611650cf7e956dbe269a0e72ab">ftxui::FlexboxConfig::Wrap</a></div><div class="ttdeci">Wrap</div><div class="ttdef"><b>Definition</b> <a href="flexbox__config_8hpp_source.html#l00031">flexbox_config.hpp:31</a></div></div>
<div class="ttc" id="astructftxui_1_1FlexboxConfig_html_a821af961ece5fe13540ad48b54c7a9e7"><div class="ttname"><a href="structftxui_1_1FlexboxConfig.html#a821af961ece5fe13540ad48b54c7a9e7">ftxui::FlexboxConfig::AlignItems</a></div><div class="ttdeci">AlignItems</div><div class="ttdef"><b>Definition</b> <a href="flexbox__config_8hpp_source.html#l00071">flexbox_config.hpp:71</a></div></div>
<div class="ttc" id="astructftxui_1_1FlexboxConfig_html_ab3173252829e796ee1c100b447243748"><div class="ttname"><a href="structftxui_1_1FlexboxConfig.html#ab3173252829e796ee1c100b447243748">ftxui::FlexboxConfig::justify_content</a></div><div class="ttdeci">JustifyContent justify_content</div><div class="ttdef"><b>Definition</b> <a href="flexbox__config_8hpp_source.html#l00066">flexbox_config.hpp:66</a></div></div>
<div class="ttc" id="astructftxui_1_1FlexboxConfig_html_ac6e5ab18dcac465ee2ac9a0d8b4a82d2"><div class="ttname"><a href="structftxui_1_1FlexboxConfig.html#ac6e5ab18dcac465ee2ac9a0d8b4a82d2">ftxui::FlexboxConfig::JustifyContent</a></div><div class="ttdeci">JustifyContent</div><div class="ttdef"><b>Definition</b> <a href="flexbox__config_8hpp_source.html#l00044">flexbox_config.hpp:44</a></div></div>
<div class="ttc" id="astructftxui_1_1FlexboxConfig_html_ae47b5b0d793d0c2312e4805a1f40012a"><div class="ttname"><a href="structftxui_1_1FlexboxConfig.html#ae47b5b0d793d0c2312e4805a1f40012a">ftxui::FlexboxConfig::Set</a></div><div class="ttdeci">FlexboxConfig &amp; Set(FlexboxConfig::Direction)</div><div class="ttdoc">Set the flexbox direction.</div><div class="ttdef"><b>Definition</b> <a href="flexbox__config_8cpp_source.html#l00010">flexbox_config.cpp:10</a></div></div>
</div><!-- fragment --> </div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.9.8-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.12.0 </li>
</ul>
</div>
</body>
</html>