View.Drawing.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670
  1. #nullable enable
  2. using System.ComponentModel;
  3. using System.Diagnostics;
  4. namespace Terminal.Gui;
  5. public partial class View // Drawing APIs
  6. {
  7. /// <summary>
  8. /// Draws the view if it needs to be drawn.
  9. /// </summary>
  10. /// <remarks>
  11. /// <para>
  12. /// The view will only be drawn if it is visible, and has any of <see cref="NeedsDisplay"/>,
  13. /// <see cref="SubViewNeedsDisplay"/>,
  14. /// or <see cref="NeedsLayout"/> set.
  15. /// </para>
  16. /// <para>
  17. /// // TODO: Add docs for the drawing process.
  18. /// </para>
  19. /// </remarks>
  20. public void Draw ()
  21. {
  22. if (!CanBeVisible (this) || (!NeedsDisplay && !SubViewNeedsDisplay))
  23. {
  24. return;
  25. }
  26. DoDrawAdornments ();
  27. DoSetAttribute ();
  28. // By default, we clip to the viewport preventing drawing outside the viewport
  29. // We also clip to the content, but if a developer wants to draw outside the viewport, they can do
  30. // so via settings. SetClip honors the ViewportSettings.DisableVisibleContentClipping flag.
  31. Rectangle prevClip = SetClip ();
  32. DoClearViewport (Viewport);
  33. DoDrawText (Viewport);
  34. DoDrawContent (Viewport);
  35. DoDrawSubviews (Viewport);
  36. // Restore the clip before rendering the line canvas and adornment subviews
  37. // because they may draw outside the viewport.
  38. if (Driver is { })
  39. {
  40. Driver.Clip = prevClip;
  41. }
  42. DoRenderLineCanvas ();
  43. DoDrawAdornmentSubViews ();
  44. ClearNeedsDisplay ();
  45. // We're done
  46. DoDrawComplete ();
  47. }
  48. #region DrawAdornments
  49. private void DoDrawAdornmentSubViews ()
  50. {
  51. // This causes the Adornment's subviews to be REDRAWN
  52. // TODO: Figure out how to make this more efficient
  53. if (Margin?.Subviews is { })
  54. {
  55. foreach (View subview in Margin.Subviews)
  56. {
  57. subview.SetNeedsDisplay ();
  58. }
  59. Margin?.DoDrawSubviews (Margin.Viewport);
  60. }
  61. if (Border?.Subviews is { })
  62. {
  63. foreach (View subview in Border.Subviews)
  64. {
  65. subview.SetNeedsDisplay ();
  66. }
  67. Border?.DoDrawSubviews (Border.Viewport);
  68. }
  69. if (Padding?.Subviews is { })
  70. {
  71. foreach (View subview in Padding.Subviews)
  72. {
  73. subview.SetNeedsDisplay ();
  74. }
  75. Padding?.DoDrawSubviews (Padding.Viewport);
  76. }
  77. }
  78. private void DoDrawAdornments ()
  79. {
  80. if (OnDrawingAdornments ())
  81. {
  82. return;
  83. }
  84. // TODO: add event.
  85. DrawAdornments ();
  86. }
  87. /// <summary>
  88. /// Causes each of the View's Adornments to be drawn. This includes the <see cref="Margin"/>, <see cref="Border"/>, and <see cref="Padding"/>.
  89. /// </summary>
  90. public void DrawAdornments ()
  91. {
  92. // Each of these renders lines to either this View's LineCanvas
  93. // Those lines will be finally rendered in OnRenderLineCanvas
  94. Margin?.Draw ();
  95. Border?.Draw ();
  96. Padding?.Draw ();
  97. }
  98. /// <summary>
  99. /// Called when the View's Adornments are to be drawn. Prepares <see cref="View.LineCanvas"/>. If
  100. /// <see cref="SuperViewRendersLineCanvas"/> is true, only the
  101. /// <see cref="LineCanvas"/> of this view's subviews will be rendered. If <see cref="SuperViewRendersLineCanvas"/> is
  102. /// false (the default), this method will cause the <see cref="LineCanvas"/> be prepared to be rendered.
  103. /// </summary>
  104. /// <returns><see langword="true"/> to stop further drawing of the Adornments.</returns>
  105. protected virtual bool OnDrawingAdornments () { return false; }
  106. #endregion DrawAdornments
  107. #region SetAttribute
  108. private void DoSetAttribute ()
  109. {
  110. if (OnSettingAttribute ())
  111. {
  112. return;
  113. }
  114. var args = new CancelEventArgs ();
  115. SettingAttribute?.Invoke (this, args);
  116. if (args.Cancel)
  117. {
  118. return;
  119. }
  120. SetNormalAttribute ();
  121. }
  122. /// <summary>
  123. /// Called when the normal attribute for the View is to be set. This is called before the View is drawn.
  124. /// </summary>
  125. /// <returns><see langword="true"/> to stop default behavior.</returns>
  126. protected virtual bool OnSettingAttribute () { return false; }
  127. /// <summary>Raised when the normal attribute for the View is to be set. This is raised before the View is drawn.</summary>
  128. /// <returns>
  129. /// Set <see cref="CancelEventArgs.Cancel"/> to <see langword="true"/> to stop default behavior.
  130. /// </returns>
  131. public event EventHandler<CancelEventArgs>? SettingAttribute;
  132. /// <summary>
  133. /// Sets the attribute for the View. This is called before the View is drawn.
  134. /// </summary>
  135. public void SetNormalAttribute ()
  136. {
  137. if (ColorScheme is { })
  138. {
  139. Driver?.SetAttribute (GetNormalColor ());
  140. }
  141. }
  142. #endregion
  143. #region ClearViewport
  144. private void DoClearViewport (Rectangle viewport)
  145. {
  146. Debug.Assert (viewport == Viewport);
  147. if (OnClearingViewport (Viewport))
  148. {
  149. return;
  150. }
  151. var dev = new DrawEventArgs (Viewport, Rectangle.Empty);
  152. ClearingViewport?.Invoke (this, dev);
  153. if (dev.Cancel)
  154. {
  155. return;
  156. }
  157. ClearViewport ();
  158. }
  159. /// <summary>
  160. /// Called when the <see cref="Viewport"/> is to be cleared.
  161. /// </summary>
  162. /// <param name="viewport"></param>
  163. /// <returns><see langword="true"/> to stop further clearing.</returns>
  164. protected virtual bool OnClearingViewport (Rectangle viewport) { return false; }
  165. /// <summary>Event invoked when the content area of the View is to be drawn.</summary>
  166. /// <remarks>
  167. /// <para>Will be invoked before any subviews added with <see cref="Add(View)"/> have been drawn.</para>
  168. /// <para>
  169. /// Rect provides the view-relative rectangle describing the currently visible viewport into the
  170. /// <see cref="View"/> .
  171. /// </para>
  172. /// </remarks>
  173. public event EventHandler<DrawEventArgs>? ClearingViewport;
  174. /// <summary>Clears <see cref="Viewport"/> with the normal background.</summary>
  175. /// <remarks>
  176. /// <para>
  177. /// If <see cref="ViewportSettings"/> has <see cref="Gui.ViewportSettings.ClearContentOnly"/> only
  178. /// the portion of the content
  179. /// area that is visible within the <see cref="View.Viewport"/> will be cleared. This is useful for views that have
  180. /// a
  181. /// content area larger than the Viewport (e.g. when <see cref="ViewportSettings.AllowNegativeLocation"/> is
  182. /// enabled) and want
  183. /// the area outside the content to be visually distinct.
  184. /// </para>
  185. /// </remarks>
  186. public void ClearViewport ()
  187. {
  188. if (Driver is null)
  189. {
  190. return;
  191. }
  192. // Get screen-relative coords
  193. Rectangle toClear = ViewportToScreen (Viewport with { Location = new (0, 0) });
  194. Rectangle prevClip = Driver.Clip;
  195. if (ViewportSettings.HasFlag (ViewportSettings.ClearContentOnly))
  196. {
  197. Rectangle visibleContent = ViewportToScreen (new Rectangle (new (-Viewport.X, -Viewport.Y), GetContentSize ()));
  198. toClear = Rectangle.Intersect (toClear, visibleContent);
  199. }
  200. Attribute prev = Driver.SetAttribute (GetNormalColor ());
  201. Driver.FillRect (toClear);
  202. Driver.SetAttribute (prev);
  203. Driver.Clip = prevClip;
  204. SetNeedsDisplay ();
  205. }
  206. #endregion ClearViewport
  207. #region DrawText
  208. private void DoDrawText (Rectangle viewport)
  209. {
  210. Debug.Assert (viewport == Viewport);
  211. if (OnDrawingText (Viewport))
  212. {
  213. return;
  214. }
  215. var dev = new DrawEventArgs (Viewport, Rectangle.Empty);
  216. DrawingText?.Invoke (this, dev);
  217. if (dev.Cancel)
  218. {
  219. return;
  220. }
  221. DrawText ();
  222. }
  223. /// <summary>
  224. /// Called when the <see cref="Text"/> of the View is to be drawn.
  225. /// </summary>
  226. /// <param name="viewport"></param>
  227. /// <returns><see langword="true"/> to stop further drawing of <see cref="Text"/>.</returns>
  228. protected virtual bool OnDrawingText (Rectangle viewport) { return false; }
  229. /// <summary>Raised when the <see cref="Text"/> of the View is to be drawn.</summary>
  230. /// <returns>
  231. /// Set <see cref="DrawEventArgs.Cancel"/> to <see langword="true"/> to stop further drawing of
  232. /// <see cref="Text"/>.
  233. /// </returns>
  234. public event EventHandler<DrawEventArgs>? DrawingText;
  235. /// <summary>
  236. /// Draws the <see cref="Text"/> of the View using the <see cref="TextFormatter"/>.
  237. /// </summary>
  238. public void DrawText ()
  239. {
  240. if (!string.IsNullOrEmpty (TextFormatter.Text))
  241. {
  242. TextFormatter.NeedsFormat = true;
  243. }
  244. // This should NOT clear
  245. // TODO: If the output is not in the Viewport, do nothing
  246. var drawRect = new Rectangle (ContentToScreen (Point.Empty), GetContentSize ());
  247. TextFormatter?.Draw (
  248. drawRect,
  249. HasFocus ? GetFocusColor () : GetNormalColor (),
  250. HasFocus ? GetHotFocusColor () : GetHotNormalColor (),
  251. Rectangle.Empty
  252. );
  253. // We assume that the text has been drawn over the entire area; ensure that the subviews are redrawn.
  254. SetSubViewNeedsDisplay ();
  255. }
  256. #endregion DrawText
  257. #region DrawContent
  258. private void DoDrawContent (Rectangle viewport)
  259. {
  260. Debug.Assert (viewport == Viewport);
  261. if (OnDrawingContent (Viewport))
  262. {
  263. return;
  264. }
  265. var dev = new DrawEventArgs (Viewport, Rectangle.Empty);
  266. DrawingContent?.Invoke (this, dev);
  267. if (dev.Cancel)
  268. { }
  269. // Do nothing.
  270. }
  271. /// <summary>
  272. /// Called when the View's content is to be drawn. The default implementation does nothing.
  273. /// </summary>
  274. /// <remarks>
  275. /// </remarks>
  276. /// <returns><see langword="true"/> to stop further drawing content.</returns>
  277. protected virtual bool OnDrawingContent (Rectangle viewport) { return false; }
  278. /// <summary>Raised when the View's content is to be drawn.</summary>
  279. /// <remarks>
  280. /// <para>Will be invoked before any subviews added with <see cref="Add(View)"/> have been drawn.</para>
  281. /// <para>
  282. /// Rect provides the view-relative rectangle describing the currently visible viewport into the
  283. /// <see cref="View"/> .
  284. /// </para>
  285. /// </remarks>
  286. public event EventHandler<DrawEventArgs>? DrawingContent;
  287. #endregion DrawContent
  288. #region DrawSubviews
  289. private void DoDrawSubviews (Rectangle viewport)
  290. {
  291. Debug.Assert (viewport == Viewport);
  292. if (OnDrawingSubviews (Viewport))
  293. {
  294. return;
  295. }
  296. var dev = new DrawEventArgs (Viewport, Rectangle.Empty);
  297. DrawingSubviews?.Invoke (this, dev);
  298. if (dev.Cancel)
  299. {
  300. return;
  301. }
  302. DrawSubviews ();
  303. }
  304. /// <summary>
  305. /// Called when the <see cref="Subviews"/> are to be drawn.
  306. /// </summary>
  307. /// <param name="viewport"></param>
  308. /// <returns><see langword="true"/> to stop further drawing of <see cref="Subviews"/>.</returns>
  309. protected virtual bool OnDrawingSubviews (Rectangle viewport) { return false; }
  310. /// <summary>Raised when the <see cref="Subviews"/> are to be drawn.</summary>
  311. /// <remarks>
  312. /// </remarks>
  313. /// <returns>
  314. /// Set <see cref="DrawEventArgs.Cancel"/> to <see langword="true"/> to stop further drawing of
  315. /// <see cref="Subviews"/>.
  316. /// </returns>
  317. public event EventHandler<DrawEventArgs>? DrawingSubviews;
  318. /// <summary>
  319. /// Draws the <see cref="Subviews"/>.
  320. /// </summary>
  321. public void DrawSubviews ()
  322. {
  323. if (_subviews is null || !SubViewNeedsDisplay)
  324. {
  325. return;
  326. }
  327. IEnumerable<View> subviewsNeedingDraw = _subviews.Where (view => view.Visible && (view.NeedsDisplay || view.SubViewNeedsDisplay));
  328. foreach (View view in subviewsNeedingDraw)
  329. {
  330. view.Draw ();
  331. }
  332. }
  333. #endregion DrawSubviews
  334. #region DrawLineCanvas
  335. private void DoRenderLineCanvas ()
  336. {
  337. if (OnRenderingLineCanvas ())
  338. {
  339. return;
  340. }
  341. // TODO: Add event
  342. RenderLineCanvas ();
  343. }
  344. /// <summary>
  345. /// Called when the <see cref="View.LineCanvas"/> is to be rendered. See <see cref="RenderLineCanvas"/>.
  346. /// </summary>
  347. /// <returns><see langword="true"/> to stop further drawing of <see cref="LineCanvas"/>.</returns>
  348. protected virtual bool OnRenderingLineCanvas () { return false; }
  349. /// <summary>The canvas that any line drawing that is to be shared by subviews of this view should add lines to.</summary>
  350. /// <remarks><see cref="Border"/> adds border lines to this LineCanvas.</remarks>
  351. public LineCanvas LineCanvas { get; } = new ();
  352. /// <summary>
  353. /// Gets or sets whether this View will use it's SuperView's <see cref="LineCanvas"/> for rendering any
  354. /// lines. If <see langword="true"/> the rendering of any borders drawn by this Frame will be done by its parent's
  355. /// SuperView. If <see langword="false"/> (the default) this View's <see cref="OnDrawingAdornments"/> method will be
  356. /// called to render the borders.
  357. /// </summary>
  358. public virtual bool SuperViewRendersLineCanvas { get; set; } = false;
  359. /// <summary>
  360. /// Causes the contents of <see cref="LineCanvas"/> to be drawn.
  361. /// If <see cref="SuperViewRendersLineCanvas"/> is true, only the
  362. /// <see cref="LineCanvas"/> of this view's subviews will be rendered. If <see cref="SuperViewRendersLineCanvas"/> is
  363. /// false (the default), this method will cause the <see cref="LineCanvas"/> to be rendered.
  364. /// </summary>
  365. public void RenderLineCanvas ()
  366. {
  367. // TODO: This is super confusing and needs to be refactored.
  368. if (Driver is null)
  369. {
  370. return;
  371. }
  372. // If we have a SuperView, it'll render our frames.
  373. if (!SuperViewRendersLineCanvas && LineCanvas.Viewport != Rectangle.Empty)
  374. {
  375. foreach (KeyValuePair<Point, Cell?> p in LineCanvas.GetCellMap ())
  376. {
  377. // Get the entire map
  378. if (p.Value is { })
  379. {
  380. Driver.SetAttribute (p.Value.Value.Attribute ?? ColorScheme!.Normal);
  381. Driver.Move (p.Key.X, p.Key.Y);
  382. // TODO: #2616 - Support combining sequences that don't normalize
  383. Driver.AddRune (p.Value.Value.Rune);
  384. }
  385. }
  386. LineCanvas.Clear ();
  387. }
  388. if (Subviews.Any (s => s.SuperViewRendersLineCanvas))
  389. {
  390. foreach (View subview in Subviews.Where (s => s.SuperViewRendersLineCanvas))
  391. {
  392. // Combine the LineCanvas'
  393. LineCanvas.Merge (subview.LineCanvas);
  394. subview.LineCanvas.Clear ();
  395. }
  396. foreach (KeyValuePair<Point, Cell?> p in LineCanvas.GetCellMap ())
  397. {
  398. // Get the entire map
  399. if (p.Value is { })
  400. {
  401. Driver.SetAttribute (p.Value.Value.Attribute ?? ColorScheme!.Normal);
  402. Driver.Move (p.Key.X, p.Key.Y);
  403. // TODO: #2616 - Support combining sequences that don't normalize
  404. Driver.AddRune (p.Value.Value.Rune);
  405. }
  406. }
  407. LineCanvas.Clear ();
  408. }
  409. }
  410. #endregion DrawLineCanvas
  411. #region DrawComplete
  412. private void DoDrawComplete ()
  413. {
  414. OnDrawComplete ();
  415. DrawComplete?.Invoke (this, EventArgs.Empty);
  416. // Default implementation does nothing.
  417. }
  418. /// <summary>
  419. /// Called when the View is completed drawing.
  420. /// </summary>
  421. protected virtual void OnDrawComplete () { }
  422. /// <summary>Raised when the View is completed drawing.</summary>
  423. /// <remarks>
  424. /// </remarks>
  425. public event EventHandler<EventArgs>? DrawComplete;
  426. #endregion DrawComplete
  427. #region NeedsDisplay
  428. // TODO: Make _needsDisplayRect nullable instead of relying on Empty
  429. // TODO: If null, it means ?
  430. // TODO: If Empty, it means no need to redraw
  431. // TODO: If not Empty, it means the region that needs to be redrawn
  432. // The viewport-relative region that needs to be redrawn. Marked internal for unit tests.
  433. internal Rectangle _needsDisplayRect = Rectangle.Empty;
  434. /// <summary>Gets or sets whether the view needs to be redrawn.</summary>
  435. /// <remarks>
  436. /// <para>
  437. /// Will be <see langword="true"/> if the <see cref="NeedsLayout"/> property is <see langword="true"/> or if
  438. /// any part of the view's <see cref="Viewport"/> needs to be redrawn.
  439. /// </para>
  440. /// <para>
  441. /// Setting has no effect on <see cref="NeedsLayout"/>.
  442. /// </para>
  443. /// </remarks>
  444. public bool NeedsDisplay
  445. {
  446. // TODO: Figure out if we can decouple NeedsDisplay from NeedsLayout. This is a temporary fix.
  447. get => _needsDisplayRect != Rectangle.Empty || NeedsLayout;
  448. set
  449. {
  450. if (value)
  451. {
  452. SetNeedsDisplay ();
  453. }
  454. else
  455. {
  456. ClearNeedsDisplay ();
  457. }
  458. }
  459. }
  460. /// <summary>Gets whether any Subviews need to be redrawn.</summary>
  461. public bool SubViewNeedsDisplay { get; private set; }
  462. /// <summary>Sets that the <see cref="Viewport"/> of this View needs to be redrawn.</summary>
  463. /// <remarks>
  464. /// If the view has not been initialized (<see cref="IsInitialized"/> is <see langword="false"/>), this method
  465. /// does nothing.
  466. /// </remarks>
  467. public void SetNeedsDisplay ()
  468. {
  469. Rectangle viewport = Viewport;
  470. if (_needsDisplayRect != Rectangle.Empty && viewport.IsEmpty)
  471. {
  472. // This handles the case where the view has not been initialized yet
  473. return;
  474. }
  475. SetNeedsDisplay (viewport);
  476. }
  477. /// <summary>Expands the area of this view needing to be redrawn to include <paramref name="viewPortRelativeRegion"/>.</summary>
  478. /// <remarks>
  479. /// <para>
  480. /// The location of <paramref name="viewPortRelativeRegion"/> is relative to the View's <see cref="Viewport"/>.
  481. /// </para>
  482. /// <para>
  483. /// If the view has not been initialized (<see cref="IsInitialized"/> is <see langword="false"/>), the area to be
  484. /// redrawn will be the <paramref name="viewPortRelativeRegion"/>.
  485. /// </para>
  486. /// </remarks>
  487. /// <param name="viewPortRelativeRegion">The <see cref="Viewport"/>relative region that needs to be redrawn.</param>
  488. public void SetNeedsDisplay (Rectangle viewPortRelativeRegion)
  489. {
  490. if (_needsDisplayRect.IsEmpty)
  491. {
  492. _needsDisplayRect = viewPortRelativeRegion;
  493. }
  494. else
  495. {
  496. int x = Math.Min (Viewport.X, viewPortRelativeRegion.X);
  497. int y = Math.Min (Viewport.Y, viewPortRelativeRegion.Y);
  498. int w = Math.Max (Viewport.Width, viewPortRelativeRegion.Width);
  499. int h = Math.Max (Viewport.Height, viewPortRelativeRegion.Height);
  500. _needsDisplayRect = new (x, y, w, h);
  501. }
  502. Margin?.SetNeedsDisplay ();
  503. Border?.SetNeedsDisplay ();
  504. Padding?.SetNeedsDisplay ();
  505. SuperView?.SetSubViewNeedsDisplay ();
  506. if (this is Adornment adornment)
  507. {
  508. adornment.Parent?.SetSubViewNeedsDisplay ();
  509. }
  510. foreach (View subview in Subviews)
  511. {
  512. if (subview.Frame.IntersectsWith (viewPortRelativeRegion))
  513. {
  514. Rectangle subviewRegion = Rectangle.Intersect (subview.Frame, viewPortRelativeRegion);
  515. subviewRegion.X -= subview.Frame.X;
  516. subviewRegion.Y -= subview.Frame.Y;
  517. subview.SetNeedsDisplay (subviewRegion);
  518. }
  519. }
  520. }
  521. /// <summary>Sets <see cref="SubViewNeedsDisplay"/> to <see langword="true"/> for this View and all Superviews.</summary>
  522. public void SetSubViewNeedsDisplay ()
  523. {
  524. SubViewNeedsDisplay = true;
  525. if (this is Adornment adornment)
  526. {
  527. adornment.Parent?.SetSubViewNeedsDisplay ();
  528. }
  529. if (SuperView is { SubViewNeedsDisplay: false })
  530. {
  531. SuperView.SetSubViewNeedsDisplay ();
  532. }
  533. }
  534. /// <summary>Clears <see cref="NeedsDisplay"/> and <see cref="SubViewNeedsDisplay"/>.</summary>
  535. protected void ClearNeedsDisplay ()
  536. {
  537. _needsDisplayRect = Rectangle.Empty;
  538. SubViewNeedsDisplay = false;
  539. Margin?.ClearNeedsDisplay ();
  540. Border?.ClearNeedsDisplay ();
  541. Padding?.ClearNeedsDisplay ();
  542. foreach (View subview in Subviews)
  543. {
  544. subview.ClearNeedsDisplay ();
  545. }
  546. }
  547. #endregion NeedsDisplay
  548. }