Terminal.Gui.MenuItem.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  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.53.1.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. <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
  18. <meta property="docfx:navrel" content="">
  19. <meta property="docfx:tocrel" content="toc.html">
  20. <meta property="docfx:rel" content="../../">
  21. </head> <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_System_String_System_Action_System_Func_System_Boolean__" data-uid="Terminal.Gui.MenuItem.#ctor(NStack.ustring,System.String,System.Action,System.Func{System.Boolean})">MenuItem(ustring, String, Action, Func&lt;Boolean&gt;)</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, string help, Action action, Func&lt;bool&gt; canExecute = 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">System.String</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 executred.</td>
  166. </tr>
  167. </tbody>
  168. </table>
  169. <a id="Terminal_Gui_MenuItem__ctor_" data-uid="Terminal.Gui.MenuItem.#ctor*"></a>
  170. <h4 id="Terminal_Gui_MenuItem__ctor_NStack_ustring_Terminal_Gui_MenuBarItem_" data-uid="Terminal.Gui.MenuItem.#ctor(NStack.ustring,Terminal.Gui.MenuBarItem)">MenuItem(ustring, MenuBarItem)</h4>
  171. <div class="markdown level1 summary">
  172. Initializes a new instance of <a class="xref" href="Terminal.Gui.MenuItem.html">MenuItem</a>
  173. </div>
  174. <div class="markdown level1 conceptual"></div>
  175. <h5 class="decalaration">Declaration</h5>
  176. <div class="codewrapper">
  177. <pre><code class="lang-csharp hljs">public MenuItem(ustring title, MenuBarItem subMenu)</code></pre>
  178. </div>
  179. <h5 class="parameters">Parameters</h5>
  180. <table class="table table-bordered table-striped table-condensed">
  181. <thead>
  182. <tr>
  183. <th>Type</th>
  184. <th>Name</th>
  185. <th>Description</th>
  186. </tr>
  187. </thead>
  188. <tbody>
  189. <tr>
  190. <td><span class="xref">NStack.ustring</span></td>
  191. <td><span class="parametername">title</span></td>
  192. <td>Title for the menu item.</td>
  193. </tr>
  194. <tr>
  195. <td><a class="xref" href="Terminal.Gui.MenuBarItem.html">MenuBarItem</a></td>
  196. <td><span class="parametername">subMenu</span></td>
  197. <td>The menu sub-menu.</td>
  198. </tr>
  199. </tbody>
  200. </table>
  201. <h3 id="fields">Fields
  202. </h3>
  203. <h4 id="Terminal_Gui_MenuItem_HotKey" data-uid="Terminal.Gui.MenuItem.HotKey">HotKey</h4>
  204. <div class="markdown level1 summary">
  205. The HotKey is used when the menu is active, the shortcut can be triggered when the menu is not active.
  206. For example HotKey would be &quot;N&quot; when the File Menu is open (assuming there is a &quot;_New&quot; entry
  207. if the ShortCut is set to &quot;Control-N&quot;, this would be a global hotkey that would trigger as well
  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 Rune HotKey</code></pre>
  213. </div>
  214. <h5 class="fieldValue">Field 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.Rune</span></td>
  225. <td></td>
  226. </tr>
  227. </tbody>
  228. </table>
  229. <h4 id="Terminal_Gui_MenuItem_ShortCut" data-uid="Terminal.Gui.MenuItem.ShortCut">ShortCut</h4>
  230. <div class="markdown level1 summary">
  231. This is the global setting that can be used as a global shortcut to invoke the action on the menu.
  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 Key ShortCut</code></pre>
  237. </div>
  238. <h5 class="fieldValue">Field 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><a class="xref" href="Terminal.Gui.Key.html">Key</a></td>
  249. <td></td>
  250. </tr>
  251. </tbody>
  252. </table>
  253. <h3 id="properties">Properties
  254. </h3>
  255. <a id="Terminal_Gui_MenuItem_Action_" data-uid="Terminal.Gui.MenuItem.Action*"></a>
  256. <h4 id="Terminal_Gui_MenuItem_Action" data-uid="Terminal.Gui.MenuItem.Action">Action</h4>
  257. <div class="markdown level1 summary">
  258. Gets or sets the action to be invoked when the menu is triggered
  259. </div>
  260. <div class="markdown level1 conceptual"></div>
  261. <h5 class="decalaration">Declaration</h5>
  262. <div class="codewrapper">
  263. <pre><code class="lang-csharp hljs">public Action Action { get; set; }</code></pre>
  264. </div>
  265. <h5 class="propertyValue">Property Value</h5>
  266. <table class="table table-bordered table-striped table-condensed">
  267. <thead>
  268. <tr>
  269. <th>Type</th>
  270. <th>Description</th>
  271. </tr>
  272. </thead>
  273. <tbody>
  274. <tr>
  275. <td><span class="xref">System.Action</span></td>
  276. <td>Method to invoke.</td>
  277. </tr>
  278. </tbody>
  279. </table>
  280. <a id="Terminal_Gui_MenuItem_CanExecute_" data-uid="Terminal.Gui.MenuItem.CanExecute*"></a>
  281. <h4 id="Terminal_Gui_MenuItem_CanExecute" data-uid="Terminal.Gui.MenuItem.CanExecute">CanExecute</h4>
  282. <div class="markdown level1 summary">
  283. Gets or sets the action to be invoked if the menu can be triggered
  284. </div>
  285. <div class="markdown level1 conceptual"></div>
  286. <h5 class="decalaration">Declaration</h5>
  287. <div class="codewrapper">
  288. <pre><code class="lang-csharp hljs">public Func&lt;bool&gt; CanExecute { get; set; }</code></pre>
  289. </div>
  290. <h5 class="propertyValue">Property Value</h5>
  291. <table class="table table-bordered table-striped table-condensed">
  292. <thead>
  293. <tr>
  294. <th>Type</th>
  295. <th>Description</th>
  296. </tr>
  297. </thead>
  298. <tbody>
  299. <tr>
  300. <td><span class="xref">System.Func</span>&lt;<span class="xref">System.Boolean</span>&gt;</td>
  301. <td>Function to determine if action is ready to be executed.</td>
  302. </tr>
  303. </tbody>
  304. </table>
  305. <a id="Terminal_Gui_MenuItem_Help_" data-uid="Terminal.Gui.MenuItem.Help*"></a>
  306. <h4 id="Terminal_Gui_MenuItem_Help" data-uid="Terminal.Gui.MenuItem.Help">Help</h4>
  307. <div class="markdown level1 summary">
  308. Gets or sets the help text for the menu item.
  309. </div>
  310. <div class="markdown level1 conceptual"></div>
  311. <h5 class="decalaration">Declaration</h5>
  312. <div class="codewrapper">
  313. <pre><code class="lang-csharp hljs">public ustring Help { get; set; }</code></pre>
  314. </div>
  315. <h5 class="propertyValue">Property Value</h5>
  316. <table class="table table-bordered table-striped table-condensed">
  317. <thead>
  318. <tr>
  319. <th>Type</th>
  320. <th>Description</th>
  321. </tr>
  322. </thead>
  323. <tbody>
  324. <tr>
  325. <td><span class="xref">NStack.ustring</span></td>
  326. <td>The help text.</td>
  327. </tr>
  328. </tbody>
  329. </table>
  330. <a id="Terminal_Gui_MenuItem_Title_" data-uid="Terminal.Gui.MenuItem.Title*"></a>
  331. <h4 id="Terminal_Gui_MenuItem_Title" data-uid="Terminal.Gui.MenuItem.Title">Title</h4>
  332. <div class="markdown level1 summary">
  333. Gets or sets the title.
  334. </div>
  335. <div class="markdown level1 conceptual"></div>
  336. <h5 class="decalaration">Declaration</h5>
  337. <div class="codewrapper">
  338. <pre><code class="lang-csharp hljs">public ustring Title { get; set; }</code></pre>
  339. </div>
  340. <h5 class="propertyValue">Property Value</h5>
  341. <table class="table table-bordered table-striped table-condensed">
  342. <thead>
  343. <tr>
  344. <th>Type</th>
  345. <th>Description</th>
  346. </tr>
  347. </thead>
  348. <tbody>
  349. <tr>
  350. <td><span class="xref">NStack.ustring</span></td>
  351. <td>The title.</td>
  352. </tr>
  353. </tbody>
  354. </table>
  355. <h3 id="methods">Methods
  356. </h3>
  357. <a id="Terminal_Gui_MenuItem_GetMenuBarItem_" data-uid="Terminal.Gui.MenuItem.GetMenuBarItem*"></a>
  358. <h4 id="Terminal_Gui_MenuItem_GetMenuBarItem" data-uid="Terminal.Gui.MenuItem.GetMenuBarItem">GetMenuBarItem()</h4>
  359. <div class="markdown level1 summary">
  360. Merely a debugging aid to see the interaction with main
  361. </div>
  362. <div class="markdown level1 conceptual"></div>
  363. <h5 class="decalaration">Declaration</h5>
  364. <div class="codewrapper">
  365. <pre><code class="lang-csharp hljs">public bool GetMenuBarItem()</code></pre>
  366. </div>
  367. <h5 class="returns">Returns</h5>
  368. <table class="table table-bordered table-striped table-condensed">
  369. <thead>
  370. <tr>
  371. <th>Type</th>
  372. <th>Description</th>
  373. </tr>
  374. </thead>
  375. <tbody>
  376. <tr>
  377. <td><span class="xref">System.Boolean</span></td>
  378. <td></td>
  379. </tr>
  380. </tbody>
  381. </table>
  382. <a id="Terminal_Gui_MenuItem_GetMenuItem_" data-uid="Terminal.Gui.MenuItem.GetMenuItem*"></a>
  383. <h4 id="Terminal_Gui_MenuItem_GetMenuItem" data-uid="Terminal.Gui.MenuItem.GetMenuItem">GetMenuItem()</h4>
  384. <div class="markdown level1 summary">
  385. Merely a debugging aid to see the interaction with main
  386. </div>
  387. <div class="markdown level1 conceptual"></div>
  388. <h5 class="decalaration">Declaration</h5>
  389. <div class="codewrapper">
  390. <pre><code class="lang-csharp hljs">public MenuItem GetMenuItem()</code></pre>
  391. </div>
  392. <h5 class="returns">Returns</h5>
  393. <table class="table table-bordered table-striped table-condensed">
  394. <thead>
  395. <tr>
  396. <th>Type</th>
  397. <th>Description</th>
  398. </tr>
  399. </thead>
  400. <tbody>
  401. <tr>
  402. <td><a class="xref" href="Terminal.Gui.MenuItem.html">MenuItem</a></td>
  403. <td></td>
  404. </tr>
  405. </tbody>
  406. </table>
  407. <a id="Terminal_Gui_MenuItem_IsEnabled_" data-uid="Terminal.Gui.MenuItem.IsEnabled*"></a>
  408. <h4 id="Terminal_Gui_MenuItem_IsEnabled" data-uid="Terminal.Gui.MenuItem.IsEnabled">IsEnabled()</h4>
  409. <div class="markdown level1 summary">
  410. Shortcut to check if the menu item is enabled
  411. </div>
  412. <div class="markdown level1 conceptual"></div>
  413. <h5 class="decalaration">Declaration</h5>
  414. <div class="codewrapper">
  415. <pre><code class="lang-csharp hljs">public bool IsEnabled()</code></pre>
  416. </div>
  417. <h5 class="returns">Returns</h5>
  418. <table class="table table-bordered table-striped table-condensed">
  419. <thead>
  420. <tr>
  421. <th>Type</th>
  422. <th>Description</th>
  423. </tr>
  424. </thead>
  425. <tbody>
  426. <tr>
  427. <td><span class="xref">System.Boolean</span></td>
  428. <td></td>
  429. </tr>
  430. </tbody>
  431. </table>
  432. </article>
  433. </div>
  434. <div class="hidden-sm col-md-2" role="complementary">
  435. <div class="sideaffix">
  436. <div class="contribution">
  437. <ul class="nav">
  438. </ul>
  439. </div>
  440. <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
  441. <!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
  442. </nav>
  443. </div>
  444. </div>
  445. </div>
  446. </div>
  447. <footer>
  448. <div class="grad-bottom"></div>
  449. <div class="footer">
  450. <div class="container">
  451. <span class="pull-right">
  452. <a href="#top">Back to top</a>
  453. </span>
  454. <span>Generated by <strong>DocFX</strong></span>
  455. </div>
  456. </div>
  457. </footer>
  458. </div>
  459. <script type="text/javascript" src="../../styles/docfx.vendor.js"></script>
  460. <script type="text/javascript" src="../../styles/docfx.js"></script>
  461. <script type="text/javascript" src="../../styles/main.js"></script>
  462. </body>
  463. </html>