SplitContainer.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673
  1. using NStack;
  2. using System;
  3. using System.Collections.Generic;
  4. using Terminal.Gui.Graphs;
  5. namespace Terminal.Gui {
  6. /// <summary>
  7. /// A <see cref="View"/> consisting of a moveable bar that divides
  8. /// the display area into 2 resizeable panels.
  9. /// </summary>
  10. public class SplitContainer : View {
  11. private SplitContainerLineView splitterLine;
  12. SplitContainer parentSplitPanel;
  13. /// TODO: Might be able to make Border virtual and override here
  14. /// To make this more API friendly
  15. /// <summary>
  16. /// Use this field instead of Border to create an integrated
  17. /// Border in which lines connect with subpanels and splitters
  18. /// seamlessly
  19. /// </summary>
  20. public BorderStyle IntegratedBorder {get;set;}
  21. /// <summary>
  22. /// The <see cref="View"/> showing in the left hand pane of a
  23. /// <see cref="Orientation.Vertical"/> or top of an
  24. /// <see cref="Orientation.Horizontal"/> pane. May be another
  25. /// <see cref="SplitContainer"/> if further splitter subdivisions are
  26. /// desired (e.g. to create a resizeable grid.
  27. /// </summary>
  28. public View Panel1 { get; private set; }
  29. public int Panel1MinSize { get; set; }
  30. public ustring Panel1Title { get; set; } = string.Empty;
  31. /// <summary>
  32. /// The <see cref="View"/> showing in the right hand pane of a
  33. /// <see cref="Orientation.Vertical"/> or bottom of an
  34. /// <see cref="Orientation.Horizontal"/> pane. May be another
  35. /// <see cref="SplitContainer"/> if further splitter subdivisions are
  36. /// desired (e.g. to create a resizeable grid.
  37. /// </summary>
  38. public View Panel2 { get; private set; }
  39. public int Panel2MinSize { get; set; }
  40. public ustring Panel2Title { get; set; } = string.Empty;
  41. private Pos splitterDistance = Pos.Percent (50);
  42. private Orientation orientation = Orientation.Vertical;
  43. /// <summary>
  44. /// Creates a new instance of the SplitContainer class.
  45. /// </summary>
  46. public SplitContainer ()
  47. {
  48. splitterLine = new SplitContainerLineView (this);
  49. Panel1 = new View () { Width = Dim.Fill (), Height = Dim.Fill() };
  50. Panel2 = new View () { Width = Dim.Fill (), Height = Dim.Fill () };
  51. this.Add (Panel1);
  52. this.Add (splitterLine);
  53. this.Add (Panel2);
  54. CanFocus = true;
  55. }
  56. /// <summary>
  57. /// Invoked when the <see cref="SplitterDistance"/> is changed
  58. /// </summary>
  59. public event SplitterEventHandler SplitterMoved;
  60. /// <summary>
  61. /// Raises the <see cref="SplitterMoved"/> event
  62. /// </summary>
  63. protected virtual void OnSplitterMoved ()
  64. {
  65. SplitterMoved?.Invoke (this, new SplitterEventArgs (this, splitterDistance));
  66. }
  67. /// <summary>
  68. /// Orientation of the dividing line (Horizontal or Vertical).
  69. /// </summary>
  70. public Orientation Orientation {
  71. get { return orientation; }
  72. set {
  73. orientation = value;
  74. LayoutSubviews ();
  75. }
  76. }
  77. public override void LayoutSubviews ()
  78. {
  79. splitterLine.moveRuneRenderLocation = null;
  80. if(this.IsRootSplitContainer()) {
  81. var contentArea = Bounds;
  82. if(HasBorder())
  83. {
  84. // TODO: Bound with Max/Min
  85. contentArea = new Rect(
  86. contentArea.X + 1,
  87. contentArea.Y + 1,
  88. contentArea.Width - 2,
  89. contentArea.Height - 2);
  90. }
  91. else if(HasAnyTitles())
  92. {
  93. // TODO: Bound with Max/Min
  94. contentArea = new Rect(
  95. contentArea.X,
  96. contentArea.Y + 1,
  97. contentArea.Width,
  98. contentArea.Height - 1);
  99. }
  100. Setup (this, contentArea);
  101. }
  102. base.LayoutSubviews ();
  103. }
  104. /// <summary>
  105. /// <para>Distance Horizontally or Vertically to the splitter line when
  106. /// neither panel is collapsed.
  107. /// </para>
  108. /// <para>Only absolute values (e.g. 10) and percent values (i.e. <see cref="Pos.Percent(float)"/>)
  109. /// are supported for this property.</para>
  110. /// </summary>
  111. public Pos SplitterDistance {
  112. get { return splitterDistance; }
  113. set {
  114. if (!(value is Pos.PosAbsolute) && !(value is Pos.PosFactor)) {
  115. throw new ArgumentException ($"Only Percent and Absolute values are supported for {nameof (SplitterDistance)} property. Passed value was {value.GetType ().Name}");
  116. }
  117. splitterDistance = value;
  118. GetRootSplitContainer ().LayoutSubviews ();
  119. OnSplitterMoved ();
  120. }
  121. }
  122. /// <inheritdoc/>
  123. public override bool OnEnter (View view)
  124. {
  125. Driver.SetCursorVisibility (CursorVisibility.Invisible);
  126. return base.OnEnter (view);
  127. }
  128. /// <inheritdoc/>
  129. public override void Redraw (Rect bounds)
  130. {
  131. Driver.SetAttribute (ColorScheme.Normal);
  132. Clear ();
  133. base.Redraw (bounds);
  134. // TODO : Gather ALL splitters
  135. // TODO : Draw borders and splitter lines into LineCanvas
  136. var lc = new LineCanvas(Application.Driver);
  137. if(HasBorder() && IsRootSplitContainer())
  138. {
  139. lc.AddLine(new Point(0,0),bounds.Width-1,Orientation.Horizontal,IntegratedBorder);
  140. lc.AddLine(new Point(0,0),bounds.Height-1,Orientation.Vertical,IntegratedBorder);
  141. lc.AddLine(new Point(bounds.Width-1,bounds.Height-1),-bounds.Width + 1,Orientation.Horizontal,IntegratedBorder);
  142. lc.AddLine(new Point(bounds.Width-1,bounds.Height-1),-bounds.Height + 1,Orientation.Vertical,IntegratedBorder);
  143. foreach(var line in GetAllChildSplitContainerLineViewRecursively(this))
  144. {
  145. var lineScreen = line.ViewToScreen(line.Bounds);
  146. var localOrigin = ScreenToView(lineScreen.X,lineScreen.Y);
  147. lc.AddLine(
  148. localOrigin,
  149. line.Orientation == Orientation.Horizontal ?
  150. line.Frame.Width:
  151. line.Frame.Height,
  152. line.Orientation,
  153. IntegratedBorder);
  154. }
  155. }
  156. Driver.SetAttribute (ColorScheme.Normal);
  157. lc.Draw(this,bounds);
  158. // Draw Titles over Border
  159. var screen = ViewToScreen (bounds);
  160. if (Panel1.Visible && Panel1Title.Length > 0) {
  161. Driver.SetAttribute (Panel1.HasFocus ? ColorScheme.HotNormal : ColorScheme.Normal);
  162. Driver.DrawWindowTitle (new Rect (screen.X, screen.Y, Panel1.Frame.Width, 0), Panel1Title, 0, 0, 0, 0);
  163. }
  164. if (splitterLine.Visible) {
  165. screen = ViewToScreen (splitterLine.Frame);
  166. } else {
  167. screen.X--;
  168. //screen.Y--;
  169. }
  170. if (Orientation == Orientation.Horizontal) {
  171. if (Panel2.Visible && Panel2Title?.Length > 0) {
  172. Driver.SetAttribute (Panel2.HasFocus ? ColorScheme.HotNormal : ColorScheme.Normal);
  173. Driver.DrawWindowTitle (new Rect (screen.X + 1, screen.Y, Panel2.Bounds.Width, 1), Panel2Title, 0, 0, 0, 0);
  174. }
  175. } else {
  176. if (Panel2.Visible && Panel2Title?.Length > 0) {
  177. Driver.SetAttribute (Panel2.HasFocus ? ColorScheme.HotNormal : ColorScheme.Normal);
  178. Driver.DrawWindowTitle (new Rect (screen.X + 1, screen.Y, Panel2.Bounds.Width, 1), Panel2Title, 0, 0, 0, 0);
  179. }
  180. }
  181. }
  182. private List<SplitContainerLineView> GetAllChildSplitContainerLineViewRecursively (View v)
  183. {
  184. var lines = new List<SplitContainerLineView>();
  185. foreach(var sub in v.Subviews)
  186. {
  187. if(sub is SplitContainerLineView s)
  188. {
  189. lines.Add(s);
  190. }
  191. else {
  192. lines.AddRange(GetAllChildSplitContainerLineViewRecursively(sub));
  193. }
  194. }
  195. return lines;
  196. }
  197. private bool IsRootSplitContainer ()
  198. {
  199. // TODO: don't want to layout subviews since the parent recursively lays them all out
  200. return parentSplitPanel == null;
  201. }
  202. private SplitContainer GetRootSplitContainer ()
  203. {
  204. SplitContainer root = this;
  205. while (root.parentSplitPanel != null) {
  206. root = root.parentSplitPanel;
  207. }
  208. return root;
  209. }
  210. private void Setup (SplitContainer splitContainer, Rect bounds)
  211. {
  212. splitterLine.Orientation = Orientation;
  213. // splitterLine.Text = Panel2.Title;
  214. // TODO: Recursion
  215. if (!Panel1.Visible || !Panel2.Visible) {
  216. View toFullSize = !Panel1.Visible ? Panel2 : Panel1;
  217. splitterLine.Visible = false;
  218. toFullSize.X = bounds.X;
  219. toFullSize.Y = bounds.Y;
  220. toFullSize.Width = bounds.Width;
  221. toFullSize.Height = bounds.Height;
  222. } else {
  223. splitterLine.Visible = true;
  224. splitterDistance = BoundByMinimumSizes (splitterDistance);
  225. Panel1.X = bounds.X;
  226. Panel1.Y = bounds.Y;
  227. switch (Orientation) {
  228. case Orientation.Horizontal:
  229. splitterLine.X = 0;
  230. splitterLine.Y = splitterDistance;
  231. splitterLine.Width = Dim.Fill ();
  232. splitterLine.Height = 1;
  233. splitterLine.LineRune = Driver.HLine;
  234. Panel1.Width = Dim.Fill (HasBorder()? 1:0);
  235. Panel1.Height = new Dim.DimFunc (() =>
  236. splitterDistance.Anchor (Bounds.Height));
  237. Panel2.Y = Pos.Bottom (splitterLine);
  238. Panel2.X = bounds.X;
  239. Panel2.Width = bounds.Width;
  240. Panel2.Height = bounds.Height;
  241. break;
  242. case Orientation.Vertical:
  243. splitterLine.X = splitterDistance;
  244. splitterLine.Y = 0;
  245. splitterLine.Width = 1;
  246. splitterLine.Height = bounds.Height;
  247. splitterLine.LineRune = Driver.VLine;
  248. Panel1.Height = Dim.Fill();
  249. Panel1.Width = new Dim.DimFunc (() =>
  250. splitterDistance.Anchor (Bounds.Width));
  251. Panel2.X = Pos.Right (splitterLine);
  252. Panel2.Y = bounds.Y;
  253. Panel2.Height = bounds.Height;
  254. Panel2.Width = Dim.Fill(HasBorder()? 1:0);
  255. break;
  256. default: throw new ArgumentOutOfRangeException (nameof (orientation));
  257. };
  258. }
  259. }
  260. /// <summary>
  261. /// Considers <paramref name="pos"/> as a candidate for <see cref="splitterDistance"/>
  262. /// then either returns (if valid) or returns adjusted if invalid with respect to the
  263. /// <see cref="SplitterPanel.MinSize"/> of the panels.
  264. /// </summary>
  265. /// <param name="pos"></param>
  266. /// <returns></returns>
  267. private Pos BoundByMinimumSizes (Pos pos)
  268. {
  269. // if we are not yet initialized then we don't know
  270. // how big we are and therefore cannot sensibly calculate
  271. // how big the panels will be with a given SplitterDistance
  272. if (!IsInitialized) {
  273. return pos;
  274. }
  275. var availableSpace = Orientation == Orientation.Horizontal ? this.Bounds.Height : this.Bounds.Width;
  276. var idealPosition = pos.Anchor (availableSpace);
  277. // bad position because not enough space for Panel1
  278. if (idealPosition < Panel1MinSize) {
  279. // TODO: we should preserve Absolute/Percent status here not just force it to absolute
  280. return (Pos)Math.Min (Panel1MinSize, availableSpace);
  281. }
  282. // if there is a border then 2 screen units are taken occupied
  283. // by the border around the edge (one on left, one on right).
  284. if (HasBorder ()) {
  285. availableSpace -= 2;
  286. }
  287. // bad position because not enough space for Panel2
  288. if (availableSpace - idealPosition <= Panel2MinSize) {
  289. // TODO: we should preserve Absolute/Percent status here not just force it to absolute
  290. // +1 is to allow space for the splitter
  291. return (Pos)Math.Max (availableSpace - (Panel2MinSize + 1), 0);
  292. }
  293. // this splitter position is fine, there is enough space for everyone
  294. return pos;
  295. }
  296. /// <summary>
  297. /// A panel within a <see cref="SplitterPanel"/>.
  298. /// </summary>
  299. public class SplitterPanel : View {
  300. Pos minSize = 1;
  301. /// <summary>
  302. /// Gets or sets the minimum size for the panel.
  303. /// </summary>
  304. public Pos MinSize { get => minSize;
  305. set {
  306. minSize = value;
  307. SuperView?.SetNeedsLayout ();
  308. }
  309. }
  310. ustring title = ustring.Empty;
  311. /// <summary>
  312. /// The title to be displayed for this <see cref="SplitterPanel"/>. The title will be rendered
  313. /// on the top border aligned to the left of the panel.
  314. /// </summary>
  315. /// <value>The title.</value>
  316. public ustring Title {
  317. get => title;
  318. set {
  319. title = value;
  320. SetNeedsDisplay ();
  321. }
  322. }
  323. /// <inheritdoc/>
  324. public override void Redraw (Rect bounds)
  325. {
  326. Driver.SetAttribute (ColorScheme.Normal);
  327. base.Redraw (bounds);
  328. }
  329. /// <inheritdoc/>
  330. public override void OnVisibleChanged ()
  331. {
  332. base.OnVisibleChanged ();
  333. SuperView?.SetNeedsLayout ();
  334. }
  335. }
  336. private class SplitContainerLineView : LineView {
  337. private SplitContainer parent;
  338. Point? dragPosition;
  339. Pos dragOrignalPos;
  340. public Point? moveRuneRenderLocation;
  341. public SplitContainerLineView (SplitContainer parent)
  342. {
  343. CanFocus = true;
  344. TabStop = true;
  345. this.parent = parent;
  346. base.AddCommand (Command.Right, () => {
  347. return MoveSplitter (1, 0);
  348. });
  349. base.AddCommand (Command.Left, () => {
  350. return MoveSplitter (-1, 0);
  351. });
  352. base.AddCommand (Command.LineUp, () => {
  353. return MoveSplitter (0, -1);
  354. });
  355. base.AddCommand (Command.LineDown, () => {
  356. return MoveSplitter (0, 1);
  357. });
  358. AddKeyBinding (Key.CursorRight, Command.Right);
  359. AddKeyBinding (Key.CursorLeft, Command.Left);
  360. AddKeyBinding (Key.CursorUp, Command.LineUp);
  361. AddKeyBinding (Key.CursorDown, Command.LineDown);
  362. }
  363. public override bool ProcessKey (KeyEvent kb)
  364. {
  365. if (!CanFocus || !HasFocus) {
  366. return base.ProcessKey (kb);
  367. }
  368. var result = InvokeKeybindings (kb);
  369. if (result != null)
  370. return (bool)result;
  371. return base.ProcessKey (kb);
  372. }
  373. public override void PositionCursor ()
  374. {
  375. base.PositionCursor ();
  376. var location = moveRuneRenderLocation ??
  377. new Point (Bounds.Width / 2, Bounds.Height / 2);
  378. Move (location.X, location.Y);
  379. }
  380. public override bool OnEnter (View view)
  381. {
  382. Driver.SetCursorVisibility (CursorVisibility.Default);
  383. PositionCursor ();
  384. return base.OnEnter (view);
  385. }
  386. public override void Redraw (Rect bounds)
  387. {
  388. base.Redraw (bounds);
  389. if (CanFocus && HasFocus) {
  390. var location = moveRuneRenderLocation ??
  391. new Point (Bounds.Width / 2, Bounds.Height / 2);
  392. AddRune (location.X, location.Y, Driver.Diamond);
  393. }
  394. }
  395. public override bool MouseEvent (MouseEvent mouseEvent)
  396. {
  397. if (!CanFocus) {
  398. return true;
  399. }
  400. if (!dragPosition.HasValue && (mouseEvent.Flags == MouseFlags.Button1Pressed)) {
  401. // Start a Drag
  402. SetFocus ();
  403. Application.EnsuresTopOnFront ();
  404. if (mouseEvent.Flags == MouseFlags.Button1Pressed) {
  405. dragPosition = new Point (mouseEvent.X, mouseEvent.Y);
  406. dragOrignalPos = Orientation == Orientation.Horizontal ? Y : X;
  407. Application.GrabMouse (this);
  408. if (Orientation == Orientation.Horizontal) {
  409. } else {
  410. moveRuneRenderLocation = new Point (0, Math.Max (1, Math.Min (Bounds.Height - 2, mouseEvent.Y)));
  411. }
  412. }
  413. return true;
  414. } else if (
  415. dragPosition.HasValue &&
  416. (mouseEvent.Flags == (MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition))) {
  417. // Continue Drag
  418. // how far has user dragged from original location?
  419. if (Orientation == Orientation.Horizontal) {
  420. int dy = mouseEvent.Y - dragPosition.Value.Y;
  421. parent.SplitterDistance = Offset (Y, dy);
  422. moveRuneRenderLocation = new Point (mouseEvent.X, 0);
  423. } else {
  424. int dx = mouseEvent.X - dragPosition.Value.X;
  425. parent.SplitterDistance = Offset (X, dx);
  426. moveRuneRenderLocation = new Point (0, Math.Max (1, Math.Min (Bounds.Height - 2, mouseEvent.Y)));
  427. }
  428. parent.SetNeedsDisplay ();
  429. return true;
  430. }
  431. if (mouseEvent.Flags.HasFlag (MouseFlags.Button1Released) && dragPosition.HasValue) {
  432. // End Drag
  433. Application.UngrabMouse ();
  434. Driver.UncookMouse ();
  435. FinalisePosition (
  436. dragOrignalPos,
  437. Orientation == Orientation.Horizontal ? Y : X);
  438. dragPosition = null;
  439. //moveRuneRenderLocation = null;
  440. }
  441. return false;
  442. }
  443. private bool MoveSplitter (int distanceX, int distanceY)
  444. {
  445. if (Orientation == Orientation.Vertical) {
  446. // Cannot move in this direction
  447. if (distanceX == 0) {
  448. return false;
  449. }
  450. var oldX = X;
  451. FinalisePosition (oldX, (Pos)Offset (X, distanceX));
  452. return true;
  453. } else {
  454. // Cannot move in this direction
  455. if (distanceY == 0) {
  456. return false;
  457. }
  458. var oldY = Y;
  459. FinalisePosition (oldY, (Pos)Offset (Y, distanceY));
  460. return true;
  461. }
  462. }
  463. private Pos Offset (Pos pos, int delta)
  464. {
  465. var posAbsolute = pos.Anchor (Orientation == Orientation.Horizontal ?
  466. parent.Bounds.Height : parent.Bounds.Width);
  467. return posAbsolute + delta;
  468. }
  469. /// <summary>
  470. /// <para>
  471. /// Moves <see cref="parent"/> <see cref="SplitContainer.SplitterDistance"/> to
  472. /// <see cref="Pos"/> <paramref name="newValue"/> preserving <see cref="Pos"/> format
  473. /// (absolute / relative) that <paramref name="oldValue"/> had.
  474. /// </para>
  475. /// <remarks>This ensures that if splitter location was e.g. 50% before and you move it
  476. /// to absolute 5 then you end up with 10% (assuming a parent had 50 width). </remarks>
  477. /// </summary>
  478. /// <param name="oldValue"></param>
  479. /// <param name="newValue"></param>
  480. private void FinalisePosition (Pos oldValue, Pos newValue)
  481. {
  482. if (oldValue is Pos.PosFactor) {
  483. if (Orientation == Orientation.Horizontal) {
  484. parent.SplitterDistance = ConvertToPosFactor (newValue, parent.Bounds.Height);
  485. } else {
  486. parent.SplitterDistance = ConvertToPosFactor (newValue, parent.Bounds.Width);
  487. }
  488. } else {
  489. parent.SplitterDistance = newValue;
  490. }
  491. }
  492. /// <summary>
  493. /// <para>
  494. /// Determines the absolute position of <paramref name="p"/> and
  495. /// returns a <see cref="Pos.PosFactor"/> that describes the percentage of that.
  496. /// </para>
  497. /// <para>Effectively turning any <see cref="Pos"/> into a <see cref="Pos.PosFactor"/>
  498. /// (as if created with <see cref="Pos.Percent(float)"/>)</para>
  499. /// </summary>
  500. /// <param name="p">The <see cref="Pos"/> to convert to <see cref="Pos.Percent(float)"/></param>
  501. /// <param name="parentLength">The Height/Width that <paramref name="p"/> lies within</param>
  502. /// <returns></returns>
  503. private Pos ConvertToPosFactor (Pos p, int parentLength)
  504. {
  505. // calculate position in the 'middle' of the cell at p distance along parentLength
  506. float position = p.Anchor (parentLength) + 0.5f;
  507. return new Pos.PosFactor (position / parentLength);
  508. }
  509. }
  510. private bool HasBorder ()
  511. {
  512. return IntegratedBorder != BorderStyle.None;
  513. }
  514. private bool HasAnyTitles()
  515. {
  516. return Panel1Title.Length > 0 || Panel2Title.Length > 0;
  517. }
  518. }
  519. /// <summary>
  520. /// Provides data for <see cref="SplitContainer"/> events.
  521. /// </summary>
  522. public class SplitterEventArgs : EventArgs {
  523. /// <summary>
  524. /// Creates a new instance of the <see cref="SplitterEventArgs"/> class.
  525. /// </summary>
  526. /// <param name="splitContainer"></param>
  527. /// <param name="splitterDistance"></param>
  528. public SplitterEventArgs (SplitContainer splitContainer, Pos splitterDistance)
  529. {
  530. SplitterDistance = splitterDistance;
  531. SplitContainer = splitContainer;
  532. }
  533. /// <summary>
  534. /// New position of the <see cref="SplitContainer.SplitterDistance"/>
  535. /// </summary>
  536. public Pos SplitterDistance { get; }
  537. /// <summary>
  538. /// Container (sender) of the event.
  539. /// </summary>
  540. public SplitContainer SplitContainer { get; }
  541. }
  542. /// <summary>
  543. /// Represents a method that will handle splitter events.
  544. /// </summary>
  545. public delegate void SplitterEventHandler (object sender, SplitterEventArgs e);
  546. }