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