* Test/System.Windows.Forms/DataGridViewCellTest.cs: Added
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / Splitter.cs
1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
8 // 
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
11 // 
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 //
20 // Copyright (c) 2005-2006 Novell, Inc. (http://www.novell.com)
21 //
22 // Authors:
23 //      Peter Dennis Bartok     (pbartok@novell.com)
24 //
25 //
26
27 // COMPLETE
28
29 #undef Debug
30
31 using System;
32 using System.ComponentModel;
33 using System.Drawing;
34 using System.Reflection;
35 using System.Runtime.InteropServices;
36
37 namespace System.Windows.Forms {
38 #if NET_2_0
39         [ComVisible (true)]
40         [ClassInterface (ClassInterfaceType.AutoDispatch)]
41 #endif
42         [DefaultEvent("SplitterMoved")]
43         [Designer("System.Windows.Forms.Design.SplitterDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
44         [DefaultProperty("Dock")]
45         public class Splitter : Control
46 #if !NET_2_0
47         , IMessageFilter
48 #endif
49         {
50                 #region Enums
51                 private enum DrawType {
52                         Initial,
53                         Redraw,
54                         Finish
55                 }
56                 #endregion      // Enums
57
58                 #region Local Variables
59                 static private Cursor           splitter_ns;
60                 static private Cursor           splitter_we;
61                 // XXX this "new" shouldn't be here.  Control shouldn't define border_style as internal.
62                 new private BorderStyle         border_style;
63                 private int                     min_extra;
64                 private int                     min_size;
65                 private int                     split_position;         // Current splitter position
66                 private int                     prev_split_position;    // Previous splitter position, only valid during drag
67                 private int                     click_offset;           // Click offset from border of splitter control
68                 private int                     splitter_size;          // Size (width or height) of our splitter control
69                 private bool                    horizontal;             // true if we've got a horizontal splitter
70                 private Control                 affected;               // The control that the splitter resizes
71                 private Control                 filler;                 // The control that MinExtra prevents from being shrunk to 0 size
72                 private SplitterEventArgs       sevent;                 // We cache the object, prevents fragmentation
73                 private int                     limit_min;              // The max we're allowed to move the splitter left/up
74                 private int                     limit_max;              // The max we're allowed to move the splitter right/down
75                 private int                     split_requested;        // If the user requests a position before we have ever laid out the doc
76                 #endregion      // Local Variables
77
78                 #region Constructors
79                 static Splitter() {
80                         splitter_ns = Cursors.HSplit;
81                         splitter_we = Cursors.VSplit;
82                 }
83
84                 public Splitter() {
85
86                         min_extra = 25;
87                         min_size = 25;
88                         split_position = -1;
89                         split_requested = -1;
90                         splitter_size = 3;
91                         horizontal = false;
92                         sevent = new SplitterEventArgs(0, 0, 0, 0);
93
94                         SetStyle(ControlStyles.Selectable, false);
95                         Anchor = AnchorStyles.None;
96                         Dock = DockStyle.Left;
97
98                         Layout += new LayoutEventHandler(LayoutSplitter);
99                         this.ParentChanged += new EventHandler(ReparentSplitter);
100                         Cursor = splitter_we;
101                 }
102                 #endregion      // Constructors
103
104                 #region Public Instance Properties
105                 [Browsable(false)]
106                 [EditorBrowsable(EditorBrowsableState.Never)]
107                 public override bool AllowDrop {
108                         get {
109                                 return base.AllowDrop;
110                         }
111
112                         set {
113                                 base.AllowDrop = value;
114                         }
115                 }
116
117                 [Browsable(false)]
118                 [DefaultValue(AnchorStyles.None)]
119                 [EditorBrowsable(EditorBrowsableState.Never)]
120                 public override AnchorStyles Anchor {
121                         get {
122                                 return AnchorStyles.None;
123                         }
124
125                         set {
126                                 ;       // MS doesn't set it
127                         }
128                 }
129
130                 [Browsable(false)]
131                 [EditorBrowsable(EditorBrowsableState.Never)]
132                 public override Image BackgroundImage {
133                         get {
134                                 return base.BackgroundImage;
135                         }
136
137                         set {
138                                 base.BackgroundImage = value;
139                         }
140                 }
141
142 #if NET_2_0
143                 [Browsable (false)]
144                 [EditorBrowsable (EditorBrowsableState.Never)]
145                 public override ImageLayout BackgroundImageLayout {
146                         get { return base.BackgroundImageLayout; }
147                         set { base.BackgroundImageLayout = value; }
148                 }
149 #endif
150
151                 [DispId(-504)]
152                 [DefaultValue (BorderStyle.None)]
153                 [MWFDescription("Sets the border style for the splitter")]
154                 [MWFCategory("Appearance")]
155                 public BorderStyle BorderStyle {
156                         get {
157                                 return border_style;
158                         }
159
160                         set {
161                                 border_style = value;
162
163                                 switch(value) {
164                                 case BorderStyle.FixedSingle:
165                                         splitter_size = 4;      // We don't get motion events for 1px wide windows on X11. sigh.
166                                         break;
167
168                                 case BorderStyle.Fixed3D:
169                                         value = BorderStyle.None;
170                                         splitter_size = 3;
171                                         break;
172
173                                 case BorderStyle.None:
174                                         splitter_size = 3;
175                                         break;
176
177                                 default:
178                                         throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for BorderStyle", value));
179                                 }
180
181                                 base.InternalBorderStyle = value;
182                         }
183                 }
184
185                 [DefaultValue(DockStyle.Left)]
186                 [Localizable(true)]
187                 public override DockStyle Dock {
188                         get {
189                                 return base.Dock;
190                         }
191
192                         set {
193                                 if (!Enum.IsDefined (typeof (DockStyle), value) || (value == DockStyle.None) || (value == DockStyle.Fill)) {
194                                         throw new ArgumentException("Splitter must be docked left, top, bottom or right");
195                                 }
196
197                                 if ((value == DockStyle.Top) || (value == DockStyle.Bottom)) {
198                                         horizontal = true;
199                                         Cursor = splitter_ns;
200                                 } else {
201                                         horizontal = false;
202                                         Cursor = splitter_we;
203                                 }
204                                 base.Dock = value;
205                         }
206                 }
207
208                 [Browsable(false)]
209                 [EditorBrowsable(EditorBrowsableState.Never)]
210                 public override Font Font {
211                         get {
212                                 return base.Font;
213                         }
214
215                         set {
216                                 base.Font = value;
217                         }
218                 }
219
220                 [Browsable(false)]
221                 [EditorBrowsable(EditorBrowsableState.Never)]
222                 public override Color ForeColor {
223                         get {
224                                 return base.ForeColor;
225                         }
226
227                         set {
228                                 base.ForeColor = value;
229                         }
230                 }
231
232                 [Browsable(false)]
233                 [EditorBrowsable(EditorBrowsableState.Never)]
234                 public new ImeMode ImeMode {
235                         get {
236                                 return base.ImeMode;
237                         }
238
239                         set {
240                                 base.ImeMode = value;
241                         }
242                 }
243
244                 [DefaultValue(25)]
245                 [Localizable(true)]
246                 [MWFDescription("Sets minimum size of undocked window")]
247                 [MWFCategory("Behaviour")]
248                 public int MinExtra {
249                         get {
250                                 return min_extra;
251                         }
252
253                         set {
254                                 min_extra = value;
255                         }
256                 }
257
258                 [DefaultValue(25)]
259                 [Localizable(true)]
260                 [MWFDescription("Sets minimum size of the resized control")]
261                 [MWFCategory("Behaviour")]
262                 public int MinSize {
263                         get {
264                                 return min_size;
265                         }
266
267                         set {
268                                 min_size = value;
269                         }
270                 }
271
272                 
273                 [Browsable(false)]
274                 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
275                 [MWFDescription("Current splitter position")]
276                 [MWFCategory("Layout")]
277                 public int SplitPosition {
278                         get {
279                                 affected = AffectedControl;
280                                 if (affected == null) {
281                                         return -1;
282                                 }
283
284                                 if (Capture) {
285                                         return CalculateSplitPosition();
286                                 }
287
288                                 if (horizontal) {
289                                         return affected.Height;
290                                 } else {
291                                         return affected.Width;
292                                 }
293                         }
294
295                         set {
296                                 affected = AffectedControl;
297
298                                 if (affected == null) {
299                                         split_requested = value;
300                                 }
301                                 else {
302                                         if (horizontal) {
303                                                 affected.Height = value;
304                                         } else {
305                                                 affected.Width = value;
306                                         }
307                                 }
308                         }
309                 }
310
311                 [Browsable(false)]
312                 [EditorBrowsable(EditorBrowsableState.Never)]
313                 public new bool TabStop {
314                         get { return base.TabStop; }
315                         set { base.TabStop = value; }
316                 }
317
318                 [Bindable(false)]
319                 [Browsable(false)]
320                 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
321                 [EditorBrowsable(EditorBrowsableState.Never)]
322                 public override string Text {
323                         get {
324                                 return base.Text;
325                         }
326
327                         set {
328                                 base.Text = value;
329                         }
330                 }
331
332                 #endregion      // Public Instance Properties
333
334                 #region Protected Instance Properties
335                 protected override CreateParams CreateParams {
336                         get {
337                                 return base.CreateParams;
338                         }
339                 }
340
341 #if NET_2_0
342                 protected override Cursor DefaultCursor {
343                         get { return base.DefaultCursor; }
344                 }
345 #endif
346
347                 protected override ImeMode DefaultImeMode {
348                         get {
349                                 return ImeMode.Disable;
350                         }
351                 }
352
353                 protected override Size DefaultSize {
354                         get {
355                                 return new Size (3, 3);
356                         }
357                 }
358                 #endregion      // Protected Instance Properties
359
360                 #region Public Instance Methods
361 #if !NET_2_0
362                 public bool PreFilterMessage(ref Message m) {
363                         return false;
364                 }
365 #endif
366
367                 public override string ToString() {
368                         return base.ToString () + String.Format(", MinExtra: {0}, MinSize: {1}", min_extra, min_size);
369                 }
370                 #endregion      // Public Instance Methods
371
372                 #region Protected Instance Methods
373                 protected override void OnKeyDown(KeyEventArgs e) {
374                         base.OnKeyDown (e);
375                         if (Capture && (e.KeyCode == Keys.Escape)) {
376                                 Capture = false;
377                                 DrawDragHandle(DrawType.Finish);
378                         }
379                 }
380
381                 protected override void OnMouseDown(MouseEventArgs e) {
382                         Point   pt;
383
384                         base.OnMouseDown (e);
385
386                         // Only allow if we are set up properly
387                         if ((affected == null) || (filler == null)) {
388                                 affected = AffectedControl;
389                                 filler = FillerControl;
390                         }
391
392                         if (affected == null || e.Button != MouseButtons.Left) {
393                                 return;
394                         }
395
396                         // Prepare the job
397                         Capture = true;
398
399                         // Calculate limits
400                         if (filler != null) {
401                                 if (horizontal) {
402                                         if (Dock == DockStyle.Top) {
403                                                 limit_min = affected.Bounds.Top + min_size;
404                                                 limit_max = filler.Bounds.Bottom - min_extra + this.bounds.Top - filler.Bounds.Top;
405                                         } else {
406                                                 limit_min = filler.Bounds.Top + min_extra + this.bounds.Top - filler.Bounds.Bottom;
407                                                 limit_max = affected.Bounds.Bottom - min_size - this.Height;
408                                         }
409                                 } else {
410                                         if (Dock == DockStyle.Left) {
411                                                 limit_min = affected.Bounds.Left + min_size;
412                                                 limit_max = filler.Bounds.Right - min_extra + this.bounds.Left - filler.Bounds.Left;
413                                         } else {
414                                                 limit_min = filler.Bounds.Left + min_extra + this.bounds.Left - filler.Bounds.Right;
415                                                 limit_max = affected.Bounds.Right - min_size - this.Width;
416                                         }
417                                 }
418                         } else {
419                                 limit_min = 0;
420                                 if (horizontal) {
421                                         limit_max = affected.Parent.Height;
422                                 } else {
423                                         limit_max = affected.Parent.Width;
424                                 }
425                         }
426
427                         #if Debug
428                                 Console.WriteLine("Sizing limits: Min:{0}, Max:{1}", limit_min, limit_max);
429                         #endif
430
431                         pt = PointToScreen(Parent.PointToClient(new Point(e.X, e.Y)));
432
433                         if (horizontal) {
434                                 split_position = pt.Y;
435                                 if (Dock == DockStyle.Top) {
436                                         click_offset = e.Y;
437                                 } else {
438                                         click_offset = -e.Y;
439                                 }
440                         } else {
441                                 split_position = pt.X;
442                                 if (Dock == DockStyle.Left) {
443                                         click_offset = e.X;
444                                 } else {
445                                         click_offset = -e.X;
446                                 }
447                         }
448
449                         // We need to set this, in case we never get a mouse move
450                         prev_split_position = split_position;
451
452                         #if Debug
453                                 Console.WriteLine("Click-offset: {0} MouseDown split position: {1}", click_offset, split_position);
454                         #endif
455
456                         // Draw our initial handle
457                         DrawDragHandle(DrawType.Initial);
458                 }
459
460                 protected override void OnMouseMove(MouseEventArgs e) {
461                         Point   pt;
462
463                         base.OnMouseMove (e);
464
465                         if (!Capture  || e.Button != MouseButtons.Left || affected == null) {
466                                 return;
467                         }
468
469                         // We need our mouse coordinates relative to our parent
470                         pt = PointToScreen(Parent.PointToClient(new Point(e.X, e.Y)));
471
472                         // Grab our new coordinates
473                         prev_split_position = split_position;
474
475                         int candidate = horizontal ? pt.Y : pt.X;
476
477                         // Enforce limit on what we send to the event
478                         if (candidate < limit_min)
479                                 candidate = limit_min;
480                         else if (candidate > limit_max)
481                                 candidate = limit_max;
482
483                         sevent.x = pt.X;
484                         sevent.y = pt.Y;
485                         sevent.split_x = horizontal ? 0 : candidate;
486                         sevent.split_y = horizontal ? candidate : 0;
487
488                         // Fire the event
489                         OnSplitterMoving(sevent);
490
491                         split_position = horizontal ? sevent.split_y : sevent.split_x;
492
493                         // Enforce limits
494                         if (split_position < limit_min) {
495                                 #if Debug
496                                         Console.WriteLine("SplitPosition {0} less than minimum {1}, setting to minimum", split_position, limit_min);
497                                 #endif
498                                 split_position = limit_min;
499                         } else if (split_position > limit_max) {
500                                 #if Debug
501                                         Console.WriteLine("SplitPosition {0} more than maximum {1}, setting to maximum", split_position, limit_max);
502                                 #endif
503                                 split_position = limit_max;
504                         }
505
506                         // Update our handle location
507                         DrawDragHandle(DrawType.Redraw);
508                 }
509
510                 protected override void OnMouseUp(MouseEventArgs e) {
511                         if (!Capture || e.Button != MouseButtons.Left || affected == null) {
512                                 base.OnMouseUp (e);
513                                 return;
514                         }
515
516                         Capture = false;
517                         DrawDragHandle(DrawType.Finish);
518
519                         // Resize the affected window
520                         if (horizontal) {
521                                 affected.Height = CalculateSplitPosition() - click_offset;
522                                 #if Debug
523                                         Console.WriteLine("Setting height of affected control to {0}", CalculateSplitPosition() - click_offset);
524                                 #endif
525                         } else {
526                                 affected.Width = CalculateSplitPosition() - click_offset;
527                                 #if Debug
528                                         Console.WriteLine("Setting width of affected control to {0}", CalculateSplitPosition() - click_offset);
529                                 #endif
530                         }
531
532                         base.OnMouseUp (e);
533
534                         // It seems that MS is sending some data that doesn't quite make sense
535                         // In this event. It tried to match their stuff.., not sure about split_x...
536
537                         // Prepare the event
538                         if (horizontal) {
539                                 sevent.x = 0;
540                                 sevent.y = split_position;
541                                 sevent.split_x = 200;
542                                 sevent.split_y = split_position;
543                         } else {
544                                 sevent.x = split_position;
545                                 sevent.y = 0;
546                                 sevent.split_x = split_position;
547                                 sevent.split_y = 200;
548                         }
549
550
551                         // Fire the event
552                         OnSplitterMoved(sevent);
553                 }
554
555                 protected virtual void OnSplitterMoved(SplitterEventArgs sevent) {
556                         SplitterEventHandler eh = (SplitterEventHandler)(Events [SplitterMovedEvent]);
557                         if (eh != null)
558                                 eh (this, sevent);
559                 }
560
561                 protected virtual void OnSplitterMoving(SplitterEventArgs sevent) {
562                         SplitterEventHandler eh = (SplitterEventHandler)(Events [SplitterMovingEvent]);
563                         if (eh != null)
564                                 eh (this, sevent);
565                 }
566
567                 protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified) {
568                         // enforce our width / height
569                         if (horizontal) {
570                                 splitter_size = height;
571                                 if (splitter_size < 1) {
572                                         splitter_size = 3;
573                                 }
574                                 base.SetBoundsCore (x, y, width, splitter_size, specified);
575                         } else {
576                                 splitter_size = width;
577                                 if (splitter_size < 1) {
578                                         splitter_size = 3;
579                                 }
580                                 base.SetBoundsCore (x, y, splitter_size, height, specified);
581                         }
582                 }
583                 #endregion      // Protected Instance Methods
584
585                 #region Private Properties and Methods
586                 private Control AffectedControl {
587                         get {
588                                 if (Parent == null)
589                                         return null;
590
591                                 // Doc says the first control preceeding us in the zorder 
592                                 for (int i = Parent.Controls.GetChildIndex(this) + 1; i < Parent.Controls.Count; i++) {
593                                         switch (Dock) {
594                                         case DockStyle.Top:
595                                                 if (Top == Parent.Controls[i].Bottom)
596                                                         return Parent.Controls[i];
597                                                 break;
598                                         case DockStyle.Bottom:
599                                                 if (Bottom == Parent.Controls[i].Top)
600                                                         return Parent.Controls[i];
601                                                 break;
602                                         case DockStyle.Left:
603                                                 if (Left == Parent.Controls[i].Right)
604                                                         return Parent.Controls[i];
605                                                 break;
606                                         case DockStyle.Right:
607                                                 if (Right == Parent.Controls[i].Left)
608                                                         return Parent.Controls[i];
609                                                 break;
610                                         }
611                                 }
612                                 return null;
613                         }
614                 }
615
616                 private Control FillerControl {
617                         get {
618                                 if (Parent == null)
619                                         return null;
620
621                                 // Doc says the first control preceeding us in the zorder 
622                                 for (int i = Parent.Controls.GetChildIndex(this) - 1; i >= 0; i--) {
623                                         if (Parent.Controls[i].Dock == DockStyle.Fill) {
624                                                 return Parent.Controls[i];
625                                         }
626                                 }
627                                 return null;
628                         }
629                 }
630
631                 private int CalculateSplitPosition() {
632                         if (horizontal) {
633                                 if (Dock == DockStyle.Top)
634                                         return split_position - affected.Top;
635                                 else
636                                         return affected.Bottom - split_position - splitter_size;
637                         } else {
638                                 if (Dock == DockStyle.Left)
639                                         return split_position - affected.Left;
640                                 else
641                                         return affected.Right - split_position - splitter_size;
642                         }
643                 }
644
645                 internal override void OnPaintInternal (PaintEventArgs e) {
646                         e.Graphics.FillRectangle(ThemeEngine.Current.ResPool.GetSolidBrush(this.BackColor), e.ClipRectangle);
647                 }
648
649                 private void LayoutSplitter(object sender, LayoutEventArgs e) {
650                         affected = AffectedControl;
651                         filler = FillerControl;
652                         if (split_requested != -1) {
653                                 SplitPosition = split_requested;
654                                 split_requested = -1;
655                         }
656                 }
657
658                 private void ReparentSplitter(object sender, EventArgs e) {
659                         affected = null;
660                         filler = null;
661                 }
662
663                 private void DrawDragHandle(DrawType type) {
664                         Rectangle       prev;
665                         Rectangle       current;
666
667                         if (horizontal) {
668                                 prev = new Rectangle(Location.X, prev_split_position - click_offset + 1, Width, 0);
669                                 current = new Rectangle(Location.X, split_position - click_offset + 1, Width, 0);
670                         } else {
671                                 prev = new Rectangle(prev_split_position - click_offset + 1, Location.Y, 0, Height);
672                                 current = new Rectangle(split_position - click_offset + 1, Location.Y, 0, Height);
673                         }
674
675                         switch(type) {
676                         case DrawType.Initial:
677                                 XplatUI.DrawReversibleRectangle(Parent.window.Handle, current, 3);
678                                 return;
679
680                         case DrawType.Redraw:
681                                 if (prev.X == current.X && prev.Y == current.Y)
682                                         return;
683
684                                 XplatUI.DrawReversibleRectangle(Parent.window.Handle, prev, 3);
685                                 XplatUI.DrawReversibleRectangle(Parent.window.Handle, current, 3);
686                                 return;
687
688                         case DrawType.Finish:
689                                 XplatUI.DrawReversibleRectangle(Parent.window.Handle, current, 3);
690                                 return;
691                         }
692                 }
693                 #endregion      // Private Properties and Methods
694
695                 #region Events
696                 [Browsable(false)]
697                 [EditorBrowsable(EditorBrowsableState.Never)]
698                 public new event EventHandler BackgroundImageChanged {
699                         add { base.BackgroundImageChanged += value; }
700                         remove { base.BackgroundImageChanged -= value; }
701                 }
702
703 #if NET_2_0
704                 [Browsable (false)]
705                 [EditorBrowsable (EditorBrowsableState.Never)]
706                 public new event EventHandler BackgroundImageLayoutChanged
707                 {
708                         add { base.BackgroundImageLayoutChanged += value; }
709                         remove { base.BackgroundImageLayoutChanged -= value; }
710                 }
711                 
712 #endif
713
714                 [Browsable(false)]
715                 [EditorBrowsable(EditorBrowsableState.Never)]
716                 public new event EventHandler Enter {
717                         add { base.Enter += value; }
718                         remove { base.Enter -= value; }
719                 }
720
721                 [Browsable(false)]
722                 [EditorBrowsable(EditorBrowsableState.Never)]
723                 public new event EventHandler FontChanged {
724                         add { base.FontChanged += value; }
725                         remove { base.FontChanged -= value; }
726                 }
727
728                 [Browsable(false)]
729                 [EditorBrowsable(EditorBrowsableState.Never)]
730                 public new event EventHandler ForeColorChanged {
731                         add { base.ForeColorChanged += value; }
732                         remove { base.ForeColorChanged -= value; }
733                 }
734
735                 [Browsable(false)]
736                 [EditorBrowsable(EditorBrowsableState.Never)]
737                 public new event EventHandler ImeModeChanged {
738                         add { base.ImeModeChanged += value; }
739                         remove { base.ImeModeChanged -= value; }
740                 }
741
742                 [Browsable(false)]
743                 [EditorBrowsable(EditorBrowsableState.Never)]
744                 public new event KeyEventHandler KeyDown {
745                         add { base.KeyDown += value; }
746                         remove { base.KeyDown -= value; }
747                 }
748
749                 [Browsable(false)]
750                 [EditorBrowsable(EditorBrowsableState.Never)]
751                 public new event KeyPressEventHandler KeyPress {
752                         add { base.KeyPress += value; }
753                         remove { base.KeyPress -= value; }
754                 }
755
756                 [Browsable(false)]
757                 [EditorBrowsable(EditorBrowsableState.Never)]
758                 public new event KeyEventHandler KeyUp {
759                         add { base.KeyUp += value; }
760                         remove { base.KeyUp -= value; }
761                 }
762
763                 [Browsable(false)]
764                 [EditorBrowsable(EditorBrowsableState.Never)]
765                 public new event EventHandler Leave {
766                         add { base.Leave += value; }
767                         remove { base.Leave -= value; }
768                 }
769
770                 [Browsable(false)]
771                 [EditorBrowsable(EditorBrowsableState.Never)]
772                 public new event EventHandler TabStopChanged {
773                         add { base.TabStopChanged += value; }
774                         remove { base.TabStopChanged -= value; }
775                 }
776
777                 [Browsable(false)]
778                 [EditorBrowsable(EditorBrowsableState.Never)]
779                 public new event EventHandler TextChanged {
780                         add { base.TextChanged += value; }
781                         remove { base.TextChanged -= value; }
782                 }
783
784                 static object SplitterMovedEvent = new object ();
785                 static object SplitterMovingEvent = new object ();
786
787                 public event SplitterEventHandler SplitterMoved {
788                         add { Events.AddHandler (SplitterMovedEvent, value); }
789                         remove { Events.RemoveHandler (SplitterMovedEvent, value); }
790                 }
791
792                 public event SplitterEventHandler SplitterMoving {
793                         add { Events.AddHandler (SplitterMovingEvent, value); }
794                         remove { Events.RemoveHandler (SplitterMovingEvent, value); }
795                 }
796                 #endregion      // Events
797         }
798 }