Terminal.Gui.MenuItem.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  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. <h4 id="Terminal_Gui_MenuItem_ShortCut" data-uid="Terminal.Gui.MenuItem.ShortCut">ShortCut</h4>
  203. <div class="markdown level1 summary">
  204. This is the global setting that can be used as a global shortcut to invoke the action on the menu.
  205. </div>
  206. <div class="markdown level1 conceptual"></div>
  207. <h5 class="decalaration">Declaration</h5>
  208. <div class="codewrapper">
  209. <pre><code class="lang-csharp hljs">public Key ShortCut</code></pre>
  210. </div>
  211. <h5 class="fieldValue">Field Value</h5>
  212. <table class="table table-bordered table-striped table-condensed">
  213. <thead>
  214. <tr>
  215. <th>Type</th>
  216. <th>Description</th>
  217. </tr>
  218. </thead>
  219. <tbody>
  220. <tr>
  221. <td><a class="xref" href="Terminal.Gui.Key.html">Key</a></td>
  222. <td></td>
  223. </tr>
  224. </tbody>
  225. </table>
  226. <h3 id="properties">Properties
  227. </h3>
  228. <a id="Terminal_Gui_MenuItem_Action_" data-uid="Terminal.Gui.MenuItem.Action*"></a>
  229. <h4 id="Terminal_Gui_MenuItem_Action" data-uid="Terminal.Gui.MenuItem.Action">Action</h4>
  230. <div class="markdown level1 summary">
  231. Gets or sets the action to be invoked when the menu is triggered
  232. </div>
  233. <div class="markdown level1 conceptual"></div>
  234. <h5 class="decalaration">Declaration</h5>
  235. <div class="codewrapper">
  236. <pre><code class="lang-csharp hljs">public Action Action { get; set; }</code></pre>
  237. </div>
  238. <h5 class="propertyValue">Property Value</h5>
  239. <table class="table table-bordered table-striped table-condensed">
  240. <thead>
  241. <tr>
  242. <th>Type</th>
  243. <th>Description</th>
  244. </tr>
  245. </thead>
  246. <tbody>
  247. <tr>
  248. <td><span class="xref">System.Action</span></td>
  249. <td>Method to invoke.</td>
  250. </tr>
  251. </tbody>
  252. </table>
  253. <a id="Terminal_Gui_MenuItem_CanExecute_" data-uid="Terminal.Gui.MenuItem.CanExecute*"></a>
  254. <h4 id="Terminal_Gui_MenuItem_CanExecute" data-uid="Terminal.Gui.MenuItem.CanExecute">CanExecute</h4>
  255. <div class="markdown level1 summary">
  256. Gets or sets the action to be invoked if the menu can be triggered
  257. </div>
  258. <div class="markdown level1 conceptual"></div>
  259. <h5 class="decalaration">Declaration</h5>
  260. <div class="codewrapper">
  261. <pre><code class="lang-csharp hljs">public Func&lt;bool&gt; CanExecute { get; set; }</code></pre>
  262. </div>
  263. <h5 class="propertyValue">Property Value</h5>
  264. <table class="table table-bordered table-striped table-condensed">
  265. <thead>
  266. <tr>
  267. <th>Type</th>
  268. <th>Description</th>
  269. </tr>
  270. </thead>
  271. <tbody>
  272. <tr>
  273. <td><span class="xref">System.Func</span>&lt;<span class="xref">System.Boolean</span>&gt;</td>
  274. <td>Function to determine if action is ready to be executed.</td>
  275. </tr>
  276. </tbody>
  277. </table>
  278. <a id="Terminal_Gui_MenuItem_Checked_" data-uid="Terminal.Gui.MenuItem.Checked*"></a>
  279. <h4 id="Terminal_Gui_MenuItem_Checked" data-uid="Terminal.Gui.MenuItem.Checked">Checked</h4>
  280. <div class="markdown level1 summary">
  281. 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>.
  282. </div>
  283. <div class="markdown level1 conceptual"></div>
  284. <h5 class="decalaration">Declaration</h5>
  285. <div class="codewrapper">
  286. <pre><code class="lang-csharp hljs">public bool Checked { get; set; }</code></pre>
  287. </div>
  288. <h5 class="propertyValue">Property Value</h5>
  289. <table class="table table-bordered table-striped table-condensed">
  290. <thead>
  291. <tr>
  292. <th>Type</th>
  293. <th>Description</th>
  294. </tr>
  295. </thead>
  296. <tbody>
  297. <tr>
  298. <td><span class="xref">System.Boolean</span></td>
  299. <td></td>
  300. </tr>
  301. </tbody>
  302. </table>
  303. <a id="Terminal_Gui_MenuItem_CheckType_" data-uid="Terminal.Gui.MenuItem.CheckType*"></a>
  304. <h4 id="Terminal_Gui_MenuItem_CheckType" data-uid="Terminal.Gui.MenuItem.CheckType">CheckType</h4>
  305. <div class="markdown level1 summary">
  306. Sets or gets the type selection indicator the menu item will be displayed with.
  307. </div>
  308. <div class="markdown level1 conceptual"></div>
  309. <h5 class="decalaration">Declaration</h5>
  310. <div class="codewrapper">
  311. <pre><code class="lang-csharp hljs">public MenuItemCheckStyle CheckType { get; set; }</code></pre>
  312. </div>
  313. <h5 class="propertyValue">Property Value</h5>
  314. <table class="table table-bordered table-striped table-condensed">
  315. <thead>
  316. <tr>
  317. <th>Type</th>
  318. <th>Description</th>
  319. </tr>
  320. </thead>
  321. <tbody>
  322. <tr>
  323. <td><a class="xref" href="Terminal.Gui.MenuItemCheckStyle.html">MenuItemCheckStyle</a></td>
  324. <td></td>
  325. </tr>
  326. </tbody>
  327. </table>
  328. <a id="Terminal_Gui_MenuItem_Help_" data-uid="Terminal.Gui.MenuItem.Help*"></a>
  329. <h4 id="Terminal_Gui_MenuItem_Help" data-uid="Terminal.Gui.MenuItem.Help">Help</h4>
  330. <div class="markdown level1 summary">
  331. Gets or sets the help text for the menu item.
  332. </div>
  333. <div class="markdown level1 conceptual"></div>
  334. <h5 class="decalaration">Declaration</h5>
  335. <div class="codewrapper">
  336. <pre><code class="lang-csharp hljs">public ustring Help { get; set; }</code></pre>
  337. </div>
  338. <h5 class="propertyValue">Property Value</h5>
  339. <table class="table table-bordered table-striped table-condensed">
  340. <thead>
  341. <tr>
  342. <th>Type</th>
  343. <th>Description</th>
  344. </tr>
  345. </thead>
  346. <tbody>
  347. <tr>
  348. <td><span class="xref">NStack.ustring</span></td>
  349. <td>The help text.</td>
  350. </tr>
  351. </tbody>
  352. </table>
  353. <a id="Terminal_Gui_MenuItem_Parent_" data-uid="Terminal.Gui.MenuItem.Parent*"></a>
  354. <h4 id="Terminal_Gui_MenuItem_Parent" data-uid="Terminal.Gui.MenuItem.Parent">Parent</h4>
  355. <div class="markdown level1 summary">
  356. Gets or sets the parent for this <a class="xref" href="Terminal.Gui.MenuItem.html">MenuItem</a>.
  357. </div>
  358. <div class="markdown level1 conceptual"></div>
  359. <h5 class="decalaration">Declaration</h5>
  360. <div class="codewrapper">
  361. <pre><code class="lang-csharp hljs">public MenuItem Parent { get; }</code></pre>
  362. </div>
  363. <h5 class="propertyValue">Property Value</h5>
  364. <table class="table table-bordered table-striped table-condensed">
  365. <thead>
  366. <tr>
  367. <th>Type</th>
  368. <th>Description</th>
  369. </tr>
  370. </thead>
  371. <tbody>
  372. <tr>
  373. <td><a class="xref" href="Terminal.Gui.MenuItem.html">MenuItem</a></td>
  374. <td>The parent.</td>
  375. </tr>
  376. </tbody>
  377. </table>
  378. <a id="Terminal_Gui_MenuItem_Title_" data-uid="Terminal.Gui.MenuItem.Title*"></a>
  379. <h4 id="Terminal_Gui_MenuItem_Title" data-uid="Terminal.Gui.MenuItem.Title">Title</h4>
  380. <div class="markdown level1 summary">
  381. Gets or sets the title.
  382. </div>
  383. <div class="markdown level1 conceptual"></div>
  384. <h5 class="decalaration">Declaration</h5>
  385. <div class="codewrapper">
  386. <pre><code class="lang-csharp hljs">public ustring Title { get; set; }</code></pre>
  387. </div>
  388. <h5 class="propertyValue">Property Value</h5>
  389. <table class="table table-bordered table-striped table-condensed">
  390. <thead>
  391. <tr>
  392. <th>Type</th>
  393. <th>Description</th>
  394. </tr>
  395. </thead>
  396. <tbody>
  397. <tr>
  398. <td><span class="xref">NStack.ustring</span></td>
  399. <td>The title.</td>
  400. </tr>
  401. </tbody>
  402. </table>
  403. <h3 id="methods">Methods
  404. </h3>
  405. <a id="Terminal_Gui_MenuItem_GetMenuBarItem_" data-uid="Terminal.Gui.MenuItem.GetMenuBarItem*"></a>
  406. <h4 id="Terminal_Gui_MenuItem_GetMenuBarItem" data-uid="Terminal.Gui.MenuItem.GetMenuBarItem">GetMenuBarItem()</h4>
  407. <div class="markdown level1 summary">
  408. Merely a debugging aid to see the interaction with main
  409. </div>
  410. <div class="markdown level1 conceptual"></div>
  411. <h5 class="decalaration">Declaration</h5>
  412. <div class="codewrapper">
  413. <pre><code class="lang-csharp hljs">public bool GetMenuBarItem()</code></pre>
  414. </div>
  415. <h5 class="returns">Returns</h5>
  416. <table class="table table-bordered table-striped table-condensed">
  417. <thead>
  418. <tr>
  419. <th>Type</th>
  420. <th>Description</th>
  421. </tr>
  422. </thead>
  423. <tbody>
  424. <tr>
  425. <td><span class="xref">System.Boolean</span></td>
  426. <td></td>
  427. </tr>
  428. </tbody>
  429. </table>
  430. <a id="Terminal_Gui_MenuItem_GetMenuItem_" data-uid="Terminal.Gui.MenuItem.GetMenuItem*"></a>
  431. <h4 id="Terminal_Gui_MenuItem_GetMenuItem" data-uid="Terminal.Gui.MenuItem.GetMenuItem">GetMenuItem()</h4>
  432. <div class="markdown level1 summary">
  433. Merely a debugging aid to see the interaction with main
  434. </div>
  435. <div class="markdown level1 conceptual"></div>
  436. <h5 class="decalaration">Declaration</h5>
  437. <div class="codewrapper">
  438. <pre><code class="lang-csharp hljs">public MenuItem GetMenuItem()</code></pre>
  439. </div>
  440. <h5 class="returns">Returns</h5>
  441. <table class="table table-bordered table-striped table-condensed">
  442. <thead>
  443. <tr>
  444. <th>Type</th>
  445. <th>Description</th>
  446. </tr>
  447. </thead>
  448. <tbody>
  449. <tr>
  450. <td><a class="xref" href="Terminal.Gui.MenuItem.html">MenuItem</a></td>
  451. <td></td>
  452. </tr>
  453. </tbody>
  454. </table>
  455. <a id="Terminal_Gui_MenuItem_IsEnabled_" data-uid="Terminal.Gui.MenuItem.IsEnabled*"></a>
  456. <h4 id="Terminal_Gui_MenuItem_IsEnabled" data-uid="Terminal.Gui.MenuItem.IsEnabled">IsEnabled()</h4>
  457. <div class="markdown level1 summary">
  458. Shortcut to check if the menu item is enabled
  459. </div>
  460. <div class="markdown level1 conceptual"></div>
  461. <h5 class="decalaration">Declaration</h5>
  462. <div class="codewrapper">
  463. <pre><code class="lang-csharp hljs">public bool IsEnabled()</code></pre>
  464. </div>
  465. <h5 class="returns">Returns</h5>
  466. <table class="table table-bordered table-striped table-condensed">
  467. <thead>
  468. <tr>
  469. <th>Type</th>
  470. <th>Description</th>
  471. </tr>
  472. </thead>
  473. <tbody>
  474. <tr>
  475. <td><span class="xref">System.Boolean</span></td>
  476. <td></td>
  477. </tr>
  478. </tbody>
  479. </table>
  480. </article>
  481. </div>
  482. <div class="hidden-sm col-md-2" role="complementary">
  483. <div class="sideaffix">
  484. <div class="contribution">
  485. <ul class="nav">
  486. </ul>
  487. </div>
  488. <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
  489. <!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
  490. </nav>
  491. </div>
  492. </div>
  493. </div>
  494. </div>
  495. <footer>
  496. <div class="grad-bottom"></div>
  497. <div class="footer">
  498. <div class="container">
  499. <span class="pull-right">
  500. <a href="#top">Back to top</a>
  501. </span>
  502. <span>Generated by <strong>DocFX</strong></span>
  503. </div>
  504. </div>
  505. </footer>
  506. </div>
  507. <script type="text/javascript" src="../../styles/docfx.vendor.js"></script>
  508. <script type="text/javascript" src="../../styles/docfx.js"></script>
  509. <script type="text/javascript" src="../../styles/main.js"></script>
  510. </body>
  511. </html>