Terminal.Gui.Application.html 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859
  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 Application
  8. </title>
  9. <meta name="viewport" content="width=device-width">
  10. <meta name="title" content="Class Application
  11. ">
  12. <meta name="generator" content="docfx 2.54.0.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.Application">
  73. <h1 id="Terminal_Gui_Application" data-uid="Terminal.Gui.Application" class="text-break">Class Application
  74. </h1>
  75. <div class="markdown level0 summary">
  76. A static, singelton class provding the main application driver for Terminal.Gui apps.
  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">Application</span></div>
  83. </div>
  84. <div class="inheritedMembers">
  85. <h5>Inherited Members</h5>
  86. <div>
  87. <span class="xref">System.Object.Equals(System.Object)</span>
  88. </div>
  89. <div>
  90. <span class="xref">System.Object.Equals(System.Object, System.Object)</span>
  91. </div>
  92. <div>
  93. <span class="xref">System.Object.GetHashCode()</span>
  94. </div>
  95. <div>
  96. <span class="xref">System.Object.GetType()</span>
  97. </div>
  98. <div>
  99. <span class="xref">System.Object.MemberwiseClone()</span>
  100. </div>
  101. <div>
  102. <span class="xref">System.Object.ReferenceEquals(System.Object, System.Object)</span>
  103. </div>
  104. <div>
  105. <span class="xref">System.Object.ToString()</span>
  106. </div>
  107. </div>
  108. <h6><strong>Namespace</strong>: <a class="xref" href="Terminal.Gui.html">Terminal.Gui</a></h6>
  109. <h6><strong>Assembly</strong>: Terminal.Gui.dll</h6>
  110. <h5 id="Terminal_Gui_Application_syntax">Syntax</h5>
  111. <div class="codewrapper">
  112. <pre><code class="lang-csharp hljs">public static class Application</code></pre>
  113. </div>
  114. <h5 id="Terminal_Gui_Application_remarks"><strong>Remarks</strong></h5>
  115. <div class="markdown level0 remarks">
  116. <p>
  117. Creates a instance of <a class="xref" href="Terminal.Gui.MainLoop.html">MainLoop</a> to process input events, handle timers and
  118. other sources of data. It is accessible via the <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_MainLoop">MainLoop</a> property.
  119. </p>
  120. <p>
  121. You can hook up to the <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Iteration">Iteration</a> event to have your method
  122. invoked on each iteration of the <a class="xref" href="Terminal.Gui.MainLoop.html">MainLoop</a>.
  123. </p>
  124. <p>
  125. When invoked sets the SynchronizationContext to one that is tied
  126. to the mainloop, allowing user code to use async/await.
  127. </p>
  128. </div>
  129. <h5 id="Terminal_Gui_Application_examples"><strong>Examples</strong></h5>
  130. <pre><code>// A simple Terminal.Gui app that creates a window with a frame and title with
  131. // 5 rows/columns of padding.
  132. Application.Init();
  133. var win = new Window (&quot;Hello World - CTRL-Q to quit&quot;) {
  134. X = 5,
  135. Y = 5,
  136. Width = Dim.Fill (5),
  137. Height = Dim.Fill (5)
  138. };
  139. Application.Top.Add(win);
  140. Application.Run();</code></pre>
  141. <h3 id="fields">Fields
  142. </h3>
  143. <h4 id="Terminal_Gui_Application_Driver" data-uid="Terminal.Gui.Application.Driver">Driver</h4>
  144. <div class="markdown level1 summary">
  145. The current <a class="xref" href="Terminal.Gui.ConsoleDriver.html">ConsoleDriver</a> in use.
  146. </div>
  147. <div class="markdown level1 conceptual"></div>
  148. <h5 class="decalaration">Declaration</h5>
  149. <div class="codewrapper">
  150. <pre><code class="lang-csharp hljs">public static ConsoleDriver Driver</code></pre>
  151. </div>
  152. <h5 class="fieldValue">Field Value</h5>
  153. <table class="table table-bordered table-striped table-condensed">
  154. <thead>
  155. <tr>
  156. <th>Type</th>
  157. <th>Description</th>
  158. </tr>
  159. </thead>
  160. <tbody>
  161. <tr>
  162. <td><a class="xref" href="Terminal.Gui.ConsoleDriver.html">ConsoleDriver</a></td>
  163. <td></td>
  164. </tr>
  165. </tbody>
  166. </table>
  167. <h4 id="Terminal_Gui_Application_RootMouseEvent" data-uid="Terminal.Gui.Application.RootMouseEvent">RootMouseEvent</h4>
  168. <div class="markdown level1 summary">
  169. Merely a debugging aid to see the raw mouse events
  170. </div>
  171. <div class="markdown level1 conceptual"></div>
  172. <h5 class="decalaration">Declaration</h5>
  173. <div class="codewrapper">
  174. <pre><code class="lang-csharp hljs">public static Action&lt;MouseEvent&gt; RootMouseEvent</code></pre>
  175. </div>
  176. <h5 class="fieldValue">Field Value</h5>
  177. <table class="table table-bordered table-striped table-condensed">
  178. <thead>
  179. <tr>
  180. <th>Type</th>
  181. <th>Description</th>
  182. </tr>
  183. </thead>
  184. <tbody>
  185. <tr>
  186. <td><span class="xref">System.Action</span>&lt;<a class="xref" href="Terminal.Gui.MouseEvent.html">MouseEvent</a>&gt;</td>
  187. <td></td>
  188. </tr>
  189. </tbody>
  190. </table>
  191. <h4 id="Terminal_Gui_Application_UseSystemConsole" data-uid="Terminal.Gui.Application.UseSystemConsole">UseSystemConsole</h4>
  192. <div class="markdown level1 summary">
  193. If set, it forces the use of the System.Console-based driver.
  194. </div>
  195. <div class="markdown level1 conceptual"></div>
  196. <h5 class="decalaration">Declaration</h5>
  197. <div class="codewrapper">
  198. <pre><code class="lang-csharp hljs">public static bool UseSystemConsole</code></pre>
  199. </div>
  200. <h5 class="fieldValue">Field Value</h5>
  201. <table class="table table-bordered table-striped table-condensed">
  202. <thead>
  203. <tr>
  204. <th>Type</th>
  205. <th>Description</th>
  206. </tr>
  207. </thead>
  208. <tbody>
  209. <tr>
  210. <td><span class="xref">System.Boolean</span></td>
  211. <td></td>
  212. </tr>
  213. </tbody>
  214. </table>
  215. <h3 id="properties">Properties
  216. </h3>
  217. <a id="Terminal_Gui_Application_Current_" data-uid="Terminal.Gui.Application.Current*"></a>
  218. <h4 id="Terminal_Gui_Application_Current" data-uid="Terminal.Gui.Application.Current">Current</h4>
  219. <div class="markdown level1 summary">
  220. The current <a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a> object. This is updated when <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Run">Run()</a> enters and leaves to point to the current <a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a> .
  221. </div>
  222. <div class="markdown level1 conceptual"></div>
  223. <h5 class="decalaration">Declaration</h5>
  224. <div class="codewrapper">
  225. <pre><code class="lang-csharp hljs">public static Toplevel Current { get; }</code></pre>
  226. </div>
  227. <h5 class="propertyValue">Property Value</h5>
  228. <table class="table table-bordered table-striped table-condensed">
  229. <thead>
  230. <tr>
  231. <th>Type</th>
  232. <th>Description</th>
  233. </tr>
  234. </thead>
  235. <tbody>
  236. <tr>
  237. <td><a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a></td>
  238. <td>The current.</td>
  239. </tr>
  240. </tbody>
  241. </table>
  242. <a id="Terminal_Gui_Application_CurrentView_" data-uid="Terminal.Gui.Application.CurrentView*"></a>
  243. <h4 id="Terminal_Gui_Application_CurrentView" data-uid="Terminal.Gui.Application.CurrentView">CurrentView</h4>
  244. <div class="markdown level1 summary">
  245. TThe current <a class="xref" href="Terminal.Gui.View.html">View</a> object being redrawn.
  246. </div>
  247. <div class="markdown level1 conceptual"></div>
  248. <h5 class="decalaration">Declaration</h5>
  249. <div class="codewrapper">
  250. <pre><code class="lang-csharp hljs">public static View CurrentView { get; set; }</code></pre>
  251. </div>
  252. <h5 class="propertyValue">Property Value</h5>
  253. <table class="table table-bordered table-striped table-condensed">
  254. <thead>
  255. <tr>
  256. <th>Type</th>
  257. <th>Description</th>
  258. </tr>
  259. </thead>
  260. <tbody>
  261. <tr>
  262. <td><a class="xref" href="Terminal.Gui.View.html">View</a></td>
  263. <td>The current.</td>
  264. </tr>
  265. </tbody>
  266. </table>
  267. <a id="Terminal_Gui_Application_MainLoop_" data-uid="Terminal.Gui.Application.MainLoop*"></a>
  268. <h4 id="Terminal_Gui_Application_MainLoop" data-uid="Terminal.Gui.Application.MainLoop">MainLoop</h4>
  269. <div class="markdown level1 summary">
  270. The <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_MainLoop">MainLoop</a> driver for the applicaiton
  271. </div>
  272. <div class="markdown level1 conceptual"></div>
  273. <h5 class="decalaration">Declaration</h5>
  274. <div class="codewrapper">
  275. <pre><code class="lang-csharp hljs">public static MainLoop MainLoop { get; }</code></pre>
  276. </div>
  277. <h5 class="propertyValue">Property Value</h5>
  278. <table class="table table-bordered table-striped table-condensed">
  279. <thead>
  280. <tr>
  281. <th>Type</th>
  282. <th>Description</th>
  283. </tr>
  284. </thead>
  285. <tbody>
  286. <tr>
  287. <td><a class="xref" href="Terminal.Gui.MainLoop.html">MainLoop</a></td>
  288. <td>The main loop.</td>
  289. </tr>
  290. </tbody>
  291. </table>
  292. <a id="Terminal_Gui_Application_Top_" data-uid="Terminal.Gui.Application.Top*"></a>
  293. <h4 id="Terminal_Gui_Application_Top" data-uid="Terminal.Gui.Application.Top">Top</h4>
  294. <div class="markdown level1 summary">
  295. The <a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a> object used for the application on startup (<a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Top">Top</a>)
  296. </div>
  297. <div class="markdown level1 conceptual"></div>
  298. <h5 class="decalaration">Declaration</h5>
  299. <div class="codewrapper">
  300. <pre><code class="lang-csharp hljs">public static Toplevel Top { get; }</code></pre>
  301. </div>
  302. <h5 class="propertyValue">Property Value</h5>
  303. <table class="table table-bordered table-striped table-condensed">
  304. <thead>
  305. <tr>
  306. <th>Type</th>
  307. <th>Description</th>
  308. </tr>
  309. </thead>
  310. <tbody>
  311. <tr>
  312. <td><a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a></td>
  313. <td>The top.</td>
  314. </tr>
  315. </tbody>
  316. </table>
  317. <h3 id="methods">Methods
  318. </h3>
  319. <a id="Terminal_Gui_Application_Begin_" data-uid="Terminal.Gui.Application.Begin*"></a>
  320. <h4 id="Terminal_Gui_Application_Begin_Terminal_Gui_Toplevel_" data-uid="Terminal.Gui.Application.Begin(Terminal.Gui.Toplevel)">Begin(Toplevel)</h4>
  321. <div class="markdown level1 summary">
  322. Building block API: Prepares the provided <a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a> for execution.
  323. </div>
  324. <div class="markdown level1 conceptual"></div>
  325. <h5 class="decalaration">Declaration</h5>
  326. <div class="codewrapper">
  327. <pre><code class="lang-csharp hljs">public static Application.RunState Begin(Toplevel toplevel)</code></pre>
  328. </div>
  329. <h5 class="parameters">Parameters</h5>
  330. <table class="table table-bordered table-striped table-condensed">
  331. <thead>
  332. <tr>
  333. <th>Type</th>
  334. <th>Name</th>
  335. <th>Description</th>
  336. </tr>
  337. </thead>
  338. <tbody>
  339. <tr>
  340. <td><a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a></td>
  341. <td><span class="parametername">toplevel</span></td>
  342. <td>Toplevel to prepare execution for.</td>
  343. </tr>
  344. </tbody>
  345. </table>
  346. <h5 class="returns">Returns</h5>
  347. <table class="table table-bordered table-striped table-condensed">
  348. <thead>
  349. <tr>
  350. <th>Type</th>
  351. <th>Description</th>
  352. </tr>
  353. </thead>
  354. <tbody>
  355. <tr>
  356. <td><a class="xref" href="Terminal.Gui.Application.RunState.html">Application.RunState</a></td>
  357. <td>The runstate handle that needs to be passed to the <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_End_Terminal_Gui_Application_RunState_System_Boolean_">End(Application.RunState, Boolean)</a> method upon completion.</td>
  358. </tr>
  359. </tbody>
  360. </table>
  361. <h5 id="Terminal_Gui_Application_Begin_Terminal_Gui_Toplevel__remarks">Remarks</h5>
  362. <div class="markdown level1 remarks">
  363. This method prepares the provided toplevel for running with the focus,
  364. it adds this to the list of toplevels, sets up the mainloop to process the
  365. event, lays out the subviews, focuses the first element, and draws the
  366. toplevel in the screen. This is usually followed by executing
  367. the <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_RunLoop_Terminal_Gui_Application_RunState_System_Boolean_">RunLoop(Application.RunState, Boolean)</a> method, and then the <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_End_Terminal_Gui_Application_RunState_System_Boolean_">End(Application.RunState, Boolean)</a> method upon termination which will
  368. undo these changes.
  369. </div>
  370. <a id="Terminal_Gui_Application_End_" data-uid="Terminal.Gui.Application.End*"></a>
  371. <h4 id="Terminal_Gui_Application_End_Terminal_Gui_Application_RunState_System_Boolean_" data-uid="Terminal.Gui.Application.End(Terminal.Gui.Application.RunState,System.Boolean)">End(Application.RunState, Boolean)</h4>
  372. <div class="markdown level1 summary">
  373. Building block API: completes the execution of a <a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a> that was started with <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Begin_Terminal_Gui_Toplevel_">Begin(Toplevel)</a> .
  374. </div>
  375. <div class="markdown level1 conceptual"></div>
  376. <h5 class="decalaration">Declaration</h5>
  377. <div class="codewrapper">
  378. <pre><code class="lang-csharp hljs">public static void End(Application.RunState runState, bool closeDriver = true)</code></pre>
  379. </div>
  380. <h5 class="parameters">Parameters</h5>
  381. <table class="table table-bordered table-striped table-condensed">
  382. <thead>
  383. <tr>
  384. <th>Type</th>
  385. <th>Name</th>
  386. <th>Description</th>
  387. </tr>
  388. </thead>
  389. <tbody>
  390. <tr>
  391. <td><a class="xref" href="Terminal.Gui.Application.RunState.html">Application.RunState</a></td>
  392. <td><span class="parametername">runState</span></td>
  393. <td>The runstate returned by the <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Begin_Terminal_Gui_Toplevel_">Begin(Toplevel)</a> method.</td>
  394. </tr>
  395. <tr>
  396. <td><span class="xref">System.Boolean</span></td>
  397. <td><span class="parametername">closeDriver</span></td>
  398. <td><code>true</code>Closes the application.<code>false</code>Closes the toplevels only.</td>
  399. </tr>
  400. </tbody>
  401. </table>
  402. <a id="Terminal_Gui_Application_GrabMouse_" data-uid="Terminal.Gui.Application.GrabMouse*"></a>
  403. <h4 id="Terminal_Gui_Application_GrabMouse_Terminal_Gui_View_" data-uid="Terminal.Gui.Application.GrabMouse(Terminal.Gui.View)">GrabMouse(View)</h4>
  404. <div class="markdown level1 summary">
  405. Grabs the mouse, forcing all mouse events to be routed to the specified view until UngrabMouse is called.
  406. </div>
  407. <div class="markdown level1 conceptual"></div>
  408. <h5 class="decalaration">Declaration</h5>
  409. <div class="codewrapper">
  410. <pre><code class="lang-csharp hljs">public static void GrabMouse(View view)</code></pre>
  411. </div>
  412. <h5 class="parameters">Parameters</h5>
  413. <table class="table table-bordered table-striped table-condensed">
  414. <thead>
  415. <tr>
  416. <th>Type</th>
  417. <th>Name</th>
  418. <th>Description</th>
  419. </tr>
  420. </thead>
  421. <tbody>
  422. <tr>
  423. <td><a class="xref" href="Terminal.Gui.View.html">View</a></td>
  424. <td><span class="parametername">view</span></td>
  425. <td>View that will receive all mouse events until UngrabMouse is invoked.</td>
  426. </tr>
  427. </tbody>
  428. </table>
  429. <a id="Terminal_Gui_Application_Init_" data-uid="Terminal.Gui.Application.Init*"></a>
  430. <h4 id="Terminal_Gui_Application_Init" data-uid="Terminal.Gui.Application.Init">Init()</h4>
  431. <div class="markdown level1 summary">
  432. Initializes a new instance of <a class="xref" href="Terminal.Gui.html">Terminal.Gui</a> Application.
  433. </div>
  434. <div class="markdown level1 conceptual"></div>
  435. <h5 class="decalaration">Declaration</h5>
  436. <div class="codewrapper">
  437. <pre><code class="lang-csharp hljs">public static void Init()</code></pre>
  438. </div>
  439. <h5 id="Terminal_Gui_Application_Init_remarks">Remarks</h5>
  440. <div class="markdown level1 remarks">
  441. <p>
  442. Call this method once per instance (or after <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Shutdown_System_Boolean_">Shutdown(Boolean)</a> has been called).
  443. </p>
  444. <p>
  445. Loads the right <a class="xref" href="Terminal.Gui.ConsoleDriver.html">ConsoleDriver</a> for the platform.
  446. </p>
  447. <p>
  448. Creates a <a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a> and assigns it to <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Top">Top</a> and <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_CurrentView">CurrentView</a>
  449. </p>
  450. </div>
  451. <a id="Terminal_Gui_Application_MakeCenteredRect_" data-uid="Terminal.Gui.Application.MakeCenteredRect*"></a>
  452. <h4 id="Terminal_Gui_Application_MakeCenteredRect_Terminal_Gui_Size_" data-uid="Terminal.Gui.Application.MakeCenteredRect(Terminal.Gui.Size)">MakeCenteredRect(Size)</h4>
  453. <div class="markdown level1 summary">
  454. Returns a rectangle that is centered in the screen for the provided size.
  455. </div>
  456. <div class="markdown level1 conceptual"></div>
  457. <h5 class="decalaration">Declaration</h5>
  458. <div class="codewrapper">
  459. <pre><code class="lang-csharp hljs">public static Rect MakeCenteredRect(Size size)</code></pre>
  460. </div>
  461. <h5 class="parameters">Parameters</h5>
  462. <table class="table table-bordered table-striped table-condensed">
  463. <thead>
  464. <tr>
  465. <th>Type</th>
  466. <th>Name</th>
  467. <th>Description</th>
  468. </tr>
  469. </thead>
  470. <tbody>
  471. <tr>
  472. <td><a class="xref" href="Terminal.Gui.Size.html">Size</a></td>
  473. <td><span class="parametername">size</span></td>
  474. <td>Size for the rectangle.</td>
  475. </tr>
  476. </tbody>
  477. </table>
  478. <h5 class="returns">Returns</h5>
  479. <table class="table table-bordered table-striped table-condensed">
  480. <thead>
  481. <tr>
  482. <th>Type</th>
  483. <th>Description</th>
  484. </tr>
  485. </thead>
  486. <tbody>
  487. <tr>
  488. <td><a class="xref" href="Terminal.Gui.Rect.html">Rect</a></td>
  489. <td>The centered rect.</td>
  490. </tr>
  491. </tbody>
  492. </table>
  493. <a id="Terminal_Gui_Application_Refresh_" data-uid="Terminal.Gui.Application.Refresh*"></a>
  494. <h4 id="Terminal_Gui_Application_Refresh" data-uid="Terminal.Gui.Application.Refresh">Refresh()</h4>
  495. <div class="markdown level1 summary">
  496. Triggers a refresh of the entire display.
  497. </div>
  498. <div class="markdown level1 conceptual"></div>
  499. <h5 class="decalaration">Declaration</h5>
  500. <div class="codewrapper">
  501. <pre><code class="lang-csharp hljs">public static void Refresh()</code></pre>
  502. </div>
  503. <a id="Terminal_Gui_Application_RequestStop_" data-uid="Terminal.Gui.Application.RequestStop*"></a>
  504. <h4 id="Terminal_Gui_Application_RequestStop" data-uid="Terminal.Gui.Application.RequestStop">RequestStop()</h4>
  505. <div class="markdown level1 summary">
  506. Stops running the most recent <a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a>.
  507. </div>
  508. <div class="markdown level1 conceptual"></div>
  509. <h5 class="decalaration">Declaration</h5>
  510. <div class="codewrapper">
  511. <pre><code class="lang-csharp hljs">public static void RequestStop()</code></pre>
  512. </div>
  513. <h5 id="Terminal_Gui_Application_RequestStop_remarks">Remarks</h5>
  514. <div class="markdown level1 remarks">
  515. <p>
  516. This will cause <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Run">Run()</a> to return.
  517. </p>
  518. <p>
  519. Calling <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_RequestStop">RequestStop()</a> is equivalent to setting the <a class="xref" href="Terminal.Gui.Toplevel.html#Terminal_Gui_Toplevel_Running">Running</a> property on the curently running <a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a> to false.
  520. </p>
  521. </div>
  522. <a id="Terminal_Gui_Application_Run_" data-uid="Terminal.Gui.Application.Run*"></a>
  523. <h4 id="Terminal_Gui_Application_Run" data-uid="Terminal.Gui.Application.Run">Run()</h4>
  524. <div class="markdown level1 summary">
  525. Runs the application by calling <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Run_Terminal_Gui_Toplevel_System_Boolean_">Run(Toplevel, Boolean)</a> with the value of <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Top">Top</a>
  526. </div>
  527. <div class="markdown level1 conceptual"></div>
  528. <h5 class="decalaration">Declaration</h5>
  529. <div class="codewrapper">
  530. <pre><code class="lang-csharp hljs">public static void Run()</code></pre>
  531. </div>
  532. <a id="Terminal_Gui_Application_Run_" data-uid="Terminal.Gui.Application.Run*"></a>
  533. <h4 id="Terminal_Gui_Application_Run_Terminal_Gui_Toplevel_System_Boolean_" data-uid="Terminal.Gui.Application.Run(Terminal.Gui.Toplevel,System.Boolean)">Run(Toplevel, Boolean)</h4>
  534. <div class="markdown level1 summary">
  535. Runs the main loop on the given <a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a> container.
  536. </div>
  537. <div class="markdown level1 conceptual"></div>
  538. <h5 class="decalaration">Declaration</h5>
  539. <div class="codewrapper">
  540. <pre><code class="lang-csharp hljs">public static void Run(Toplevel view, bool closeDriver = true)</code></pre>
  541. </div>
  542. <h5 class="parameters">Parameters</h5>
  543. <table class="table table-bordered table-striped table-condensed">
  544. <thead>
  545. <tr>
  546. <th>Type</th>
  547. <th>Name</th>
  548. <th>Description</th>
  549. </tr>
  550. </thead>
  551. <tbody>
  552. <tr>
  553. <td><a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a></td>
  554. <td><span class="parametername">view</span></td>
  555. <td></td>
  556. </tr>
  557. <tr>
  558. <td><span class="xref">System.Boolean</span></td>
  559. <td><span class="parametername">closeDriver</span></td>
  560. <td></td>
  561. </tr>
  562. </tbody>
  563. </table>
  564. <h5 id="Terminal_Gui_Application_Run_Terminal_Gui_Toplevel_System_Boolean__remarks">Remarks</h5>
  565. <div class="markdown level1 remarks">
  566. <p>
  567. This method is used to start processing events
  568. for the main application, but it is also used to
  569. run other modal <a class="xref" href="Terminal.Gui.View.html">View</a>s such as <a class="xref" href="Terminal.Gui.Dialog.html">Dialog</a> boxes.
  570. </p>
  571. <p>
  572. To make a <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Run_Terminal_Gui_Toplevel_System_Boolean_">Run(Toplevel, Boolean)</a> stop execution, call <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_RequestStop">RequestStop()</a>.
  573. </p>
  574. <p>
  575. Calling <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Run_Terminal_Gui_Toplevel_System_Boolean_">Run(Toplevel, Boolean)</a> is equivalent to calling <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Begin_Terminal_Gui_Toplevel_">Begin(Toplevel)</a>, followed by <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_RunLoop_Terminal_Gui_Application_RunState_System_Boolean_">RunLoop(Application.RunState, Boolean)</a>,
  576. and then calling <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_End_Terminal_Gui_Application_RunState_System_Boolean_">End(Application.RunState, Boolean)</a>.
  577. </p>
  578. <p>
  579. Alternatively, to have a program control the main loop and
  580. process events manually, call <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Begin_Terminal_Gui_Toplevel_">Begin(Toplevel)</a> to set things up manually and then
  581. repeatedly call <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_RunLoop_Terminal_Gui_Application_RunState_System_Boolean_">RunLoop(Application.RunState, Boolean)</a> with the wait parameter set to false. By doing this
  582. the <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_RunLoop_Terminal_Gui_Application_RunState_System_Boolean_">RunLoop(Application.RunState, Boolean)</a> method will only process any pending events, timers, idle handlers and
  583. then return control immediately.
  584. </p>
  585. </div>
  586. <a id="Terminal_Gui_Application_Run_" data-uid="Terminal.Gui.Application.Run*"></a>
  587. <h4 id="Terminal_Gui_Application_Run__1" data-uid="Terminal.Gui.Application.Run``1">Run&lt;T&gt;()</h4>
  588. <div class="markdown level1 summary">
  589. Runs the application by calling <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Run_Terminal_Gui_Toplevel_System_Boolean_">Run(Toplevel, Boolean)</a> with a new instance of the specified <a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a>-derived class
  590. </div>
  591. <div class="markdown level1 conceptual"></div>
  592. <h5 class="decalaration">Declaration</h5>
  593. <div class="codewrapper">
  594. <pre><code class="lang-csharp hljs">public static void Run&lt;T&gt;()
  595. where T : Toplevel, new()</code></pre>
  596. </div>
  597. <h5 class="typeParameters">Type Parameters</h5>
  598. <table class="table table-bordered table-striped table-condensed">
  599. <thead>
  600. <tr>
  601. <th>Name</th>
  602. <th>Description</th>
  603. </tr>
  604. </thead>
  605. <tbody>
  606. <tr>
  607. <td><span class="parametername">T</span></td>
  608. <td></td>
  609. </tr>
  610. </tbody>
  611. </table>
  612. <a id="Terminal_Gui_Application_RunLoop_" data-uid="Terminal.Gui.Application.RunLoop*"></a>
  613. <h4 id="Terminal_Gui_Application_RunLoop_Terminal_Gui_Application_RunState_System_Boolean_" data-uid="Terminal.Gui.Application.RunLoop(Terminal.Gui.Application.RunState,System.Boolean)">RunLoop(Application.RunState, Boolean)</h4>
  614. <div class="markdown level1 summary">
  615. Building block API: Runs the main loop for the created dialog
  616. </div>
  617. <div class="markdown level1 conceptual"></div>
  618. <h5 class="decalaration">Declaration</h5>
  619. <div class="codewrapper">
  620. <pre><code class="lang-csharp hljs">public static void RunLoop(Application.RunState state, bool wait = true)</code></pre>
  621. </div>
  622. <h5 class="parameters">Parameters</h5>
  623. <table class="table table-bordered table-striped table-condensed">
  624. <thead>
  625. <tr>
  626. <th>Type</th>
  627. <th>Name</th>
  628. <th>Description</th>
  629. </tr>
  630. </thead>
  631. <tbody>
  632. <tr>
  633. <td><a class="xref" href="Terminal.Gui.Application.RunState.html">Application.RunState</a></td>
  634. <td><span class="parametername">state</span></td>
  635. <td>The state returned by the Begin method.</td>
  636. </tr>
  637. <tr>
  638. <td><span class="xref">System.Boolean</span></td>
  639. <td><span class="parametername">wait</span></td>
  640. <td>By default this is true which will execute the runloop waiting for events, if you pass false, you can use this method to run a single iteration of the events.</td>
  641. </tr>
  642. </tbody>
  643. </table>
  644. <h5 id="Terminal_Gui_Application_RunLoop_Terminal_Gui_Application_RunState_System_Boolean__remarks">Remarks</h5>
  645. <div class="markdown level1 remarks">
  646. Use the wait parameter to control whether this is a
  647. blocking or non-blocking call.
  648. </div>
  649. <a id="Terminal_Gui_Application_Shutdown_" data-uid="Terminal.Gui.Application.Shutdown*"></a>
  650. <h4 id="Terminal_Gui_Application_Shutdown_System_Boolean_" data-uid="Terminal.Gui.Application.Shutdown(System.Boolean)">Shutdown(Boolean)</h4>
  651. <div class="markdown level1 summary">
  652. Shutdown an application initialized with <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Init">Init()</a>
  653. </div>
  654. <div class="markdown level1 conceptual"></div>
  655. <h5 class="decalaration">Declaration</h5>
  656. <div class="codewrapper">
  657. <pre><code class="lang-csharp hljs">public static void Shutdown(bool closeDriver = true)</code></pre>
  658. </div>
  659. <h5 class="parameters">Parameters</h5>
  660. <table class="table table-bordered table-striped table-condensed">
  661. <thead>
  662. <tr>
  663. <th>Type</th>
  664. <th>Name</th>
  665. <th>Description</th>
  666. </tr>
  667. </thead>
  668. <tbody>
  669. <tr>
  670. <td><span class="xref">System.Boolean</span></td>
  671. <td><span class="parametername">closeDriver</span></td>
  672. <td><code>true</code>Closes the application.<code>false</code>Closes toplevels only.</td>
  673. </tr>
  674. </tbody>
  675. </table>
  676. <a id="Terminal_Gui_Application_UngrabMouse_" data-uid="Terminal.Gui.Application.UngrabMouse*"></a>
  677. <h4 id="Terminal_Gui_Application_UngrabMouse" data-uid="Terminal.Gui.Application.UngrabMouse">UngrabMouse()</h4>
  678. <div class="markdown level1 summary">
  679. Releases the mouse grab, so mouse events will be routed to the view on which the mouse is.
  680. </div>
  681. <div class="markdown level1 conceptual"></div>
  682. <h5 class="decalaration">Declaration</h5>
  683. <div class="codewrapper">
  684. <pre><code class="lang-csharp hljs">public static void UngrabMouse()</code></pre>
  685. </div>
  686. <h3 id="events">Events
  687. </h3>
  688. <h4 id="Terminal_Gui_Application_Iteration" data-uid="Terminal.Gui.Application.Iteration">Iteration</h4>
  689. <div class="markdown level1 summary">
  690. This event is raised on each iteration of the <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_MainLoop">MainLoop</a>
  691. </div>
  692. <div class="markdown level1 conceptual"></div>
  693. <h5 class="decalaration">Declaration</h5>
  694. <div class="codewrapper">
  695. <pre><code class="lang-csharp hljs">public static event EventHandler Iteration</code></pre>
  696. </div>
  697. <h5 class="eventType">Event Type</h5>
  698. <table class="table table-bordered table-striped table-condensed">
  699. <thead>
  700. <tr>
  701. <th>Type</th>
  702. <th>Description</th>
  703. </tr>
  704. </thead>
  705. <tbody>
  706. <tr>
  707. <td><span class="xref">System.EventHandler</span></td>
  708. <td></td>
  709. </tr>
  710. </tbody>
  711. </table>
  712. <h5 id="Terminal_Gui_Application_Iteration_remarks">Remarks</h5>
  713. <div class="markdown level1 remarks">
  714. See also <span class="xref">System.Threading.Timeout</span>
  715. </div>
  716. <h4 id="Terminal_Gui_Application_Loaded" data-uid="Terminal.Gui.Application.Loaded">Loaded</h4>
  717. <div class="markdown level1 summary">
  718. This event is fired once when the application is first loaded. The dimensions of the
  719. terminal are provided.
  720. </div>
  721. <div class="markdown level1 conceptual"></div>
  722. <h5 class="decalaration">Declaration</h5>
  723. <div class="codewrapper">
  724. <pre><code class="lang-csharp hljs">public static event EventHandler&lt;Application.ResizedEventArgs&gt; Loaded</code></pre>
  725. </div>
  726. <h5 class="eventType">Event Type</h5>
  727. <table class="table table-bordered table-striped table-condensed">
  728. <thead>
  729. <tr>
  730. <th>Type</th>
  731. <th>Description</th>
  732. </tr>
  733. </thead>
  734. <tbody>
  735. <tr>
  736. <td><span class="xref">System.EventHandler</span>&lt;<a class="xref" href="Terminal.Gui.Application.ResizedEventArgs.html">Application.ResizedEventArgs</a>&gt;</td>
  737. <td></td>
  738. </tr>
  739. </tbody>
  740. </table>
  741. <h4 id="Terminal_Gui_Application_Resized" data-uid="Terminal.Gui.Application.Resized">Resized</h4>
  742. <div class="markdown level1 summary">
  743. Invoked when the terminal was resized. The new size of the terminal is provided.
  744. </div>
  745. <div class="markdown level1 conceptual"></div>
  746. <h5 class="decalaration">Declaration</h5>
  747. <div class="codewrapper">
  748. <pre><code class="lang-csharp hljs">public static event EventHandler&lt;Application.ResizedEventArgs&gt; Resized</code></pre>
  749. </div>
  750. <h5 class="eventType">Event Type</h5>
  751. <table class="table table-bordered table-striped table-condensed">
  752. <thead>
  753. <tr>
  754. <th>Type</th>
  755. <th>Description</th>
  756. </tr>
  757. </thead>
  758. <tbody>
  759. <tr>
  760. <td><span class="xref">System.EventHandler</span>&lt;<a class="xref" href="Terminal.Gui.Application.ResizedEventArgs.html">Application.ResizedEventArgs</a>&gt;</td>
  761. <td></td>
  762. </tr>
  763. </tbody>
  764. </table>
  765. </article>
  766. </div>
  767. <div class="hidden-sm col-md-2" role="complementary">
  768. <div class="sideaffix">
  769. <div class="contribution">
  770. <ul class="nav">
  771. </ul>
  772. </div>
  773. <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
  774. <!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
  775. </nav>
  776. </div>
  777. </div>
  778. </div>
  779. </div>
  780. <footer>
  781. <div class="grad-bottom"></div>
  782. <div class="footer">
  783. <div class="container">
  784. <span class="pull-right">
  785. <a href="#top">Back to top</a>
  786. </span>
  787. <span>Generated by <strong>DocFX</strong></span>
  788. </div>
  789. </div>
  790. </footer>
  791. </div>
  792. <script type="text/javascript" src="../../styles/docfx.vendor.js"></script>
  793. <script type="text/javascript" src="../../styles/docfx.js"></script>
  794. <script type="text/javascript" src="../../styles/main.js"></script>
  795. </body>
  796. </html>