mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-12-16 01:48:56 +08:00
deploy: bcdcf70348
This commit is contained in:
198
examples_2component_2menu_multiple_8cpp-example.html
Normal file
198
examples_2component_2menu_multiple_8cpp-example.html
Normal file
@@ -0,0 +1,198 @@
|
||||
<!-- HTML header for doxygen 1.8.14-->
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="cache-control" content="max-age=86400"/>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>FTXUI: examples/component/menu_multiple.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>
|
||||
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="resize.js"></script>
|
||||
<script type="text/javascript" src="navtreedata.js"></script>
|
||||
<script type="text/javascript" src="navtree.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_extra.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 style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">FTXUI
|
||||
 <span id="projectnumber">6.1.1</span>
|
||||
</div>
|
||||
<div id="projectbrief">C++ functional terminal UI.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.8 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
||||
/* @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&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(document).ready(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&dn=expat.txt MIT */
|
||||
$(document).ready(function(){initNavTree('examples_2component_2menu_multiple_8cpp-example.html',''); initResizable(); });
|
||||
/* @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/menu_multiple.cpp</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<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 <stdlib.h></span> <span class="comment">// for EXIT_SUCCESS</span></div>
|
||||
<div class="line"><span class="preprocessor">#include <memory></span> <span class="comment">// for allocator, __shared_ptr_access</span></div>
|
||||
<div class="line"><span class="preprocessor">#include <string></span> <span class="comment">// for string, operator+, basic_string, to_string, char_traits</span></div>
|
||||
<div class="line"><span class="preprocessor">#include <vector></span> <span class="comment">// for vector, __alloc_traits<>::value_type</span></div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"><span class="preprocessor">#include "<a class="code" href="captured__mouse_8hpp.html">ftxui/component/captured_mouse.hpp</a>"</span> <span class="comment">// for ftxui</span></div>
|
||||
<div class="line"><span class="preprocessor">#include "<a class="code" href="component_8hpp.html">ftxui/component/component.hpp</a>"</span> <span class="comment">// for Menu, Renderer, Horizontal, Vertical</span></div>
|
||||
<div class="line"><span class="preprocessor">#include "<a class="code" href="component__base_8hpp.html">ftxui/component/component_base.hpp</a>"</span> <span class="comment">// for ComponentBase</span></div>
|
||||
<div class="line"><span class="preprocessor">#include "<a class="code" href="screen__interactive_8hpp.html">ftxui/component/screen_interactive.hpp</a>"</span> <span class="comment">// for Component, ScreenInteractive</span></div>
|
||||
<div class="line"><span class="preprocessor">#include "<a class="code" href="elements_8hpp.html">ftxui/dom/elements.hpp</a>"</span> <span class="comment">// for text, Element, operator|, window, flex, vbox</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#a3149fb57ff17207d2516790b82503002">Component</a> Window(std::string title, <a class="code hl_typedef" href="namespaceftxui.html#a3149fb57ff17207d2516790b82503002">Component</a> component) {</div>
|
||||
<div class="line"> <span class="keywordflow">return</span> Renderer(component, [component, title] { <span class="comment">//</span></div>
|
||||
<div class="line"> <span class="keywordflow">return</span> window(text(title), component->Render()) | flex;</div>
|
||||
<div class="line"> });</div>
|
||||
<div class="line">}</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"><span class="keywordtype">int</span> main() {</div>
|
||||
<div class="line"> <span class="keywordtype">int</span> menu_selected[] = {0, 0, 0};</div>
|
||||
<div class="line"> std::vector<std::vector<std::string>> menu_entries = {</div>
|
||||
<div class="line"> {</div>
|
||||
<div class="line"> <span class="stringliteral">"Ananas"</span>,</div>
|
||||
<div class="line"> <span class="stringliteral">"Raspberry"</span>,</div>
|
||||
<div class="line"> <span class="stringliteral">"Citrus"</span>,</div>
|
||||
<div class="line"> },</div>
|
||||
<div class="line"> {</div>
|
||||
<div class="line"> <span class="stringliteral">"Potatoes"</span>,</div>
|
||||
<div class="line"> <span class="stringliteral">"Weat"</span>,</div>
|
||||
<div class="line"> <span class="stringliteral">"Rise"</span>,</div>
|
||||
<div class="line"> },</div>
|
||||
<div class="line"> {</div>
|
||||
<div class="line"> <span class="stringliteral">"Carrot"</span>,</div>
|
||||
<div class="line"> <span class="stringliteral">"Lettuce"</span>,</div>
|
||||
<div class="line"> <span class="stringliteral">"Tomato"</span>,</div>
|
||||
<div class="line"> },</div>
|
||||
<div class="line"> };</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="keywordtype">int</span> menu_selected_global = 0;</div>
|
||||
<div class="line"> <span class="keyword">auto</span> menu_global = Container::Vertical(</div>
|
||||
<div class="line"> {</div>
|
||||
<div class="line"> <a class="code hl_function" href="namespaceftxui.html#a638693abef9289912f5fa39606390b20">Window</a>(<span class="stringliteral">"Menu 1"</span>, <a class="code hl_function" href="namespaceftxui.html#a27828fc39da10a18478ba84b1b162039">Menu</a>(&menu_entries[0], &menu_selected[0])),</div>
|
||||
<div class="line"> <a class="code hl_function" href="namespaceftxui.html#a638693abef9289912f5fa39606390b20">Window</a>(<span class="stringliteral">"Menu 2"</span>, <a class="code hl_function" href="namespaceftxui.html#a27828fc39da10a18478ba84b1b162039">Menu</a>(&menu_entries[1], &menu_selected[1])),</div>
|
||||
<div class="line"> <a class="code hl_function" href="namespaceftxui.html#a638693abef9289912f5fa39606390b20">Window</a>(<span class="stringliteral">"Menu 3"</span>, <a class="code hl_function" href="namespaceftxui.html#a27828fc39da10a18478ba84b1b162039">Menu</a>(&menu_entries[2], &menu_selected[2])),</div>
|
||||
<div class="line"> },</div>
|
||||
<div class="line"> &menu_selected_global);</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="keyword">auto</span> info = <a class="code hl_function" href="namespaceftxui.html#a533e883e2aeea28de2b60564fcaf0361">Renderer</a>([&] {</div>
|
||||
<div class="line"> <span class="keywordtype">int</span> g = menu_selected_global;</div>
|
||||
<div class="line"> std::string value = menu_entries[g][menu_selected[g]];</div>
|
||||
<div class="line"> <span class="keywordflow">return</span> <a class="code hl_function" href="namespaceftxui.html#a03049def08fa7a5eaa4d5e897152bc1a">window</a>(<a class="code hl_function" href="namespaceftxui.html#a75baaa2734ed76a9f478beaafa87ae57">text</a>(<span class="stringliteral">"Content"</span>), <span class="comment">//</span></div>
|
||||
<div class="line"> <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>(<span class="stringliteral">"menu_selected_global = "</span> + std::to_string(g)),</div>
|
||||
<div class="line"> <a class="code hl_function" href="namespaceftxui.html#a75baaa2734ed76a9f478beaafa87ae57">text</a>(<span class="stringliteral">"menu_selected[0] = "</span> +</div>
|
||||
<div class="line"> std::to_string(menu_selected[0])),</div>
|
||||
<div class="line"> <a class="code hl_function" href="namespaceftxui.html#a75baaa2734ed76a9f478beaafa87ae57">text</a>(<span class="stringliteral">"menu_selected[1] = "</span> +</div>
|
||||
<div class="line"> std::to_string(menu_selected[1])),</div>
|
||||
<div class="line"> <a class="code hl_function" href="namespaceftxui.html#a75baaa2734ed76a9f478beaafa87ae57">text</a>(<span class="stringliteral">"menu_selected[2] = "</span> +</div>
|
||||
<div class="line"> std::to_string(menu_selected[2])),</div>
|
||||
<div class="line"> <a class="code hl_function" href="namespaceftxui.html#a75baaa2734ed76a9f478beaafa87ae57">text</a>(<span class="stringliteral">"Value = "</span> + value),</div>
|
||||
<div class="line"> })) |</div>
|
||||
<div class="line"> <a class="code hl_function" href="namespaceftxui.html#a257acd2bd47bab7db879cca2c0e67e23">flex</a>;</div>
|
||||
<div class="line"> });</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="keyword">auto</span> global = Container::Horizontal({</div>
|
||||
<div class="line"> menu_global,</div>
|
||||
<div class="line"> info,</div>
|
||||
<div class="line"> });</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"> <span class="keyword">auto</span> screen = ScreenInteractive::TerminalOutput();</div>
|
||||
<div class="line"> screen.Loop(global);</div>
|
||||
<div class="line"> <span class="keywordflow">return</span> EXIT_SUCCESS;</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="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="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_a03049def08fa7a5eaa4d5e897152bc1a"><div class="ttname"><a href="namespaceftxui.html#a03049def08fa7a5eaa4d5e897152bc1a">ftxui::window</a></div><div class="ttdeci">Element window(Element title, Element content, BorderStyle border=ROUNDED)</div><div class="ttdoc">Draw window with a title and a border around the element.</div><div class="ttdef"><b>Definition</b> <a href="border_8cpp_source.html#l00507">border.cpp:507</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_a27828fc39da10a18478ba84b1b162039"><div class="ttname"><a href="namespaceftxui.html#a27828fc39da10a18478ba84b1b162039">ftxui::Menu</a></div><div class="ttdeci">Component Menu(MenuOption options)</div><div class="ttdoc">A list of text. The focused element is selected.</div><div class="ttdef"><b>Definition</b> <a href="menu_8cpp_source.html#l00512">menu.cpp:512</a></div></div>
|
||||
<div class="ttc" id="anamespaceftxui_html_a3149fb57ff17207d2516790b82503002"><div class="ttname"><a href="namespaceftxui.html#a3149fb57ff17207d2516790b82503002">ftxui::Component</a></div><div class="ttdeci">std::shared_ptr< ComponentBase > Component</div><div class="ttdef"><b>Definition</b> <a href="component__base_8hpp_source.html#l00024">component_base.hpp:24</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< Element()>)</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="renderer_8cpp_source.html#l00061">renderer.cpp:61</a></div></div>
|
||||
<div class="ttc" id="anamespaceftxui_html_a638693abef9289912f5fa39606390b20"><div class="ttname"><a href="namespaceftxui.html#a638693abef9289912f5fa39606390b20">ftxui::Window</a></div><div class="ttdeci">Component Window(WindowOptions option)</div><div class="ttdoc">A draggeable / resizeable window. To use multiple of them, they must be stacked using Container::Stac...</div><div class="ttdef"><b>Definition</b> <a href="window_8cpp_source.html#l00312">window.cpp:312</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_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><!-- contents -->
|
||||
</div><!-- doc-content -->
|
||||
<!-- HTML footer for doxygen 1.8.14-->
|
||||
<!-- start footer part -->
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user