Terminal.Gui.Application.html 34 KB

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