123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- <!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">
- <head>
- <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.8.17"/>
- <meta name="viewport" content="width=device-width, initial-scale=1"/>
- <title>Bugz Door Project: menu-example.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="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" />
- </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">Bugz Door Project
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <!-- end header part -->
- <!-- Generated by Doxygen 1.8.17 -->
- <script type="text/javascript">
- /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
- var searchBox = new SearchBox("searchBox", "search",false,'Search');
- /* @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:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
- $(function() {
- initMenu('',true,false,'search.php','Search');
- $(document).ready(function() { init_search(); });
- });
- /* @license-end */</script>
- <div id="main-nav"></div>
- </div><!-- top -->
- <!-- 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">
- <iframe src="javascript:void(0)" frameborder="0"
- name="MSearchResults" id="MSearchResults">
- </iframe>
- </div>
- <div class="header">
- <div class="headertitle">
- <div class="title">menu-example.cpp</div> </div>
- </div><!--header-->
- <div class="contents">
- <p>Example using menusThis example shows a menu, and demonstrates the new menu update ability.</p>
- <div class="fragment"><div class="line"><span class="preprocessor">#include "door.h"</span></div>
- <div class="line"> </div>
- <div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> *argv[]) {</div>
- <div class="line"> <a name="_a0"></a><a class="code" href="classdoor_1_1Door.html">door::Door</a> <a class="code" href="namespacedoor.html">door</a>(<span class="stringliteral">"example"</span>, argc, argv);</div>
- <div class="line"> </div>
- <div class="line"> <span class="comment">// reset colors, clear screen.</span></div>
- <div class="line"> <a class="code" href="namespacedoor.html">door</a> << <a name="a1"></a><a class="code" href="namespacedoor.html#ae3a70989c43f6cb3522308af748b4481">door::reset</a> << <a name="a2"></a><a class="code" href="namespacedoor.html#ac70193caf66e4b9aed1529593727a6eb">door::cls</a> << <a name="a3"></a><a class="code" href="namespacedoor.html#a36352ded72aee66b10e1bda6d3d8efb8">door::nl</a>;</div>
- <div class="line"> </div>
- <div class="line"> <a name="_a4"></a><a class="code" href="classdoor_1_1Menu.html">door::Menu</a> menu(10, 5, 25);</div>
- <div class="line"> menu.<a name="a5"></a>setColor(<a name="_a6"></a><a class="code" href="classdoor_1_1ANSIColor.html">door::ANSIColor</a>(<a name="a7"></a><a class="code" href="namespacedoor.html#abafe0a9e79349883af3ab2a7fb544366a8a568e5f41b7e4da88fe5c4a00aad34e">door::COLOR::YELLOW</a>, <a name="a8"></a><a class="code" href="namespacedoor.html#abafe0a9e79349883af3ab2a7fb544366a1b3e1ee9bff86431dea6b181365ba65f">door::COLOR::BLUE</a>,</div>
- <div class="line"> <a name="a9"></a><a class="code" href="namespacedoor.html#add24f9a933f9a6e613de6d56854e5c52a2909dd0e0336f10b6da9735b859a3d19">door::ATTR::BOLD</a>)); <span class="comment">// set border</span></div>
- <div class="line"> menu.<a name="a10"></a>setTitle(std::make_unique<door::Line>(<span class="stringliteral">"Menu Example"</span>), 1);</div>
- <div class="line"> </div>
- <div class="line"> <span class="keywordtype">int</span> arrows = 15;</div>
- <div class="line"> <a class="code" href="namespacedoor.html#adb2697f83f8ce701366e05ed72c97d6e">door::updateFunction</a> arrowsUpdate = [&arrows](void) -> std::string {</div>
- <div class="line"> std::string text = <span class="stringliteral">"Arrows ("</span>;</div>
- <div class="line"> text += std::to_string(arrows);</div>
- <div class="line"> text += <span class="stringliteral">" in stock)"</span>;</div>
- <div class="line"> <span class="keywordflow">return</span> text;</div>
- <div class="line"> };</div>
- <div class="line"> menu.<a name="a11"></a>addSelection(<span class="charliteral">'A'</span>, <span class="stringliteral">"Arrows (0 in stock)"</span>, arrowsUpdate);</div>
- <div class="line"> menu.addSelection(<span class="charliteral">'C'</span>, <span class="stringliteral">"Color selection"</span>);</div>
- <div class="line"> menu.addSelection(<span class="charliteral">'P'</span>, <span class="stringliteral">"Pants"</span>);</div>
- <div class="line"> menu.addSelection(<span class="charliteral">'Q'</span>, <span class="stringliteral">"Quit"</span>);</div>
- <div class="line"> </div>
- <div class="line"> <span class="keywordtype">int</span> r = 0;</div>
- <div class="line"> </div>
- <div class="line"> <span class="keywordflow">while</span> (r >= 0) {</div>
- <div class="line"> menu.<a name="a12"></a><a class="code" href="classdoor_1_1Panel.html#a57234d5f1d891ed8f9ea9c8c9be7aed4">update</a>();</div>
- <div class="line"> </div>
- <div class="line"> r = menu.<a name="a13"></a><a class="code" href="classdoor_1_1Menu.html#a06da9157cc5984510153a6b93bf2e71e">choose</a>(<a class="code" href="namespacedoor.html">door</a>);</div>
- <div class="line"> <span class="keywordflow">if</span> (r > 0) {</div>
- <div class="line"> <span class="comment">// we did not timeout</span></div>
- <div class="line"> <span class="keywordtype">char</span> c = menu.<a name="a14"></a>which(r - 1);</div>
- <div class="line"> <span class="keywordflow">if</span> (c == <span class="charliteral">'A'</span>) {</div>
- <div class="line"> <span class="keywordflow">if</span> (arrows > 0)</div>
- <div class="line"> --arrows;</div>
- <div class="line"> <span class="keywordflow">else</span> {</div>
- <div class="line"> <a class="code" href="namespacedoor.html">door</a> << <a name="_a15"></a><a class="code" href="classdoor_1_1Goto.html">door::Goto</a>(1, 17) << <a class="code" href="namespacedoor.html#ae3a70989c43f6cb3522308af748b4481">door::reset</a></div>
- <div class="line"> << <span class="stringliteral">"Sorry, we're out of stock."</span>;</div>
- <div class="line"> <span class="keywordflow">continue</span>;</div>
- <div class="line"> }</div>
- <div class="line"> }</div>
- <div class="line"> </div>
- <div class="line"> <a class="code" href="namespacedoor.html">door</a> << <a class="code" href="classdoor_1_1Goto.html">door::Goto</a>(1, 17) << <a class="code" href="namespacedoor.html#ae3a70989c43f6cb3522308af748b4481">door::reset</a> << <span class="stringliteral">"You chose "</span> << c << <span class="stringliteral">"!"</span>;</div>
- <div class="line"> <span class="keywordflow">if</span> (c == <span class="charliteral">'Q'</span>)</div>
- <div class="line"> <span class="keywordflow">break</span>;</div>
- <div class="line"> }</div>
- <div class="line"> }</div>
- <div class="line"> </div>
- <div class="line"> <a class="code" href="namespacedoor.html">door</a> << <a class="code" href="namespacedoor.html#a36352ded72aee66b10e1bda6d3d8efb8">door::nl</a> << <span class="stringliteral">"Returing to BBS... "</span> << <a class="code" href="namespacedoor.html#a36352ded72aee66b10e1bda6d3d8efb8">door::nl</a>;</div>
- <div class="line">}</div>
- </div><!-- fragment --> </div><!-- contents -->
- <div class="ttc" id="aclassdoor_1_1Goto_html"><div class="ttname"><a href="classdoor_1_1Goto.html">door::Goto</a></div><div class="ttdoc">ANSI Goto X, Y position.</div><div class="ttdef"><b>Definition:</b> door.h:425</div></div>
- <div class="ttc" id="aclassdoor_1_1Door_html"><div class="ttname"><a href="classdoor_1_1Door.html">door::Door</a></div><div class="ttdef"><b>Definition:</b> door.h:190</div></div>
- <div class="ttc" id="anamespacedoor_html_add24f9a933f9a6e613de6d56854e5c52a2909dd0e0336f10b6da9735b859a3d19"><div class="ttname"><a href="namespacedoor.html#add24f9a933f9a6e613de6d56854e5c52a2909dd0e0336f10b6da9735b859a3d19">door::ATTR::BOLD</a></div><div class="ttdeci">@ BOLD</div><div class="ttdoc">BOLD is the same as BRIGHT.</div></div>
- <div class="ttc" id="aclassdoor_1_1ANSIColor_html"><div class="ttname"><a href="classdoor_1_1ANSIColor.html">door::ANSIColor</a></div><div class="ttdoc">Foreground, Background and Attributes.</div><div class="ttdef"><b>Definition:</b> door.h:137</div></div>
- <div class="ttc" id="aclassdoor_1_1Menu_html"><div class="ttname"><a href="classdoor_1_1Menu.html">door::Menu</a></div><div class="ttdef"><b>Definition:</b> door.h:686</div></div>
- <div class="ttc" id="anamespacedoor_html_ac70193caf66e4b9aed1529593727a6eb"><div class="ttname"><a href="namespacedoor.html#ac70193caf66e4b9aed1529593727a6eb">door::cls</a></div><div class="ttdeci">Clrscr cls</div><div class="ttdef"><b>Definition:</b> door.cpp:1352</div></div>
- <div class="ttc" id="anamespacedoor_html_adb2697f83f8ce701366e05ed72c97d6e"><div class="ttname"><a href="namespacedoor.html#adb2697f83f8ce701366e05ed72c97d6e">door::updateFunction</a></div><div class="ttdeci">std::function< std::string(void)> updateFunction</div><div class="ttdef"><b>Definition:</b> door.h:374</div></div>
- <div class="ttc" id="anamespacedoor_html_a36352ded72aee66b10e1bda6d3d8efb8"><div class="ttname"><a href="namespacedoor.html#a36352ded72aee66b10e1bda6d3d8efb8">door::nl</a></div><div class="ttdeci">NewLine nl</div><div class="ttdef"><b>Definition:</b> door.cpp:1380</div></div>
- <div class="ttc" id="aclassdoor_1_1Panel_html_a57234d5f1d891ed8f9ea9c8c9be7aed4"><div class="ttname"><a href="classdoor_1_1Panel.html#a57234d5f1d891ed8f9ea9c8c9be7aed4">door::Panel::update</a></div><div class="ttdeci">bool update(Door &d)</div><div class="ttdoc">Updates a panel.</div><div class="ttdef"><b>Definition:</b> panel.cpp:273</div></div>
- <div class="ttc" id="anamespacedoor_html_abafe0a9e79349883af3ab2a7fb544366a8a568e5f41b7e4da88fe5c4a00aad34e"><div class="ttname"><a href="namespacedoor.html#abafe0a9e79349883af3ab2a7fb544366a8a568e5f41b7e4da88fe5c4a00aad34e">door::COLOR::YELLOW</a></div><div class="ttdeci">@ YELLOW</div><div class="ttdoc">YELLOW (3)</div></div>
- <div class="ttc" id="anamespacedoor_html_ae3a70989c43f6cb3522308af748b4481"><div class="ttname"><a href="namespacedoor.html#ae3a70989c43f6cb3522308af748b4481">door::reset</a></div><div class="ttdeci">ANSIColor reset(ATTR::RESET)</div><div class="ttdoc">reset colors to normal</div><div class="ttdef"><b>Definition:</b> door.h:414</div></div>
- <div class="ttc" id="anamespacedoor_html"><div class="ttname"><a href="namespacedoor.html">door</a></div><div class="ttdoc">The BBS door project. This is an attempt at writing a C++ BBS door toolkit.</div><div class="ttdef"><b>Definition:</b> ansicolor.cpp:9</div></div>
- <div class="ttc" id="aclassdoor_1_1Menu_html_a06da9157cc5984510153a6b93bf2e71e"><div class="ttname"><a href="classdoor_1_1Menu.html#a06da9157cc5984510153a6b93bf2e71e">door::Menu::choose</a></div><div class="ttdeci">int choose(Door &door)</div><div class="ttdef"><b>Definition:</b> panel.cpp:757</div></div>
- <div class="ttc" id="anamespacedoor_html_abafe0a9e79349883af3ab2a7fb544366a1b3e1ee9bff86431dea6b181365ba65f"><div class="ttname"><a href="namespacedoor.html#abafe0a9e79349883af3ab2a7fb544366a1b3e1ee9bff86431dea6b181365ba65f">door::COLOR::BLUE</a></div><div class="ttdeci">@ BLUE</div><div class="ttdoc">BLUE (4)</div></div>
- <!-- start footer part -->
- <hr class="footer"/><address class="footer"><small>
- Generated by  <a href="http://www.doxygen.org/index.html">
- <img class="footer" src="doxygen.png" alt="doxygen"/>
- </a> 1.8.17
- </small></address>
- </body>
- </html>
|