ConsoleDriver.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. //
  2. // ConsoleDriver.cs: Definition for the Console Driver API
  3. //
  4. // Authors:
  5. // Miguel de Icaza ([email protected])
  6. //
  7. using System;
  8. using System.Runtime.CompilerServices;
  9. using NStack;
  10. namespace Terminal.Gui {
  11. /// <summary>
  12. /// Basic colors that can be used to set the foreground and background colors in console applications. These can only be
  13. /// </summary>
  14. public enum Color {
  15. /// <summary>
  16. /// The black color.
  17. /// </summary>
  18. Black,
  19. /// <summary>
  20. /// The blue color.
  21. /// </summary>
  22. Blue,
  23. /// <summary>
  24. /// The green color.
  25. /// </summary>
  26. Green,
  27. /// <summary>
  28. /// The cyan color.
  29. /// </summary>
  30. Cyan,
  31. /// <summary>
  32. /// The red color.
  33. /// </summary>
  34. Red,
  35. /// <summary>
  36. /// The magenta color.
  37. /// </summary>
  38. Magenta,
  39. /// <summary>
  40. /// The brown color.
  41. /// </summary>
  42. Brown,
  43. /// <summary>
  44. /// The gray color.
  45. /// </summary>
  46. Gray,
  47. /// <summary>
  48. /// The dark gray color.
  49. /// </summary>
  50. DarkGray,
  51. /// <summary>
  52. /// The bright bBlue color.
  53. /// </summary>
  54. BrightBlue,
  55. /// <summary>
  56. /// The bright green color.
  57. /// </summary>
  58. BrightGreen,
  59. /// <summary>
  60. /// The brigh cyan color.
  61. /// </summary>
  62. BrighCyan,
  63. /// <summary>
  64. /// The bright red color.
  65. /// </summary>
  66. BrightRed,
  67. /// <summary>
  68. /// The bright magenta color.
  69. /// </summary>
  70. BrightMagenta,
  71. /// <summary>
  72. /// The bright yellow color.
  73. /// </summary>
  74. BrightYellow,
  75. /// <summary>
  76. /// The White color.
  77. /// </summary>
  78. White
  79. }
  80. /// <summary>
  81. /// Attributes are used as elements that contain both a foreground and a background or platform specific features
  82. /// </summary>
  83. /// <remarks>
  84. /// <see cref="Attribute"/>s are needed to map colors to terminal capabilities that might lack colors, on color
  85. /// scenarios, they encode both the foreground and the background color and are used in the <see cref="ColorScheme"/>
  86. /// class to define color schemes that can be used in your application.
  87. /// </remarks>
  88. public struct Attribute {
  89. internal int value;
  90. internal Color foreground;
  91. internal Color background;
  92. /// <summary>
  93. /// Initializes a new instance of the <see cref="Attribute"/> struct.
  94. /// </summary>
  95. /// <param name="value">Value.</param>
  96. /// <param name="foreground">Foreground</param>
  97. /// <param name="background">Background</param>
  98. public Attribute (int value, Color foreground = new Color (), Color background = new Color ())
  99. {
  100. this.value = value;
  101. this.foreground = foreground;
  102. this.background = background;
  103. }
  104. /// <summary>
  105. /// Initializes a new instance of the <see cref="Attribute"/> struct.
  106. /// </summary>
  107. /// <param name="foreground">Foreground</param>
  108. /// <param name="background">Background</param>
  109. public Attribute (Color foreground = new Color (), Color background = new Color ())
  110. {
  111. this.value = value = ((int)foreground | (int)background << 4);
  112. this.foreground = foreground;
  113. this.background = background;
  114. }
  115. /// <summary>
  116. /// Implicit conversion from an <see cref="Attribute"/> to the underlying Int32 representation
  117. /// </summary>
  118. /// <returns>The integer value stored in the attribute.</returns>
  119. /// <param name="c">The attribute to convert</param>
  120. public static implicit operator int (Attribute c) => c.value;
  121. /// <summary>
  122. /// Implicitly convert an integer value into an <see cref="Attribute"/>
  123. /// </summary>
  124. /// <returns>An attribute with the specified integer value.</returns>
  125. /// <param name="v">value</param>
  126. public static implicit operator Attribute (int v) => new Attribute (v);
  127. /// <summary>
  128. /// Creates an <see cref="Attribute"/> from the specified foreground and background.
  129. /// </summary>
  130. /// <returns>The make.</returns>
  131. /// <param name="foreground">Foreground color to use.</param>
  132. /// <param name="background">Background color to use.</param>
  133. public static Attribute Make (Color foreground, Color background)
  134. {
  135. if (Application.Driver == null)
  136. throw new InvalidOperationException ("The Application has not been initialized");
  137. return Application.Driver.MakeAttribute (foreground, background);
  138. }
  139. }
  140. /// <summary>
  141. /// Color scheme definitions, they cover some common scenarios and are used
  142. /// typically in containers such as <see cref="Window"/> and <see cref="FrameView"/> to set the scheme that is used by all the
  143. /// views contained inside.
  144. /// </summary>
  145. public class ColorScheme {
  146. Attribute _normal;
  147. Attribute _focus;
  148. Attribute _hotNormal;
  149. Attribute _hotFocus;
  150. Attribute _disabled;
  151. internal string caller = "";
  152. /// <summary>
  153. /// The default color for text, when the view is not focused.
  154. /// </summary>
  155. public Attribute Normal { get { return _normal; } set { _normal = SetAttribute (value); } }
  156. /// <summary>
  157. /// The color for text when the view has the focus.
  158. /// </summary>
  159. public Attribute Focus { get { return _focus; } set { _focus = SetAttribute (value); } }
  160. /// <summary>
  161. /// The color for the hotkey when a view is not focused
  162. /// </summary>
  163. public Attribute HotNormal { get { return _hotNormal; } set { _hotNormal = SetAttribute (value); } }
  164. /// <summary>
  165. /// The color for the hotkey when the view is focused.
  166. /// </summary>
  167. public Attribute HotFocus { get { return _hotFocus; } set { _hotFocus = SetAttribute (value); } }
  168. /// <summary>
  169. /// The default color for text, when the view is disabled.
  170. /// </summary>
  171. public Attribute Disabled { get { return _disabled; } set { _disabled = SetAttribute (value); } }
  172. bool preparingScheme = false;
  173. Attribute SetAttribute (Attribute attribute, [CallerMemberName] string callerMemberName = null)
  174. {
  175. if (!Application._initialized && !preparingScheme)
  176. return attribute;
  177. if (preparingScheme)
  178. return attribute;
  179. preparingScheme = true;
  180. switch (caller) {
  181. case "TopLevel":
  182. switch (callerMemberName) {
  183. case "Normal":
  184. HotNormal = Application.Driver.MakeAttribute (HotNormal.foreground, attribute.background);
  185. break;
  186. case "Focus":
  187. HotFocus = Application.Driver.MakeAttribute (HotFocus.foreground, attribute.background);
  188. break;
  189. case "HotNormal":
  190. HotFocus = Application.Driver.MakeAttribute (attribute.foreground, HotFocus.background);
  191. break;
  192. case "HotFocus":
  193. HotNormal = Application.Driver.MakeAttribute (attribute.foreground, HotNormal.background);
  194. if (Focus.foreground != attribute.background)
  195. Focus = Application.Driver.MakeAttribute (Focus.foreground, attribute.background);
  196. break;
  197. }
  198. break;
  199. case "Base":
  200. switch (callerMemberName) {
  201. case "Normal":
  202. HotNormal = Application.Driver.MakeAttribute (HotNormal.foreground, attribute.background);
  203. break;
  204. case "Focus":
  205. HotFocus = Application.Driver.MakeAttribute (HotFocus.foreground, attribute.background);
  206. break;
  207. case "HotNormal":
  208. HotFocus = Application.Driver.MakeAttribute (attribute.foreground, HotFocus.background);
  209. Normal = Application.Driver.MakeAttribute (Normal.foreground, attribute.background);
  210. break;
  211. case "HotFocus":
  212. HotNormal = Application.Driver.MakeAttribute (attribute.foreground, HotNormal.background);
  213. if (Focus.foreground != attribute.background)
  214. Focus = Application.Driver.MakeAttribute (Focus.foreground, attribute.background);
  215. break;
  216. }
  217. break;
  218. case "Menu":
  219. switch (callerMemberName) {
  220. case "Normal":
  221. if (Focus.background != attribute.background)
  222. Focus = Application.Driver.MakeAttribute (attribute.foreground, Focus.background);
  223. HotNormal = Application.Driver.MakeAttribute (HotNormal.foreground, attribute.background);
  224. Disabled = Application.Driver.MakeAttribute (Disabled.foreground, attribute.background);
  225. break;
  226. case "Focus":
  227. Normal = Application.Driver.MakeAttribute (attribute.foreground, Normal.background);
  228. HotFocus = Application.Driver.MakeAttribute (HotFocus.foreground, attribute.background);
  229. break;
  230. case "HotNormal":
  231. if (Focus.background != attribute.background)
  232. HotFocus = Application.Driver.MakeAttribute (attribute.foreground, HotFocus.background);
  233. Normal = Application.Driver.MakeAttribute (Normal.foreground, attribute.background);
  234. Disabled = Application.Driver.MakeAttribute (Disabled.foreground, attribute.background);
  235. break;
  236. case "HotFocus":
  237. HotNormal = Application.Driver.MakeAttribute (attribute.foreground, HotNormal.background);
  238. if (Focus.foreground != attribute.background)
  239. Focus = Application.Driver.MakeAttribute (Focus.foreground, attribute.background);
  240. break;
  241. case "Disabled":
  242. if (Focus.background != attribute.background)
  243. HotFocus = Application.Driver.MakeAttribute (attribute.foreground, HotFocus.background);
  244. Normal = Application.Driver.MakeAttribute (Normal.foreground, attribute.background);
  245. HotNormal = Application.Driver.MakeAttribute (HotNormal.foreground, attribute.background);
  246. break;
  247. }
  248. break;
  249. case "Dialog":
  250. switch (callerMemberName) {
  251. case "Normal":
  252. if (Focus.background != attribute.background)
  253. Focus = Application.Driver.MakeAttribute (attribute.foreground, Focus.background);
  254. HotNormal = Application.Driver.MakeAttribute (HotNormal.foreground, attribute.background);
  255. break;
  256. case "Focus":
  257. Normal = Application.Driver.MakeAttribute (attribute.foreground, Normal.background);
  258. HotFocus = Application.Driver.MakeAttribute (HotFocus.foreground, attribute.background);
  259. break;
  260. case "HotNormal":
  261. if (Focus.background != attribute.background)
  262. HotFocus = Application.Driver.MakeAttribute (attribute.foreground, HotFocus.background);
  263. if (Normal.foreground != attribute.background)
  264. Normal = Application.Driver.MakeAttribute (Normal.foreground, attribute.background);
  265. break;
  266. case "HotFocus":
  267. HotNormal = Application.Driver.MakeAttribute (attribute.foreground, HotNormal.background);
  268. if (Focus.foreground != attribute.background)
  269. Focus = Application.Driver.MakeAttribute (Focus.foreground, attribute.background);
  270. break;
  271. }
  272. break;
  273. case "Error":
  274. switch (callerMemberName) {
  275. case "Normal":
  276. HotNormal = Application.Driver.MakeAttribute (HotNormal.foreground, attribute.background);
  277. HotFocus = Application.Driver.MakeAttribute (HotFocus.foreground, attribute.background);
  278. break;
  279. case "HotNormal":
  280. case "HotFocus":
  281. HotFocus = Application.Driver.MakeAttribute (attribute.foreground, attribute.background);
  282. Normal = Application.Driver.MakeAttribute (Normal.foreground, attribute.background);
  283. break;
  284. }
  285. break;
  286. }
  287. preparingScheme = false;
  288. return attribute;
  289. }
  290. }
  291. /// <summary>
  292. /// The default <see cref="ColorScheme"/>s for the application.
  293. /// </summary>
  294. public static class Colors {
  295. static ColorScheme _toplevel;
  296. static ColorScheme _base;
  297. static ColorScheme _dialog;
  298. static ColorScheme _menu;
  299. static ColorScheme _error;
  300. /// <summary>
  301. /// The application toplevel color scheme, for the default toplevel views.
  302. /// </summary>
  303. public static ColorScheme TopLevel { get { return _toplevel; } set { _toplevel = SetColorScheme (value); } }
  304. /// <summary>
  305. /// The base color scheme, for the default toplevel views.
  306. /// </summary>
  307. public static ColorScheme Base { get { return _base; } set { _base = SetColorScheme (value); } }
  308. /// <summary>
  309. /// The dialog color scheme, for standard popup dialog boxes
  310. /// </summary>
  311. public static ColorScheme Dialog { get { return _dialog; } set { _dialog = SetColorScheme (value); } }
  312. /// <summary>
  313. /// The menu bar color
  314. /// </summary>
  315. public static ColorScheme Menu { get { return _menu; } set { _menu = SetColorScheme (value); } }
  316. /// <summary>
  317. /// The color scheme for showing errors.
  318. /// </summary>
  319. public static ColorScheme Error { get { return _error; } set { _error = SetColorScheme (value); } }
  320. static ColorScheme SetColorScheme (ColorScheme colorScheme, [CallerMemberName] string callerMemberName = null)
  321. {
  322. colorScheme.caller = callerMemberName;
  323. return colorScheme;
  324. }
  325. }
  326. ///// <summary>
  327. ///// Special characters that can be drawn with
  328. ///// </summary>
  329. //public enum SpecialChar {
  330. // /// <summary>
  331. // /// Horizontal line character.
  332. // /// </summary>
  333. // HLine,
  334. // /// <summary>
  335. // /// Vertical line character.
  336. // /// </summary>
  337. // VLine,
  338. // /// <summary>
  339. // /// Stipple pattern
  340. // /// </summary>
  341. // Stipple,
  342. // /// <summary>
  343. // /// Diamond character
  344. // /// </summary>
  345. // Diamond,
  346. // /// <summary>
  347. // /// Upper left corner
  348. // /// </summary>
  349. // ULCorner,
  350. // /// <summary>
  351. // /// Lower left corner
  352. // /// </summary>
  353. // LLCorner,
  354. // /// <summary>
  355. // /// Upper right corner
  356. // /// </summary>
  357. // URCorner,
  358. // /// <summary>
  359. // /// Lower right corner
  360. // /// </summary>
  361. // LRCorner,
  362. // /// <summary>
  363. // /// Left tee
  364. // /// </summary>
  365. // LeftTee,
  366. // /// <summary>
  367. // /// Right tee
  368. // /// </summary>
  369. // RightTee,
  370. // /// <summary>
  371. // /// Top tee
  372. // /// </summary>
  373. // TopTee,
  374. // /// <summary>
  375. // /// The bottom tee.
  376. // /// </summary>
  377. // BottomTee,
  378. //}
  379. /// <summary>
  380. /// ConsoleDriver is an abstract class that defines the requirements for a console driver.
  381. /// There are currently three implementations: <see cref="CursesDriver"/> (for Unix and Mac), <see cref="WindowsDriver"/>, and <see cref="NetDriver"/> that uses the .NET Console API.
  382. /// </summary>
  383. public abstract class ConsoleDriver {
  384. /// <summary>
  385. /// The handler fired when the terminal is resized.
  386. /// </summary>
  387. protected Action TerminalResized;
  388. /// <summary>
  389. /// The current number of columns in the terminal.
  390. /// </summary>
  391. public abstract int Cols { get; }
  392. /// <summary>
  393. /// The current number of rows in the terminal.
  394. /// </summary>
  395. public abstract int Rows { get; }
  396. /// <summary>
  397. /// Initializes the driver
  398. /// </summary>
  399. /// <param name="terminalResized">Method to invoke when the terminal is resized.</param>
  400. public abstract void Init (Action terminalResized);
  401. /// <summary>
  402. /// Moves the cursor to the specified column and row.
  403. /// </summary>
  404. /// <param name="col">Column to move the cursor to.</param>
  405. /// <param name="row">Row to move the cursor to.</param>
  406. public abstract void Move (int col, int row);
  407. /// <summary>
  408. /// Adds the specified rune to the display at the current cursor position
  409. /// </summary>
  410. /// <param name="rune">Rune to add.</param>
  411. public abstract void AddRune (Rune rune);
  412. /// <summary>
  413. /// Adds the specified
  414. /// </summary>
  415. /// <param name="str">String.</param>
  416. public abstract void AddStr (ustring str);
  417. /// <summary>
  418. /// Prepare the driver and set the key and mouse events handlers.
  419. /// </summary>
  420. /// <param name="mainLoop">The main loop.</param>
  421. /// <param name="keyHandler">The handler for ProcessKey</param>
  422. /// <param name="keyDownHandler">The handler for key down events</param>
  423. /// <param name="keyUpHandler">The handler for key up events</param>
  424. /// <param name="mouseHandler">The handler for mouse events</param>
  425. public abstract void PrepareToRun (MainLoop mainLoop, Action<KeyEvent> keyHandler, Action<KeyEvent> keyDownHandler, Action<KeyEvent> keyUpHandler, Action<MouseEvent> mouseHandler);
  426. /// <summary>
  427. /// Updates the screen to reflect all the changes that have been done to the display buffer
  428. /// </summary>
  429. public abstract void Refresh ();
  430. /// <summary>
  431. /// Updates the location of the cursor position
  432. /// </summary>
  433. public abstract void UpdateCursor ();
  434. /// <summary>
  435. /// Ends the execution of the console driver.
  436. /// </summary>
  437. public abstract void End ();
  438. /// <summary>
  439. /// Redraws the physical screen with the contents that have been queued up via any of the printing commands.
  440. /// </summary>
  441. public abstract void UpdateScreen ();
  442. /// <summary>
  443. /// Selects the specified attribute as the attribute to use for future calls to AddRune, AddString.
  444. /// </summary>
  445. /// <param name="c">C.</param>
  446. public abstract void SetAttribute (Attribute c);
  447. /// <summary>
  448. /// Set Colors from limit sets of colors.
  449. /// </summary>
  450. /// <param name="foreground">Foreground.</param>
  451. /// <param name="background">Background.</param>
  452. public abstract void SetColors (ConsoleColor foreground, ConsoleColor background);
  453. // Advanced uses - set colors to any pre-set pairs, you would need to init_color
  454. // that independently with the R, G, B values.
  455. /// <summary>
  456. /// Advanced uses - set colors to any pre-set pairs, you would need to init_color
  457. /// that independently with the R, G, B values.
  458. /// </summary>
  459. /// <param name="foregroundColorId">Foreground color identifier.</param>
  460. /// <param name="backgroundColorId">Background color identifier.</param>
  461. public abstract void SetColors (short foregroundColorId, short backgroundColorId);
  462. /// <summary>
  463. /// Set the handler when the terminal is resized.
  464. /// </summary>
  465. /// <param name="terminalResized"></param>
  466. public void SetTerminalResized (Action terminalResized)
  467. {
  468. TerminalResized = terminalResized;
  469. }
  470. /// <summary>
  471. /// Draws a frame on the specified region with the specified padding around the frame.
  472. /// </summary>
  473. /// <param name="region">Region where the frame will be drawn..</param>
  474. /// <param name="padding">Padding to add on the sides.</param>
  475. /// <param name="fill">If set to <c>true</c> it will clear the contents with the current color, otherwise the contents will be left untouched.</param>
  476. public virtual void DrawFrame (Rect region, int padding, bool fill)
  477. {
  478. int width = region.Width;
  479. int height = region.Height;
  480. int b;
  481. int fwidth = width - padding * 2;
  482. int fheight = height - 1 - padding;
  483. Move (region.X, region.Y);
  484. if (padding > 0) {
  485. for (int l = 0; l < padding; l++)
  486. for (b = region.X; b < region.X + width; b++) {
  487. AddRune (' ');
  488. Move (b + 1, region.Y);
  489. }
  490. }
  491. Move (region.X, region.Y + padding);
  492. for (int c = 0; c < padding; c++) {
  493. AddRune (' ');
  494. Move (region.X + 1, region.Y + padding);
  495. }
  496. AddRune (ULCorner);
  497. for (b = region.X; b < region.X + fwidth - 2; b++) {
  498. AddRune (HLine);
  499. Move (b + (padding > 0 ? padding + 2 : 2), region.Y + padding);
  500. }
  501. AddRune (URCorner);
  502. for (int c = 0; c < padding; c++) {
  503. AddRune (' ');
  504. Move (region.X + 1, region.Y + padding);
  505. }
  506. for (b = 1 + padding; b < fheight; b++) {
  507. Move (region.X, region.Y + b);
  508. for (int c = 0; c < padding; c++) {
  509. AddRune (' ');
  510. Move (region.X + 1, region.Y + b);
  511. }
  512. AddRune (VLine);
  513. if (fill) {
  514. for (int x = region.X + 1; x < region.X + fwidth - 1; x++) {
  515. AddRune (' ');
  516. Move (x + (padding > 0 ? padding + 1 : 1), region.Y + b);
  517. }
  518. } else {
  519. if (padding > 0)
  520. Move (region.X + fwidth, region.Y + b);
  521. else
  522. Move (region.X + fwidth - 1, region.Y + b);
  523. }
  524. AddRune (VLine);
  525. for (int c = 0; c < padding; c++) {
  526. AddRune (' ');
  527. Move (region.X + 1, region.Y + b);
  528. }
  529. }
  530. Move (region.X, region.Y + fheight);
  531. for (int c = 0; c < padding; c++) {
  532. AddRune (' ');
  533. Move (region.X + 1, region.Y + b);
  534. }
  535. AddRune (LLCorner);
  536. for (b = region.X; b < region.X + fwidth - 2; b++) {
  537. AddRune (HLine);
  538. Move (b + (padding > 0 ? padding + 2 : 2), region.Y + fheight);
  539. }
  540. AddRune (LRCorner);
  541. for (int c = 0; c < padding; c++) {
  542. AddRune (' ');
  543. Move (region.X + 1, region.Y);
  544. }
  545. if (padding > 0) {
  546. Move (region.X, region.Y + height - padding);
  547. for (int l = 0; l < padding; l++) {
  548. for (b = region.X; b < region.X + width; b++) {
  549. AddRune (' ');
  550. Move (b + 1, region.Y + height - padding);
  551. }
  552. }
  553. }
  554. }
  555. /// <summary>
  556. /// Suspend the application, typically needs to save the state, suspend the app and upon return, reset the console driver.
  557. /// </summary>
  558. public abstract void Suspend ();
  559. Rect clip;
  560. /// <summary>
  561. /// Controls the current clipping region that AddRune/AddStr is subject to.
  562. /// </summary>
  563. /// <value>The clip.</value>
  564. public Rect Clip {
  565. get => clip;
  566. set => this.clip = value;
  567. }
  568. /// <summary>
  569. /// Start of mouse moves.
  570. /// </summary>
  571. public abstract void StartReportingMouseMoves ();
  572. /// <summary>
  573. /// Stop reporting mouses moves.
  574. /// </summary>
  575. public abstract void StopReportingMouseMoves ();
  576. /// <summary>
  577. /// Disables the cooked event processing from the mouse driver. At startup, it is assumed mouse events are cooked.
  578. /// </summary>
  579. public abstract void UncookMouse ();
  580. /// <summary>
  581. /// Enables the cooked event processing from the mouse driver
  582. /// </summary>
  583. public abstract void CookMouse ();
  584. /// <summary>
  585. /// Horizontal line character.
  586. /// </summary>
  587. public Rune HLine;
  588. /// <summary>
  589. /// Vertical line character.
  590. /// </summary>
  591. public Rune VLine;
  592. /// <summary>
  593. /// Stipple pattern
  594. /// </summary>
  595. public Rune Stipple;
  596. /// <summary>
  597. /// Diamond character
  598. /// </summary>
  599. public Rune Diamond;
  600. /// <summary>
  601. /// Upper left corner
  602. /// </summary>
  603. public Rune ULCorner;
  604. /// <summary>
  605. /// Lower left corner
  606. /// </summary>
  607. public Rune LLCorner;
  608. /// <summary>
  609. /// Upper right corner
  610. /// </summary>
  611. public Rune URCorner;
  612. /// <summary>
  613. /// Lower right corner
  614. /// </summary>
  615. public Rune LRCorner;
  616. /// <summary>
  617. /// Left tee
  618. /// </summary>
  619. public Rune LeftTee;
  620. /// <summary>
  621. /// Right tee
  622. /// </summary>
  623. public Rune RightTee;
  624. /// <summary>
  625. /// Top tee
  626. /// </summary>
  627. public Rune TopTee;
  628. /// <summary>
  629. /// The bottom tee.
  630. /// </summary>
  631. public Rune BottomTee;
  632. /// <summary>
  633. /// Make the attribute for the foreground and background colors.
  634. /// </summary>
  635. /// <param name="fore">Foreground.</param>
  636. /// <param name="back">Background.</param>
  637. /// <returns></returns>
  638. public abstract Attribute MakeAttribute (Color fore, Color back);
  639. }
  640. }