Terminal.Gui.MenuItem.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. <!DOCTYPE html>
  2. <!--[if IE]><![endif]-->
  3. <html>
  4. <head>
  5. <meta charset="utf-8">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <title>Class MenuItem
  8. </title>
  9. <meta name="viewport" content="width=device-width">
  10. <meta name="title" content="Class MenuItem
  11. ">
  12. <meta name="generator" content="docfx 2.56.2.0">
  13. <link rel="shortcut icon" href="../../favicon.ico">
  14. <link rel="stylesheet" href="../../styles/docfx.vendor.css">
  15. <link rel="stylesheet" href="../../styles/docfx.css">
  16. <link rel="stylesheet" href="../../styles/main.css">
  17. <meta property="docfx:navrel" content="../../toc.html">
  18. <meta property="docfx:tocrel" content="toc.html">
  19. <meta property="docfx:rel" content="../../">
  20. </head>
  21. <body data-spy="scroll" data-target="#affix" data-offset="120">
  22. <div id="wrapper">
  23. <header>
  24. <nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
  25. <div class="container">
  26. <div class="navbar-header">
  27. <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
  28. <span class="sr-only">Toggle navigation</span>
  29. <span class="icon-bar"></span>
  30. <span class="icon-bar"></span>
  31. <span class="icon-bar"></span>
  32. </button>
  33. <a class="navbar-brand" href="../../index.html">
  34. <img id="logo" class="svg" src="../../images/logo48.png" alt="">
  35. </a>
  36. </div>
  37. <div class="collapse navbar-collapse" id="navbar">
  38. <form class="navbar-form navbar-right" role="search" id="search">
  39. <div class="form-group">
  40. <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
  41. </div>
  42. </form>
  43. </div>
  44. </div>
  45. </nav>
  46. <div class="subnav navbar navbar-default">
  47. <div class="container hide-when-search" id="breadcrumb">
  48. <ul class="breadcrumb">
  49. <li></li>
  50. </ul>
  51. </div>
  52. </div>
  53. </header>
  54. <div class="container body-content">
  55. <div id="search-results">
  56. <div class="search-list"></div>
  57. <div class="sr-items">
  58. <p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
  59. </div>
  60. <ul id="pagination"></ul>
  61. </div>
  62. </div>
  63. <div role="main" class="container body-content hide-when-search">
  64. <div class="sidenav hide-when-search">
  65. <a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
  66. <div class="sidetoggle collapse" id="sidetoggle">
  67. <div id="sidetoc"></div>
  68. </div>
  69. </div>
  70. <div class="article row grid-right">
  71. <div class="col-md-10">
  72. <article class="content wrap" id="_content" data-uid="Terminal.Gui.MenuItem">
  73. <h1 id="Terminal_Gui_MenuItem" data-uid="Terminal.Gui.MenuItem" class="text-break">Class MenuItem
  74. </h1>
  75. <div class="markdown level0 summary">
  76. A <a class="xref" href="Terminal.Gui.MenuItem.html">MenuItem</a> has a title, an associated help text, and an action to execute on activation.
  77. </div>
  78. <div class="markdown level0 conceptual"></div>
  79. <div class="inheritance">
  80. <h5>Inheritance</h5>
  81. <div class="level0"><span class="xref">System.Object</span></div>
  82. <div class="level1"><span class="xref">MenuItem</span></div>
  83. <div class="level2"><a class="xref" href="Terminal.Gui.MenuBarItem.html">MenuBarItem</a></div>
  84. </div>
  85. <div class="inheritedMembers">
  86. <h5>Inherited Members</h5>
  87. <div>
  88. <span class="xref">System.Object.Equals(System.Object)</span>
  89. </div>
  90. <div>
  91. <span class="xref">System.Object.Equals(System.Object, System.Object)</span>
  92. </div>
  93. <div>
  94. <span class="xref">System.Object.GetHashCode()</span>
  95. </div>
  96. <div>
  97. <span class="xref">System.Object.GetType()</span>
  98. </div>
  99. <div>
  100. <span class="xref">System.Object.MemberwiseClone()</span>
  101. </div>
  102. <div>
  103. <span class="xref">System.Object.ReferenceEquals(System.Object, System.Object)</span>
  104. </div>
  105. <div>
  106. <span class="xref">System.Object.ToString()</span>
  107. </div>
  108. </div>
  109. <h6><strong>Namespace</strong>: <a class="xref" href="Terminal.Gui.html">Terminal.Gui</a></h6>
  110. <h6><strong>Assembly</strong>: Terminal.Gui.dll</h6>
  111. <h5 id="Terminal_Gui_MenuItem_syntax">Syntax</h5>
  112. <div class="codewrapper">
  113. <pre><code class="lang-csharp hljs">public class MenuItem</code></pre>
  114. </div>
  115. <h3 id="constructors">Constructors
  116. </h3>
  117. <a id="Terminal_Gui_MenuItem__ctor_" data-uid="Terminal.Gui.MenuItem.#ctor*"></a>
  118. <h4 id="Terminal_Gui_MenuItem__ctor" data-uid="Terminal.Gui.MenuItem.#ctor">MenuItem()</h4>
  119. <div class="markdown level1 summary">
  120. Initializes a new instance of <a class="xref" href="Terminal.Gui.MenuItem.html">MenuItem</a>
  121. </div>
  122. <div class="markdown level1 conceptual"></div>
  123. <h5 class="decalaration">Declaration</h5>
  124. <div class="codewrapper">
  125. <pre><code class="lang-csharp hljs">public MenuItem()</code></pre>
  126. </div>
  127. <a id="Terminal_Gui_MenuItem__ctor_" data-uid="Terminal.Gui.MenuItem.#ctor*"></a>
  128. <h4 id="Terminal_Gui_MenuItem__ctor_NStack_ustring_NStack_ustring_System_Action_System_Func_System_Boolean__Terminal_Gui_MenuItem_" data-uid="Terminal.Gui.MenuItem.#ctor(NStack.ustring,NStack.ustring,System.Action,System.Func{System.Boolean},Terminal.Gui.MenuItem)">MenuItem(ustring, ustring, Action, Func&lt;Boolean&gt;, MenuItem)</h4>
  129. <div class="markdown level1 summary">
  130. Initializes a new instance of <a class="xref" href="Terminal.Gui.MenuItem.html">MenuItem</a>.
  131. </div>
  132. <div class="markdown level1 conceptual"></div>
  133. <h5 class="decalaration">Declaration</h5>
  134. <div class="codewrapper">
  135. <pre><code class="lang-csharp hljs">public MenuItem(ustring title, ustring help, Action action, Func&lt;bool&gt; canExecute = null, MenuItem parent = null)</code></pre>
  136. </div>
  137. <h5 class="parameters">Parameters</h5>
  138. <table class="table table-bordered table-striped table-condensed">
  139. <thead>
  140. <tr>
  141. <th>Type</th>
  142. <th>Name</th>
  143. <th>Description</th>
  144. </tr>
  145. </thead>
  146. <tbody>
  147. <tr>
  148. <td><span class="xref">NStack.ustring</span></td>
  149. <td><span class="parametername">title</span></td>
  150. <td>Title for the menu item.</td>
  151. </tr>
  152. <tr>
  153. <td><span class="xref">NStack.ustring</span></td>
  154. <td><span class="parametername">help</span></td>
  155. <td>Help text to display.</td>
  156. </tr>
  157. <tr>
  158. <td><span class="xref">System.Action</span></td>
  159. <td><span class="parametername">action</span></td>
  160. <td>Action to invoke when the menu item is activated.</td>
  161. </tr>
  162. <tr>
  163. <td><span class="xref">System.Func</span>&lt;<span class="xref">System.Boolean</span>&gt;</td>
  164. <td><span class="parametername">canExecute</span></td>
  165. <td>Function to determine if the action can currently be executed.</td>
  166. </tr>
  167. <tr>
  168. <td><a class="xref" href="Terminal.Gui.MenuItem.html">MenuItem</a></td>
  169. <td><span class="parametername">parent</span></td>
  170. <td>The parent of this menu item.</td>
  171. </tr>
  172. </tbody>
  173. </table>
  174. <h3 id="fields">Fields
  175. </h3>
  176. <h4 id="Terminal_Gui_MenuItem_HotKey" data-uid="Terminal.Gui.MenuItem.HotKey">HotKey</h4>
  177. <div class="markdown level1 summary">
  178. The HotKey is used when the menu is active, the shortcut can be triggered when the menu is not active.
  179. For example HotKey would be &quot;N&quot; when the File Menu is open (assuming there is a &quot;_New&quot; entry
  180. if the ShortCut is set to &quot;Control-N&quot;, this would be a global hotkey that would trigger as well
  181. </div>
  182. <div class="markdown level1 conceptual"></div>
  183. <h5 class="decalaration">Declaration</h5>
  184. <div class="codewrapper">
  185. <pre><code class="lang-csharp hljs">public Rune HotKey</code></pre>
  186. </div>
  187. <h5 class="fieldValue">Field Value</h5>
  188. <table class="table table-bordered table-striped table-condensed">
  189. <thead>
  190. <tr>
  191. <th>Type</th>
  192. <th>Description</th>
  193. </tr>
  194. </thead>
  195. <tbody>
  196. <tr>
  197. <td><span class="xref">System.Rune</span></td>
  198. <td></td>
  199. </tr>
  200. </tbody>
  201. </table>
  202. <h3 id="properties">Properties
  203. </h3>
  204. <a id="Terminal_Gui_MenuItem_Action_" data-uid="Terminal.Gui.MenuItem.Action*"></a>
  205. <h4 id="Terminal_Gui_MenuItem_Action" data-uid="Terminal.Gui.MenuItem.Action">Action</h4>
  206. <div class="markdown level1 summary">
  207. Gets or sets the action to be invoked when the menu is triggered
  208. </div>
  209. <div class="markdown level1 conceptual"></div>
  210. <h5 class="decalaration">Declaration</h5>
  211. <div class="codewrapper">
  212. <pre><code class="lang-csharp hljs">public Action Action { get; set; }</code></pre>
  213. </div>
  214. <h5 class="propertyValue">Property Value</h5>
  215. <table class="table table-bordered table-striped table-condensed">
  216. <thead>
  217. <tr>
  218. <th>Type</th>
  219. <th>Description</th>
  220. </tr>
  221. </thead>
  222. <tbody>
  223. <tr>
  224. <td><span class="xref">System.Action</span></td>
  225. <td>Method to invoke.</td>
  226. </tr>
  227. </tbody>
  228. </table>
  229. <a id="Terminal_Gui_MenuItem_CanExecute_" data-uid="Terminal.Gui.MenuItem.CanExecute*"></a>
  230. <h4 id="Terminal_Gui_MenuItem_CanExecute" data-uid="Terminal.Gui.MenuItem.CanExecute">CanExecute</h4>
  231. <div class="markdown level1 summary">
  232. Gets or sets the action to be invoked if the menu can be triggered
  233. </div>
  234. <div class="markdown level1 conceptual"></div>
  235. <h5 class="decalaration">Declaration</h5>
  236. <div class="codewrapper">
  237. <pre><code class="lang-csharp hljs">public Func&lt;bool&gt; CanExecute { get; set; }</code></pre>
  238. </div>
  239. <h5 class="propertyValue">Property Value</h5>
  240. <table class="table table-bordered table-striped table-condensed">
  241. <thead>
  242. <tr>
  243. <th>Type</th>
  244. <th>Description</th>
  245. </tr>
  246. </thead>
  247. <tbody>
  248. <tr>
  249. <td><span class="xref">System.Func</span>&lt;<span class="xref">System.Boolean</span>&gt;</td>
  250. <td>Function to determine if action is ready to be executed.</td>
  251. </tr>
  252. </tbody>
  253. </table>
  254. <a id="Terminal_Gui_MenuItem_Checked_" data-uid="Terminal.Gui.MenuItem.Checked*"></a>
  255. <h4 id="Terminal_Gui_MenuItem_Checked" data-uid="Terminal.Gui.MenuItem.Checked">Checked</h4>
  256. <div class="markdown level1 summary">
  257. Sets or gets whether the <a class="xref" href="Terminal.Gui.MenuItem.html">MenuItem</a> shows a check indicator or not. See <a class="xref" href="Terminal.Gui.MenuItemCheckStyle.html">MenuItemCheckStyle</a>.
  258. </div>
  259. <div class="markdown level1 conceptual"></div>
  260. <h5 class="decalaration">Declaration</h5>
  261. <div class="codewrapper">
  262. <pre><code class="lang-csharp hljs">public bool Checked { get; set; }</code></pre>
  263. </div>
  264. <h5 class="propertyValue">Property Value</h5>
  265. <table class="table table-bordered table-striped table-condensed">
  266. <thead>
  267. <tr>
  268. <th>Type</th>
  269. <th>Description</th>
  270. </tr>
  271. </thead>
  272. <tbody>
  273. <tr>
  274. <td><span class="xref">System.Boolean</span></td>
  275. <td></td>
  276. </tr>
  277. </tbody>
  278. </table>
  279. <a id="Terminal_Gui_MenuItem_CheckType_" data-uid="Terminal.Gui.MenuItem.CheckType*"></a>
  280. <h4 id="Terminal_Gui_MenuItem_CheckType" data-uid="Terminal.Gui.MenuItem.CheckType">CheckType</h4>
  281. <div class="markdown level1 summary">
  282. Sets or gets the type selection indicator the menu item will be displayed with.
  283. </div>
  284. <div class="markdown level1 conceptual"></div>
  285. <h5 class="decalaration">Declaration</h5>
  286. <div class="codewrapper">
  287. <pre><code class="lang-csharp hljs">public MenuItemCheckStyle CheckType { get; set; }</code></pre>
  288. </div>
  289. <h5 class="propertyValue">Property Value</h5>
  290. <table class="table table-bordered table-striped table-condensed">
  291. <thead>
  292. <tr>
  293. <th>Type</th>
  294. <th>Description</th>
  295. </tr>
  296. </thead>
  297. <tbody>
  298. <tr>
  299. <td><a class="xref" href="Terminal.Gui.MenuItemCheckStyle.html">MenuItemCheckStyle</a></td>
  300. <td></td>
  301. </tr>
  302. </tbody>
  303. </table>
  304. <a id="Terminal_Gui_MenuItem_Help_" data-uid="Terminal.Gui.MenuItem.Help*"></a>
  305. <h4 id="Terminal_Gui_MenuItem_Help" data-uid="Terminal.Gui.MenuItem.Help">Help</h4>
  306. <div class="markdown level1 summary">
  307. Gets or sets the help text for the menu item.
  308. </div>
  309. <div class="markdown level1 conceptual"></div>
  310. <h5 class="decalaration">Declaration</h5>
  311. <div class="codewrapper">
  312. <pre><code class="lang-csharp hljs">public ustring Help { get; set; }</code></pre>
  313. </div>
  314. <h5 class="propertyValue">Property Value</h5>
  315. <table class="table table-bordered table-striped table-condensed">
  316. <thead>
  317. <tr>
  318. <th>Type</th>
  319. <th>Description</th>
  320. </tr>
  321. </thead>
  322. <tbody>
  323. <tr>
  324. <td><span class="xref">NStack.ustring</span></td>
  325. <td>The help text.</td>
  326. </tr>
  327. </tbody>
  328. </table>
  329. <a id="Terminal_Gui_MenuItem_Parent_" data-uid="Terminal.Gui.MenuItem.Parent*"></a>
  330. <h4 id="Terminal_Gui_MenuItem_Parent" data-uid="Terminal.Gui.MenuItem.Parent">Parent</h4>
  331. <div class="markdown level1 summary">
  332. Gets or sets the parent for this <a class="xref" href="Terminal.Gui.MenuItem.html">MenuItem</a>.
  333. </div>
  334. <div class="markdown level1 conceptual"></div>
  335. <h5 class="decalaration">Declaration</h5>
  336. <div class="codewrapper">
  337. <pre><code class="lang-csharp hljs">public MenuItem Parent { get; }</code></pre>
  338. </div>
  339. <h5 class="propertyValue">Property Value</h5>
  340. <table class="table table-bordered table-striped table-condensed">
  341. <thead>
  342. <tr>
  343. <th>Type</th>
  344. <th>Description</th>
  345. </tr>
  346. </thead>
  347. <tbody>
  348. <tr>
  349. <td><a class="xref" href="Terminal.Gui.MenuItem.html">MenuItem</a></td>
  350. <td>The parent.</td>
  351. </tr>
  352. </tbody>
  353. </table>
  354. <a id="Terminal_Gui_MenuItem_Title_" data-uid="Terminal.Gui.MenuItem.Title*"></a>
  355. <h4 id="Terminal_Gui_MenuItem_Title" data-uid="Terminal.Gui.MenuItem.Title">Title</h4>
  356. <div class="markdown level1 summary">
  357. Gets or sets the title.
  358. </div>
  359. <div class="markdown level1 conceptual"></div>
  360. <h5 class="decalaration">Declaration</h5>
  361. <div class="codewrapper">
  362. <pre><code class="lang-csharp hljs">public ustring Title { get; set; }</code></pre>
  363. </div>
  364. <h5 class="propertyValue">Property Value</h5>
  365. <table class="table table-bordered table-striped table-condensed">
  366. <thead>
  367. <tr>
  368. <th>Type</th>
  369. <th>Description</th>
  370. </tr>
  371. </thead>
  372. <tbody>
  373. <tr>
  374. <td><span class="xref">NStack.ustring</span></td>
  375. <td>The title.</td>
  376. </tr>
  377. </tbody>
  378. </table>
  379. <h3 id="methods">Methods
  380. </h3>
  381. <a id="Terminal_Gui_MenuItem_GetMenuBarItem_" data-uid="Terminal.Gui.MenuItem.GetMenuBarItem*"></a>
  382. <h4 id="Terminal_Gui_MenuItem_GetMenuBarItem" data-uid="Terminal.Gui.MenuItem.GetMenuBarItem">GetMenuBarItem()</h4>
  383. <div class="markdown level1 summary">
  384. Merely a debugging aid to see the interaction with main
  385. </div>
  386. <div class="markdown level1 conceptual"></div>
  387. <h5 class="decalaration">Declaration</h5>
  388. <div class="codewrapper">
  389. <pre><code class="lang-csharp hljs">public bool GetMenuBarItem()</code></pre>
  390. </div>
  391. <h5 class="returns">Returns</h5>
  392. <table class="table table-bordered table-striped table-condensed">
  393. <thead>
  394. <tr>
  395. <th>Type</th>
  396. <th>Description</th>
  397. </tr>
  398. </thead>
  399. <tbody>
  400. <tr>
  401. <td><span class="xref">System.Boolean</span></td>
  402. <td></td>
  403. </tr>
  404. </tbody>
  405. </table>
  406. <a id="Terminal_Gui_MenuItem_GetMenuItem_" data-uid="Terminal.Gui.MenuItem.GetMenuItem*"></a>
  407. <h4 id="Terminal_Gui_MenuItem_GetMenuItem" data-uid="Terminal.Gui.MenuItem.GetMenuItem">GetMenuItem()</h4>
  408. <div class="markdown level1 summary">
  409. Merely a debugging aid to see the interaction with main
  410. </div>
  411. <div class="markdown level1 conceptual"></div>
  412. <h5 class="decalaration">Declaration</h5>
  413. <div class="codewrapper">
  414. <pre><code class="lang-csharp hljs">public MenuItem GetMenuItem()</code></pre>
  415. </div>
  416. <h5 class="returns">Returns</h5>
  417. <table class="table table-bordered table-striped table-condensed">
  418. <thead>
  419. <tr>
  420. <th>Type</th>
  421. <th>Description</th>
  422. </tr>
  423. </thead>
  424. <tbody>
  425. <tr>
  426. <td><a class="xref" href="Terminal.Gui.MenuItem.html">MenuItem</a></td>
  427. <td></td>
  428. </tr>
  429. </tbody>
  430. </table>
  431. <a id="Terminal_Gui_MenuItem_IsEnabled_" data-uid="Terminal.Gui.MenuItem.IsEnabled*"></a>
  432. <h4 id="Terminal_Gui_MenuItem_IsEnabled" data-uid="Terminal.Gui.MenuItem.IsEnabled">IsEnabled()</h4>
  433. <div class="markdown level1 summary">
  434. Shortcut to check if the menu item is enabled
  435. </div>
  436. <div class="markdown level1 conceptual"></div>
  437. <h5 class="decalaration">Declaration</h5>
  438. <div class="codewrapper">
  439. <pre><code class="lang-csharp hljs">public bool IsEnabled()</code></pre>
  440. </div>
  441. <h5 class="returns">Returns</h5>
  442. <table class="table table-bordered table-striped table-condensed">
  443. <thead>
  444. <tr>
  445. <th>Type</th>
  446. <th>Description</th>
  447. </tr>
  448. </thead>
  449. <tbody>
  450. <tr>
  451. <td><span class="xref">System.Boolean</span></td>
  452. <td></td>
  453. </tr>
  454. </tbody>
  455. </table>
  456. </article>
  457. </div>
  458. <div class="hidden-sm col-md-2" role="complementary">
  459. <div class="sideaffix">
  460. <div class="contribution">
  461. <ul class="nav">
  462. </ul>
  463. </div>
  464. <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
  465. <!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
  466. </nav>
  467. </div>
  468. </div>
  469. </div>
  470. </div>
  471. <footer>
  472. <div class="grad-bottom"></div>
  473. <div class="footer">
  474. <div class="container">
  475. <span class="pull-right">
  476. <a href="#top">Back to top</a>
  477. </span>
  478. <span>Generated by <strong>DocFX</strong></span>
  479. </div>
  480. </div>
  481. </footer>
  482. </div>
  483. <script type="text/javascript" src="../../styles/docfx.vendor.js"></script>
  484. <script type="text/javascript" src="../../styles/docfx.js"></script>
  485. <script type="text/javascript" src="../../styles/main.js"></script>
  486. </body>
  487. </html>