SplitContainer.cs 19 KB

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