2005-05-26 Jordi Mas i Hernandez <jordi@ximian.com>
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / DataGrid.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 Novell, Inc. (http://www.novell.com)
21 //
22 // Author:
23 //      Jordi Mas i Hernandez <jordi@ximian.com>
24 //
25 //
26
27 // NOT COMPLETE
28
29
30 using System;
31 using System.ComponentModel;
32 using System.Drawing;
33 using System.Runtime.InteropServices;
34 using System.Collections;
35
36 namespace System.Windows.Forms
37 {
38         [DefaultEvent("Navigate")]
39         [DefaultProperty("DataSource")]
40         [Designer("System.Windows.Forms.Design.DataGridDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
41         public class DataGrid : Control, ISupportInitialize, IDataGridEditingService
42         {
43                 [Flags]
44                 [Serializable]
45                 public enum HitTestType
46                 {
47                         None            = 0,
48                         Cell            = 1,
49                         ColumnHeader    = 2,
50                         RowHeader       = 4,
51                         ColumnResize    = 8,
52                         RowResize       = 16,
53                         Caption         = 32,
54                         ParentRows      = 64
55                 }
56
57                 public sealed class HitTestInfo
58                 {
59                         public static readonly HitTestInfo Nowhere = null;
60
61                         #region Local Variables
62                         private int column;
63                         private int row;
64                         private HitTestType type;
65                         #endregion // Local Variables
66
67                         #region Private Constructors
68                         internal HitTestInfo ()
69                         {
70                                 column = 0;
71                                 row = 0;
72                                 type =  HitTestType.None;
73                         }
74                         #endregion
75
76
77                         #region Public Instance Properties
78                         public int Column {
79                                 get { return column; }
80                         }
81                         public int Row {
82                                 get { return row; }
83                         }
84                         public DataGrid.HitTestType Type {
85                                 get { return type; }
86                         }
87                         #endregion //Public Instance Properties
88
89                         public override bool Equals (object o)
90                         {
91                                 if (!(o is HitTestInfo))
92                                         return false;
93
94                                 HitTestInfo obj = (HitTestInfo) o;
95                                 return (obj.Column == column && obj.Row == row && obj.Type ==type);
96                         }
97
98                         public override int GetHashCode ()
99                         {
100                                 return row ^ column;
101                         }
102
103                         public override string ToString ()
104                         {
105                                 return base.ToString ();
106                         }
107
108                 }
109
110                 #region Local Variables                         
111                 private static readonly Color   def_alternating_backcolor = ThemeEngine.Current.DataGridAlternatingBackColor;
112                 private static readonly Color   def_background_color = ThemeEngine.Current.DataGridBackgroundColor;
113                 private static readonly Color   def_caption_backcolor = ThemeEngine.Current.DataGridCaptionBackColor;
114                 private static readonly Color   def_caption_forecolor = ThemeEngine.Current.DataGridCaptionForeColor;
115                 private static readonly Color   def_gridline_color = ThemeEngine.Current.DataGridGridLineColor;
116                 private static readonly Color   def_header_backcolor = ThemeEngine.Current.DataGridHeaderBackColor;
117                 private static readonly Font    def_header_font = ThemeEngine.Current.DefaultFont;
118                 private static readonly Color   def_header_forecolor = ThemeEngine.Current.DataGridHeaderForeColor;
119                 private static readonly Color   def_link_hovercolor = ThemeEngine.Current.DataGridLinkHoverColor;
120                 private static readonly Color   def_parentrowsback_color = ThemeEngine.Current.DataGridParentRowsBackColor;
121                 private static readonly Color   def_parentrowsfore_color = ThemeEngine.Current.DataGridParentRowsForeColor;
122                 private static readonly Color   def_selection_backcolor = ThemeEngine.Current.DataGridSelectionBackColor;
123                 private static readonly Color   def_selection_forecolor = ThemeEngine.Current.DataGridSelectionForeColor;
124                 private static readonly Color   def_link_color = ThemeEngine.Current.DataGridLinkColor;
125
126                 private bool allow_navigation;
127                 private bool allow_sorting;
128                 private Color alternating_backcolor;
129                 private Color background_color;
130                 internal BorderStyle border_style;
131                 private Color caption_backcolor;
132                 private Font caption_font;
133                 private Color caption_forecolor;
134                 private string caption_text;
135                 internal bool caption_visible;
136                 internal bool columnheaders_visible;
137                 private object datasource;
138                 private string datamember;
139                 private int firstvisible_column;
140                 private bool flatmode;
141                 private Color gridline_color;
142                 private DataGridLineStyle gridline_style;
143                 private Color header_backcolor;
144                 private Color header_forecolor;
145                 private Font header_font;
146                 private Color link_color;
147                 private Color link_hovercolor;
148                 private Color parentrowsback_color;
149                 private Color parentrowsfore_color;
150                 internal bool parentrows_visible;
151                 private int preferredcolumn_width;
152                 private int preferredrow_height;
153                 private bool _readonly;
154                 internal bool rowheaders_visible;
155                 private Color selection_backcolor;
156                 private Color selection_forecolor;
157                 private int rowheaders_width;
158                 internal int visiblecolumn_count;
159                 internal int visiblerow_count;
160                 internal int first_visiblecolumn;
161                 private int currentrow_index;
162                 private GridTableStylesCollection styles_collection;
163                 private DataGridParentRowsLabelStyle parentrowslabel_style;
164                 private DataGridCell current_cell;
165                 private Color forecolor;
166                 private Color backcolor;
167                 private DataGridTableStyle default_style;
168                 private DataGridTableStyle current_style;
169                 internal HScrollBar horiz_scrollbar;
170                 internal VScrollBar vert_scrollbar;
171                 private DataGridDrawing grid_drawing;
172                 internal int first_visiblerow;
173                 internal int horz_pixeloffset;
174                 #endregion // Local Variables
175
176                 #region Public Constructors
177                 public DataGrid ()
178                 {
179                         allow_navigation = true;
180                         allow_sorting = true;
181                         alternating_backcolor = def_alternating_backcolor;
182                         background_color = def_background_color;
183                         border_style = BorderStyle.Fixed3D;
184                         caption_backcolor = def_caption_backcolor;
185                         caption_font = null;
186                         caption_forecolor = def_caption_forecolor;
187                         caption_text = string.Empty;
188                         caption_visible = true;
189                         columnheaders_visible = true;
190                         datasource = null;
191                         datamember = string.Empty;
192                         firstvisible_column = 0;
193                         flatmode = false;
194                         gridline_color = def_gridline_color;
195                         gridline_style = DataGridLineStyle.Solid;
196                         header_backcolor = def_header_backcolor;
197                         header_forecolor = def_header_forecolor;
198                         header_font = def_header_font;
199                         link_color = def_link_color;
200                         link_hovercolor = def_link_hovercolor;
201                         parentrowsback_color = def_parentrowsback_color;
202                         parentrowsfore_color = def_parentrowsfore_color;
203                         parentrows_visible = false; // should be true (temp)
204                         preferredcolumn_width = ThemeEngine.Current.DataGridPreferredColumnWidth;
205                         preferredrow_height = 16;
206                         _readonly = false ;
207                         rowheaders_visible = true;
208                         selection_backcolor = def_selection_backcolor;
209                         selection_forecolor = def_selection_forecolor;
210                         rowheaders_width = 35;
211                         visiblecolumn_count = 0;
212                         visiblerow_count = 0;                   
213                         current_cell = new DataGridCell ();
214                         currentrow_index = -1;
215                         first_visiblerow = 0;
216                         first_visiblecolumn = 0;
217                         horz_pixeloffset = 0;
218                         forecolor = SystemColors.WindowText;
219                         parentrowslabel_style = DataGridParentRowsLabelStyle.Both;
220                         backcolor = SystemColors.Window;
221
222                         default_style = new DataGridTableStyle (true);
223                         styles_collection = new GridTableStylesCollection (this);
224                         styles_collection.CollectionChanged += new CollectionChangeEventHandler (OnTableStylesCollectionChanged);
225
226                         CurrentTableStyle = default_style;
227
228                         horiz_scrollbar = new HScrollBar ();
229                         horiz_scrollbar.Scroll += new ScrollEventHandler  (OnHorizontalScrollEvent);                    
230                         vert_scrollbar = new VScrollBar ();
231                         vert_scrollbar.ValueChanged += new EventHandler (OnVerticalScrollEvent);
232                         grid_drawing = new DataGridDrawing (this);
233                         
234                         SetStyle (ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
235
236                 }
237
238                 #endregion      // Public Constructor
239
240                 #region Public Instance Properties
241
242                 [DefaultValue(true)]
243                 public bool AllowNavigation {
244                         get {
245                                 return allow_navigation;
246                         }
247
248                         set {
249                                 if (allow_navigation != value) {
250                                         allow_navigation = value;
251                                         OnAllowNavigationChanged (EventArgs.Empty);
252                                 }
253                         }
254                 }
255
256                 [DefaultValue(true)]
257                 public bool AllowSorting {
258                         get {
259                                 return allow_sorting;
260                         }
261
262                         set {
263                                 if (allow_sorting != value) {
264                                         allow_sorting = value;
265                                 }
266                         }
267                 }
268
269                 public Color AlternatingBackColor  {
270                         get {
271                                 return alternating_backcolor;
272                         }
273
274                         set {
275                                 if (alternating_backcolor != value) {
276                                         alternating_backcolor = value;
277                                         Refresh ();
278                                 }
279                         }
280                 }
281
282                 public Color BackColor {
283                         get {
284                                 return backcolor;
285                         }
286                         set {
287                                 if (backcolor != value) {
288                                         backcolor = value;
289                                         Refresh ();
290                                 }
291                         }
292                 }
293
294                 public Color BackgroundColor {
295                         get {
296                                 return background_color;
297                         }
298                         set {
299                                  if (background_color != value) {
300                                         background_color = value;
301                                         OnBackgroundColorChanged (EventArgs.Empty);
302                                         Refresh ();
303                                 }
304                         }
305                 }
306
307                 [Browsable(false)]
308                 [EditorBrowsable(EditorBrowsableState.Never)]
309                 public Image BackgroundImage {
310                         get {
311                                 return base.BackgroundImage;
312                         }
313
314                         set {
315                                 base.BackgroundImage = value;
316                         }
317                 }
318
319                 [DispId(-504)]
320                 [DefaultValue(BorderStyle.Fixed3D)]
321                 public BorderStyle BorderStyle {
322                         get {
323                                 return border_style;
324                         }
325
326                         set {
327                                  if (border_style != value) {
328                                         border_style = value;
329                                         grid_drawing.CalcGridAreas ();
330                                         OnBorderStyleChanged (EventArgs.Empty);
331                                         Refresh ();
332                                 }
333                         }
334                 }
335
336                 public Color CaptionBackColor {
337                         get {
338                                 return caption_backcolor;
339                         }
340
341                         set {
342                                 if (caption_backcolor != value) {
343                                         caption_backcolor = value;
344                                         grid_drawing.InvalidateCaption ();
345                                 }
346                         }
347                 }
348
349                 [Localizable(true)]
350                 [AmbientValue(null)]
351                 public Font CaptionFont {
352                         get {
353                                 if (caption_font == null) {
354                                         return Font;
355                                 }
356                                 
357                                 return caption_font;
358                         }
359
360                         set {
361                                 if (caption_font != null && caption_font.Equals (value)) {
362                                         return;
363                                 }
364                                 
365                                 caption_font = value;
366                                 grid_drawing.CalcGridAreas ();
367                                 Refresh ();                             
368                         }
369                 }
370
371                 public Color CaptionForeColor {
372                         get {
373                                 return caption_forecolor;
374                         }
375
376                         set {
377                                 if (caption_forecolor != value) {
378                                         caption_forecolor = value;
379                                         grid_drawing.InvalidateCaption ();
380                                 }
381                         }
382                 }
383
384                 [Localizable(true)]
385                 [DefaultValue("")]
386                 public string CaptionText {
387                         get {
388                                 return caption_text;
389                         }
390
391                         set {
392                                 if (caption_text != value) {
393                                         caption_text = value;
394                                         grid_drawing.InvalidateCaption ();
395                                 }
396                         }
397                 }
398
399                 [DefaultValue(true)]
400                 public bool CaptionVisible {
401                         get {
402                                 return caption_visible;
403                         }
404
405                         set {
406                                 if (caption_visible != value) {
407                                         caption_visible = value;
408                                         grid_drawing.CalcGridAreas ();
409                                         Refresh ();
410                                         OnCaptionVisibleChanged (EventArgs.Empty);
411                                 }
412                         }
413                 }
414
415                 [DefaultValue(true)]
416                 public bool ColumnHeadersVisible {
417                         get {
418                                 return columnheaders_visible;
419                         }
420
421                         set {
422                                 if (columnheaders_visible != value) {
423                                         columnheaders_visible = value;
424                                         grid_drawing.CalcGridAreas ();
425                                         Refresh ();
426                                 }
427                         }
428                 }
429
430                 [Browsable(false)]
431                 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
432                 public DataGridCell CurrentCell {
433                         get {
434                                 return current_cell;
435                         }
436
437                         set {
438                                 if (!current_cell.Equals (value)) {
439                                         current_cell = value;
440                                         Refresh ();
441                                 }
442                         }
443                 }
444
445                 [Browsable(false)]
446                 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
447                 public int CurrentRowIndex {
448                         get {
449                                 return currentrow_index;
450                         }
451
452                         set {
453                                 if (currentrow_index != value) {
454                                         currentrow_index = value;
455                                         Refresh ();
456                                 }
457                         }
458                 }
459
460                 [Browsable(false)]
461                 [EditorBrowsable(EditorBrowsableState.Never)]
462                 public override Cursor Cursor {
463                         get {
464                                 return base.Cursor;
465                         }
466                         set {
467                                 base.Cursor = value;
468                         }
469                 }
470
471                 [DefaultValue(null)]
472                 [Editor ("System.Windows.Forms.Design.DataMemberListEditor, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
473                 public string DataMember {
474                         get { return datamember; }
475                         set {
476                                 if (SetDataMember (datamember)) {
477                                         SetNewDataSource ();
478                                         Refresh ();
479                                 }
480                         }
481                 }
482
483                 [DefaultValue(null)]
484                 [RefreshProperties(RefreshProperties.Repaint)]
485                 [TypeConverter("System.Windows.Forms.Design.DataSourceConverter, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
486                 public object DataSource {
487                         get {
488                                 return datasource;
489                         }
490
491                         set {
492                                 if (SetDataSource (value)) {
493                                         SetNewDataSource ();
494                                         Refresh ();
495                                 }
496                         }
497                 }
498
499                 protected override Size DefaultSize {
500                         get {
501                                 return new Size (130, 80);
502                         }
503                 }
504
505                 [Browsable(false)]
506                 public int FirstVisibleColumn {
507                         get {
508                                 return firstvisible_column;
509                         }
510                 }
511
512                 [DefaultValue(false)]
513                 public bool FlatMode {
514                         get {
515                                 return flatmode;
516                         }
517
518                         set {
519                                 if (flatmode != value) {
520                                         flatmode = value;
521                                         OnFlatModeChanged (EventArgs.Empty);
522                                         Refresh ();
523                                 }
524                         }
525                 }
526
527                 public Color ForeColor {
528                         get {
529                                 return forecolor;
530                         }
531
532                         set {
533                                 if (forecolor != value) {
534                                         forecolor = value;
535                                         OnForeColorChanged (EventArgs.Empty);
536                                         Refresh ();
537                                 }
538                         }
539                 }
540
541                 public Color GridLineColor {
542                         get {
543                                 return gridline_color;
544                         }
545
546                         set {
547                                 if (value == Color.Empty) {
548                                         throw new ArgumentNullException ("Color.Empty value is invalid.");
549                                 }
550                                 
551                                 if (gridline_color != value) {
552                                         gridline_color = value;
553                                         Refresh ();
554                                 }
555                         }
556                 }
557
558                 [DefaultValue(DataGridLineStyle.Solid)]
559                 public DataGridLineStyle GridLineStyle {
560                         get {
561                                 return gridline_style;
562                         }
563
564                         set {
565                                 if (gridline_style != value) {
566                                         gridline_style = value;
567                                         Refresh ();
568                                 }
569                         }
570                 }
571
572                 public Color HeaderBackColor {
573                         get {
574                                 return header_backcolor;
575                         }
576
577                         set {
578                                 if (value == Color.Empty) {
579                                         throw new ArgumentNullException ("Color.Empty value is invalid.");
580                                 }
581                                 
582                                 if (header_backcolor != value) {
583                                         header_backcolor = value;
584                                         Refresh ();
585                                 }
586                         }
587                 }
588
589                 public Font HeaderFont {
590                         get {
591                                 return header_font;
592                         }
593
594                         set {
595                                 if (header_font != null && !header_font.Equals (value)) {
596                                         header_font = value;
597                                         Refresh ();
598                                 }
599                         }
600                 }
601
602                 public Color HeaderForeColor {
603                         get {
604                                 return header_forecolor;
605                         }
606
607                         set {
608                                 if (header_forecolor != value) {
609                                         header_forecolor = value;
610                                         Refresh ();
611                                 }
612                         }
613                 }
614
615                 protected ScrollBar HorizScrollBar {
616                         get {
617                                 return horiz_scrollbar;
618                         }
619                 }
620
621                 public object this [DataGridCell cell] {
622                         get  {
623                                 throw new NotImplementedException ();
624                         }
625
626                         set {
627                                 throw new NotImplementedException ();
628                         }
629                 }
630
631                 public object this [int rowIndex, int columnIndex] {
632                         get  {
633                                 throw new NotImplementedException ();
634                         }
635
636                         set {
637                                 throw new NotImplementedException ();
638                         }
639                 }
640
641                 public Color LinkColor {
642                         get {
643                                 return link_color;
644                         }
645                         set {
646                                 if (link_color != value) {
647                                         link_color = value;
648                                         Refresh ();
649                                 }
650                         }
651                 }
652
653                 [ComVisible(false)]
654                 [Browsable(false)]
655                 [EditorBrowsable(EditorBrowsableState.Never)]
656                 public Color LinkHoverColor {
657                         get {
658                                 return link_hovercolor;
659                         }
660
661                         set {
662                                 if (link_hovercolor != value) {
663                                         link_hovercolor = value;
664                                         Refresh ();
665                                 }
666                         }
667                 }
668
669                 [Browsable(false)]
670                 [EditorBrowsable(EditorBrowsableState.Advanced)]
671                 protected internal CurrencyManager ListManager {
672                         get {
673                                 if (BindingContext == null || DataSource  == null) {
674                                         return null;
675                                 }
676
677                                 return (CurrencyManager) BindingContext [DataSource, DataMember];
678                         }
679
680                         set {
681                                 throw new NotSupportedException ("Operation is not supported.");
682                         }
683                 }
684
685                 public Color ParentRowsBackColor {
686                         get {
687                                 return parentrowsback_color;
688                         }
689
690                         set {
691                                 if (parentrowsback_color != value) {
692                                         parentrowsback_color = value;
693                                         if (parentrows_visible) {
694                                                 Refresh ();
695                                         }
696                                 }
697                         }
698                 }
699
700                 public Color ParentRowsForeColor {
701                         get {
702                                 return parentrowsfore_color;
703                         }
704
705                         set {
706                                 if (parentrowsfore_color != value) {
707                                         parentrowsfore_color = value;
708                                         if (parentrows_visible) {
709                                                 Refresh ();
710                                         }
711                                 }
712                         }
713                 }
714
715                 [DefaultValue(DataGridParentRowsLabelStyle.Both)]
716                 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
717                 public DataGridParentRowsLabelStyle ParentRowsLabelStyle {
718                         get {
719                                 return parentrowslabel_style;
720                         }
721
722                         set {
723                                 if (parentrowslabel_style != value) {
724                                         parentrowslabel_style = value;
725                                         if (parentrows_visible) {
726                                                 Refresh ();
727                                         }
728                                         
729                                         OnParentRowsLabelStyleChanged (EventArgs.Empty);
730                                 }
731                         }
732                 }
733
734                 [DefaultValue(true)]
735                 public bool ParentRowsVisible {
736                         get {
737                                 return parentrows_visible;
738                         }
739
740                         set {
741                                 if (parentrows_visible != value) {
742                                         parentrows_visible = value;
743                                         grid_drawing.CalcGridAreas ();
744                                         Refresh ();
745                                         OnParentRowsVisibleChanged (EventArgs.Empty);
746                                 }
747                         }
748                 }
749
750                 // Settting this property seems to have no effect.
751                 [DefaultValue(75)]
752                 [TypeConverter(typeof(DataGridPreferredColumnWidthTypeConverter))]
753                 public int PreferredColumnWidth {
754                         get {
755                                 return preferredcolumn_width;
756                         }
757
758                         set {
759                                 if (value < 0) {
760                                         throw new ArgumentException ("PreferredColumnWidth is less than 0");
761                                 }
762                                 
763                                 if (preferredcolumn_width != value) {
764                                         preferredcolumn_width = value;
765                                         Refresh ();
766                                 }
767                         }
768                 }
769
770                 public int PreferredRowHeight {
771                         get {
772                                 return preferredrow_height;
773                         }
774
775                         set {
776                                 if (preferredrow_height != value) {
777                                         preferredrow_height = value;
778                                         grid_drawing.CalcGridAreas ();
779                                         Refresh ();
780                                 }
781                         }
782                 }
783
784                 [DefaultValue(false)]
785                 public bool ReadOnly {
786                         get {
787                                 return _readonly;
788                         }
789
790                         set {
791                                 if (_readonly != value) {
792                                         _readonly = value;
793                                         OnReadOnlyChanged (EventArgs.Empty);
794                                         Refresh ();
795                                 }
796                         }
797                 }
798
799                 [DefaultValue(true)]
800                 public bool RowHeadersVisible {
801                         get {
802                                 return rowheaders_visible;
803                         }
804
805                         set {
806                                 if (rowheaders_visible != value) {
807                                         rowheaders_visible = value;
808                                         grid_drawing.CalcGridAreas ();
809                                         Refresh ();
810                                 }
811                         }
812                 }
813
814                 [DefaultValue(35)]
815                 public int RowHeaderWidth {
816                         get {
817                                 return rowheaders_width;
818                         }
819
820                         set {
821                                 if (rowheaders_width != value) {
822                                         rowheaders_width = value;
823                                         grid_drawing.CalcGridAreas ();
824                                         Refresh ();
825                                 }
826                         }
827                 }
828
829                 public Color SelectionBackColor {
830                         get {
831                                 return selection_backcolor;
832                         }
833
834                         set {
835                                 if (selection_backcolor != value) {
836                                         selection_backcolor = value;
837                                         Refresh ();
838                                 }
839                         }
840                 }
841
842                 public Color SelectionForeColor  {
843                         get {
844                                 return selection_forecolor;
845                         }
846
847                         set {
848                                 if (selection_forecolor != value) {
849                                         selection_forecolor = value;
850                                         Refresh ();
851                                 }
852                         }
853                 }
854
855                 public override ISite Site {
856                         get {
857                                 return base.Site;
858                         }
859                         set {
860                                 base.Site = value;
861                         }
862                 }
863
864                 [Localizable(true)]
865                 [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
866                 public GridTableStylesCollection TableStyles {
867                         get { return styles_collection; }
868                 }
869
870                 [Bindable(false)]
871                 [Browsable(false)]
872                 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
873                 [EditorBrowsable(EditorBrowsableState.Never)]
874                 public override string Text {
875                         get {
876                                 return base.Text;
877                         }
878                         set {
879                                 base.Text = value;
880                         }
881                 }
882
883                 [Browsable(false)]
884                 [EditorBrowsable(EditorBrowsableState.Advanced)]
885                 protected ScrollBar VertScrollBar {
886                         get {
887                                 return vert_scrollbar;
888                         }
889                 }
890
891                 [Browsable(false)]
892                 public int VisibleColumnCount {
893                         get {
894                                 return visiblecolumn_count;
895                         }
896                 }
897
898                 // Calculated at DataGridDrawing.CalcRowsHeaders
899                 [Browsable(false)]
900                 public int VisibleRowCount {
901                         get {
902                                 return visiblerow_count;
903                         }
904                 }
905
906                 #endregion      // Public Instance Properties
907
908                 #region Private Instance Properties
909                 internal DataGridTableStyle CurrentTableStyle {
910                         get { 
911                                 return current_style;
912                         }
913                         set {
914                                 current_style = value;
915                         }
916                 }
917                                 
918                 internal int FirstVisibleRow {
919                         get { return first_visiblerow; }
920                         set { first_visiblerow = value;}
921                 }
922                 
923                 internal int RowsCount {
924                         get {                           
925                                 if (ListManager != null) {
926                                         return ListManager.Count;
927                                 }
928                                 
929                                 return 0;
930                         }
931                 }
932                 
933                 internal int RowHeight { 
934                         get {
935                                 if (preferredrow_height > Font.Height + 3) {
936                                         return preferredrow_height;
937                                         
938                                 } else {
939                                         return Font.Height + 3;
940                                 }
941                         }
942                 }
943
944                 #endregion Private Instance Properties
945
946                 #region Public Instance Methods
947
948                 public virtual bool BeginEdit (DataGridColumnStyle gridColumn, int rowNumber)
949                 {
950                         throw new NotImplementedException ();
951                 }
952
953                 public virtual void BeginInit ()
954                 {
955
956                 }
957
958
959                 protected virtual void CancelEditing ()
960                 {
961
962                 }
963
964                 public void Collapse (int row)
965                 {
966
967                 }
968
969                 protected internal virtual void ColumnStartedEditing (Control editingControl)
970                 {
971
972                 }
973
974                 protected internal virtual void ColumnStartedEditing (Rectangle bounds)
975                 {
976
977                 }
978
979                 protected override AccessibleObject CreateAccessibilityInstance ()
980                 {
981                         return base.CreateAccessibilityInstance ();
982                 }
983
984                 protected virtual DataGridColumnStyle CreateGridColumn (PropertyDescriptor prop)
985                 {
986                         return CreateGridColumn (prop, false);
987                 }
988
989                 protected virtual DataGridColumnStyle CreateGridColumn (PropertyDescriptor prop, bool isDefault)
990                 {
991                         throw new NotImplementedException ();
992                 }
993
994                 protected override void Dispose (bool disposing)
995                 {
996                         base.Dispose (disposing);
997                 }
998
999                 public virtual bool EndEdit (DataGridColumnStyle gridColumn, int rowNumber, bool shouldAbort)
1000                 {
1001                         throw new NotImplementedException ();
1002                 }
1003
1004                 public virtual void EndInit ()
1005                 {
1006
1007                 }
1008
1009                 public void Expand (int row)
1010                 {
1011
1012                 }
1013
1014                 public Rectangle GetCellBounds (DataGridCell dgc)
1015                 {
1016                         throw new NotImplementedException ();
1017                 }
1018
1019                 public Rectangle GetCellBounds (int row, int col)
1020                 {
1021                         throw new NotImplementedException ();
1022                 }
1023
1024                 public Rectangle GetCurrentCellBounds ()
1025                 {
1026                         throw new NotImplementedException ();
1027                 }
1028
1029                 protected virtual string GetOutputTextDelimiter ()
1030                 {
1031                         throw new NotImplementedException ();
1032                 }
1033
1034                 protected virtual void GridHScrolled (object sender, ScrollEventArgs se)
1035                 {
1036
1037                 }
1038
1039                 protected virtual void GridVScrolled (object sender, ScrollEventArgs se)
1040                 {
1041
1042                 }
1043
1044                 public HitTestInfo HitTest (Point position)
1045                 {
1046                         throw new NotImplementedException ();
1047                 }
1048
1049                 public HitTestInfo HitTest (int x, int y)
1050                 {
1051                         throw new NotImplementedException ();
1052                 }
1053
1054                 public bool IsExpanded (int rowNumber)
1055                 {
1056                         throw new NotImplementedException ();
1057                 }
1058
1059                 public bool IsSelected (int row)
1060                 {
1061                         throw new NotImplementedException ();
1062                 }
1063
1064                 public void NavigateBack ()
1065                 {
1066
1067                 }
1068
1069                 public void NavigateTo (int rowNumber, string relationName)
1070                 {
1071
1072                 }
1073
1074                 protected virtual void OnAllowNavigationChanged (EventArgs e)
1075                 {
1076                         if (AllowNavigationChanged != null) {
1077                                 AllowNavigationChanged (this, e);
1078                         }
1079                 }
1080
1081                 protected void OnBackButtonClicked (object sender,  EventArgs e)
1082                 {
1083                         if (BackButtonClick != null) {
1084                                 BackButtonClick (sender, e);
1085                         }
1086                 }
1087
1088                 protected override void OnBackColorChanged (EventArgs e)
1089                 {
1090                         base.OnBackColorChanged (e);
1091                 }
1092
1093                 protected virtual void OnBackgroundColorChanged (EventArgs e)
1094                 {
1095                         if (BackgroundColorChanged != null) {
1096                                 BackgroundColorChanged (this, e);
1097                         }
1098                 }
1099
1100                 protected override void OnBindingContextChanged( EventArgs e)
1101                 {
1102                         base.OnBindingContextChanged (e);
1103                 }
1104
1105                 protected virtual void OnBorderStyleChanged (EventArgs e)
1106                 {
1107                         if (BorderStyleChanged != null) {
1108                                 BorderStyleChanged (this, e);
1109                         }
1110                 }
1111
1112                 protected virtual void OnCaptionVisibleChanged (EventArgs e)
1113                 {
1114                         if (CaptionVisibleChanged != null) {
1115                                 CaptionVisibleChanged (this, e);
1116                         }
1117                 }
1118
1119                 protected virtual void OnCurrentCellChanged (EventArgs e)
1120                 {
1121                         if (CurrentCellChanged != null) {
1122                                 CurrentCellChanged (this, e);
1123                         }
1124                 }
1125
1126                 protected virtual void OnDataSourceChanged (EventArgs e)
1127                 {
1128                         if (DataSourceChanged != null) {
1129                                 DataSourceChanged (this, e);
1130                         }
1131                 }
1132
1133                 protected override void OnEnter (EventArgs e)
1134                 {
1135                         base.OnEnter (e);
1136                 }
1137
1138                 protected virtual void OnFlatModeChanged (EventArgs e)
1139                 {
1140                         if (FlatModeChanged != null) {
1141                                 FlatModeChanged (this, e);
1142                         }
1143                 }
1144
1145                 protected override void OnFontChanged (EventArgs e)
1146                 {
1147                         base.OnFontChanged (e);
1148                         grid_drawing.CalcGridAreas ();
1149                 }
1150
1151                 protected override void OnForeColorChanged (EventArgs e)
1152                 {
1153                         base.OnForeColorChanged (e);
1154                 }
1155
1156                 protected override void OnHandleCreated (EventArgs e)
1157                 {
1158                         base.OnHandleCreated (e);                       
1159                         grid_drawing.CalcGridAreas ();
1160                 }
1161
1162                 protected override void OnHandleDestroyed (EventArgs e)
1163                 {
1164                         base.OnHandleDestroyed (e);
1165                 }
1166
1167                 protected override void OnKeyDown (KeyEventArgs ke)
1168                 {
1169                         base.OnKeyDown (ke);
1170                 }
1171
1172                 protected override void OnKeyPress (KeyPressEventArgs kpe)
1173                 {
1174                         base.OnKeyPress (kpe);
1175                 }
1176
1177                 protected override void OnLayout (LayoutEventArgs levent)
1178                 {
1179                         base.OnLayout (levent);
1180                 }
1181
1182                 protected override void OnLeave (EventArgs e)
1183                 {
1184                         base.OnLeave (e);
1185                 }
1186
1187                 protected override void OnMouseDown (MouseEventArgs e)
1188                 {
1189                         base.OnMouseDown (e);
1190                 }
1191
1192                 protected override void OnMouseLeave (EventArgs e)
1193                 {
1194                         base.OnMouseLeave (e);
1195                 }
1196
1197                 protected override void OnMouseMove (MouseEventArgs e)
1198                 {
1199                         base.OnMouseMove (e);
1200                 }
1201
1202                 protected override void OnMouseUp (MouseEventArgs e)
1203                 {
1204                         base.OnMouseUp (e);
1205                 }
1206
1207                 protected override void OnMouseWheel (MouseEventArgs e)
1208                 {
1209                         base.OnMouseWheel (e);
1210                 }
1211
1212                 protected void OnNavigate (NavigateEventArgs e)
1213                 {
1214                         if (Navigate != null) {
1215                                 Navigate (this, e);
1216                         }
1217                 }
1218                 
1219                 protected override void OnPaint (PaintEventArgs pe)
1220                 {                       
1221                         grid_drawing.OnPaint (pe);                      
1222                 }
1223
1224                 protected override void OnPaintBackground (PaintEventArgs ebe)
1225                 {
1226                         base.OnPaintBackground (ebe);
1227                 }
1228
1229                 protected virtual void OnParentRowsLabelStyleChanged (EventArgs e)
1230                 {
1231                         if (ParentRowsLabelStyleChanged != null) {
1232                                 ParentRowsLabelStyleChanged (this, e);
1233                         }
1234                 }
1235
1236                 protected virtual void OnParentRowsVisibleChanged (EventArgs e)
1237                 {
1238                         if (ParentRowsVisibleChanged != null) {
1239                                 ParentRowsVisibleChanged (this, e);
1240                         }
1241                 }
1242
1243                 protected virtual void OnReadOnlyChanged (EventArgs e)
1244                 {
1245                         if (ReadOnlyChanged != null) {
1246                                 ReadOnlyChanged (this, e);
1247                         }
1248                 }
1249
1250                 protected override void OnResize (EventArgs e)
1251                 {
1252                         base.OnResize (e);
1253                 }
1254
1255                 protected void OnRowHeaderClick (EventArgs e)
1256                 {
1257                         if (RowHeaderClick != null) {
1258                                 RowHeaderClick (this, e);
1259                         }
1260                 }
1261
1262                 protected void OnScroll (EventArgs e)
1263                 {
1264                         if (Scroll != null) {
1265                                 Scroll (this, e);
1266                         }
1267                 }
1268
1269                 protected void OnShowParentDetailsButtonClicked (object sender, EventArgs e)
1270                 {
1271                         if (ShowParentDetailsButtonClick != null) {
1272                                 ShowParentDetailsButtonClick (sender, e);
1273                         }
1274                 }
1275
1276                 protected override bool ProcessDialogKey (Keys keyData)
1277                 {
1278                         return base.ProcessDialogKey (keyData);
1279                 }
1280
1281                 protected bool ProcessGridKey (KeyEventArgs ke)
1282                 {
1283                         throw new NotImplementedException ();
1284                 }
1285
1286                 protected override bool ProcessKeyPreview (ref Message m)
1287                 {
1288                         return base.ProcessKeyPreview (ref m);
1289                 }
1290
1291                 protected bool ProcessTabKey (Keys keyData)
1292                 {
1293                         throw new NotImplementedException ();
1294                 }
1295
1296                 public void ResetAlternatingBackColor ()
1297                 {
1298                         alternating_backcolor = def_alternating_backcolor;
1299                 }
1300
1301                 public override void ResetBackColor ()
1302                 {
1303                         background_color = def_background_color;
1304                 }
1305
1306                 public override void ResetForeColor ()
1307                 {
1308                         base.ResetForeColor ();
1309                 }
1310
1311                 public void ResetGridLineColor ()
1312                 {
1313                         gridline_color = def_gridline_color;
1314                 }
1315
1316                 public void ResetHeaderBackColor ()
1317                 {
1318                         header_backcolor = def_header_backcolor;
1319                 }
1320
1321                 public void ResetHeaderFont ()
1322                 {
1323                         header_font = def_header_font;
1324                 }
1325
1326                 public void ResetHeaderForeColor ()
1327                 {
1328                         header_forecolor = def_header_forecolor;
1329                 }
1330
1331                 public void ResetLinkColor ()
1332                 {
1333                         link_color = def_link_color;
1334                 }
1335
1336                 public void ResetLinkHoverColor ()
1337                 {
1338                         link_hovercolor = def_link_hovercolor;
1339                 }
1340
1341                 protected void ResetSelection ()
1342                 {
1343
1344                 }
1345
1346                 public void ResetSelectionBackColor ()
1347                 {
1348                         selection_backcolor = def_selection_backcolor;
1349                 }
1350
1351                 public void ResetSelectionForeColor ()
1352                 {
1353                         selection_forecolor = def_selection_forecolor;
1354                 }
1355
1356                 public void Select (int row)
1357                 {
1358
1359                 }
1360
1361                 public void SetDataBinding (object dataSource, string dataMember)
1362                 {
1363                         if (SetDataSource (dataSource) == false  && SetDataMember (dataMember) == false) {
1364                                 return;
1365                         }
1366
1367                         SetNewDataSource ();
1368                 }
1369
1370                 protected virtual bool ShouldSerializeAlternatingBackColor ()
1371                 {
1372                         return (alternating_backcolor != def_alternating_backcolor);
1373                 }
1374
1375                 protected virtual bool ShouldSerializeBackgroundColor ()
1376                 {
1377                         return (background_color != def_background_color);
1378                 }
1379
1380                 protected virtual bool ShouldSerializeCaptionBackColor ()
1381                 {
1382                         return (caption_backcolor != def_caption_backcolor);
1383                 }
1384
1385                 protected virtual bool ShouldSerializeCaptionForeColor ()
1386                 {
1387                         return (caption_forecolor != def_caption_forecolor);
1388                 }
1389
1390                 protected virtual bool ShouldSerializeGridLineColor ()
1391                 {
1392                         return (gridline_color != def_gridline_color);
1393                 }
1394
1395                 protected virtual bool ShouldSerializeHeaderBackColor ()
1396                 {
1397                         return (header_backcolor != def_header_backcolor);
1398                 }
1399
1400                 protected bool ShouldSerializeHeaderFont ()
1401                 {
1402                         return (header_font != def_header_font);
1403                 }
1404
1405                 protected virtual bool ShouldSerializeHeaderForeColor ()
1406                 {
1407                         return (header_forecolor != def_header_forecolor);
1408                 }
1409
1410                 protected virtual bool ShouldSerializeLinkHoverColor ()
1411                 {
1412                         return (link_hovercolor != def_link_hovercolor);
1413                 }
1414
1415                 protected virtual bool ShouldSerializeParentRowsBackColor ()
1416                 {
1417                         return (parentrowsback_color != def_parentrowsback_color);
1418                 }
1419
1420                 protected virtual bool ShouldSerializeParentRowsForeColor ()
1421                 {
1422                         return (parentrowsback_color != def_parentrowsback_color);
1423                 }
1424
1425                 protected bool ShouldSerializePreferredRowHeight ()
1426                 {
1427                         return (parentrowsfore_color != def_parentrowsfore_color);
1428                 }
1429
1430                 protected bool ShouldSerializeSelectionBackColor ()
1431                 {
1432                         return (selection_backcolor != def_selection_backcolor);
1433                 }
1434
1435                 protected virtual bool ShouldSerializeSelectionForeColor ()
1436                 {
1437                         return (selection_forecolor != def_selection_forecolor);
1438                 }
1439
1440                 public void SubObjectsSiteChange (bool site)
1441                 {
1442
1443                 }
1444
1445                 public void UnSelect (int row)
1446                 {
1447
1448                 }
1449                 #endregion      // Public Instance Methods
1450
1451                 #region Private Instance Methods
1452                 
1453                 internal void CalcAreasAndInvalidate ()
1454                 {
1455                         grid_drawing.CalcGridAreas ();
1456                         Invalidate ();
1457                 }
1458
1459                 private bool SetDataMember (string member)
1460                 {
1461                         if (member == datamember) {
1462                                 return false;
1463                         }
1464
1465                         datamember = member;
1466                         return true;
1467                 }
1468
1469                 private bool SetDataSource (object source)
1470                 {
1471                         if (datasource != null && datasource.Equals (source)) {
1472                                 return false;
1473                         }
1474
1475                         if (source != null && source as IListSource != null && source as IList != null) {
1476                                 throw new Exception ("Wrong complex data binding source");
1477                         }
1478
1479                         datasource = source;
1480                         OnDataSourceChanged (EventArgs.Empty);
1481                         return true;
1482                 }
1483
1484                 private void SetNewDataSource ()
1485                 {
1486                         // Create Table Style
1487                         // Create columns Styles
1488                         // Bind data
1489                         
1490                         current_style.DataGrid = this;
1491                         current_style.CreateColumnsForTable ();
1492                         grid_drawing.CalcGridAreas ();
1493                 }
1494                 
1495                 private void OnHorizontalScrollEvent (object sender, ScrollEventArgs e)
1496                 {
1497                         if (horiz_scrollbar.Value == horz_pixeloffset ||
1498                                 e.Type == ScrollEventType.EndScroll) {
1499                                 return;
1500                         }
1501                         
1502                         Rectangle invalidate = new Rectangle ();
1503                         Rectangle invalidate_column = new Rectangle ();
1504                         
1505                         if (horiz_scrollbar.Value > horz_pixeloffset) { // ScrollRight
1506                                 int pixels = horiz_scrollbar.Value - horz_pixeloffset;
1507                                 
1508                                 // Columns header
1509                                 invalidate_column.X = grid_drawing.ColumnsHeadersArea.X + grid_drawing.ColumnsHeadersArea.Width - pixels;
1510                                 invalidate_column.Y = grid_drawing.ColumnsHeadersArea.Y;
1511                                 invalidate_column.Width = pixels;
1512                                 invalidate_column.Height = grid_drawing.ColumnsHeadersArea.Height;
1513                                 XplatUI.ScrollWindow (Handle, grid_drawing.ColumnsHeadersArea, -pixels, 0, false);
1514                                 
1515                                 // Cells                                                                                                
1516                                 invalidate.X = grid_drawing.CellsArea.X + grid_drawing.CellsArea.Width - pixels;
1517                                 invalidate.Y = grid_drawing.CellsArea.Y;
1518                                 invalidate.Width = pixels;
1519                                 invalidate.Height = grid_drawing.CellsArea.Height;
1520                                 XplatUI.ScrollWindow (Handle, grid_drawing.CellsArea, -pixels, 0, false);                               
1521                                 
1522                         } else {                                
1523                                 int pixels = horz_pixeloffset - horiz_scrollbar.Value;
1524                                 
1525                                 // Columns header
1526                                 invalidate_column.X = grid_drawing.ColumnsHeadersArea.X;
1527                                 invalidate_column.Y = grid_drawing.ColumnsHeadersArea.Y;
1528                                 invalidate_column.Width = pixels;
1529                                 invalidate_column.Height = grid_drawing.ColumnsHeadersArea.Height;
1530                                 XplatUI.ScrollWindow (Handle, grid_drawing.ColumnsHeadersArea, pixels, 0, false);
1531                                 
1532                                 // Cells                                
1533                                 invalidate.X =  grid_drawing.CellsArea.X;
1534                                 invalidate.Y =  grid_drawing.CellsArea.Y;
1535                                 invalidate.Width = pixels;
1536                                 invalidate.Height = grid_drawing.CellsArea.Height;
1537                                 XplatUI.ScrollWindow (Handle, grid_drawing.CellsArea, pixels, 0, false);                                
1538                         }
1539                         
1540                         horz_pixeloffset = horiz_scrollbar.Value;
1541                         grid_drawing.UpdateVisibleColumn ();
1542                         Invalidate (invalidate_column);
1543                         Invalidate (invalidate);
1544                         
1545                 }
1546
1547                 private void OnTableStylesCollectionChanged (object sender, CollectionChangeEventArgs e)
1548                 {
1549                         Console.WriteLine ("Datagrid.TableStyles Collection Changed {0}, null {1}", e.Action,
1550                                 e.Element == null);
1551                         /*
1552                                 TODO: What's up if there are columns in the incoming TableStyle
1553                         */
1554
1555                         CurrentTableStyle = (DataGridTableStyle)e.Element;
1556
1557                         switch (e.Action)  {
1558                                 case CollectionChangeAction.Add: {
1559                                         ((DataGridTableStyle) e.Element).CreateColumnsForTable ();
1560                                         break;
1561                                 }
1562                                 case CollectionChangeAction.Remove:
1563                                         break;
1564                                 case CollectionChangeAction.Refresh:
1565                                         break;
1566
1567                                 default:
1568                                         break;
1569                         }
1570
1571                 }
1572                 
1573                 private void OnVerticalScrollEvent (object sender, EventArgs e)
1574                 {                       
1575                         if (vert_scrollbar.Value == first_visiblerow) {
1576                                 return;
1577                         }
1578                         
1579                         Rectangle invalidate = new Rectangle ();
1580                         
1581                         if (vert_scrollbar.Value > first_visiblerow ) { // Scrolldown 
1582                                 int scrolled_rows = vert_scrollbar.Value - first_visiblerow;
1583                                 int pixels = scrolled_rows * RowHeight;         
1584                                 
1585                                 invalidate.X =  grid_drawing.CellsArea.X;
1586                                 invalidate.Y =  grid_drawing.CellsArea.Y + grid_drawing.CellsArea.Height - pixels;
1587                                 invalidate.Width = grid_drawing.CellsArea.Width;
1588                                 invalidate.Height = pixels;                             
1589
1590                                 XplatUI.ScrollWindow (Handle, grid_drawing.CellsArea, 0, -pixels, false);                               
1591                                 
1592                         } else { // ScrollUp
1593                                 int scrolled_rows = first_visiblerow - vert_scrollbar.Value;
1594                                 int pixels = scrolled_rows * RowHeight;                         
1595                                 
1596                                 invalidate.X =  grid_drawing.CellsArea.X;
1597                                 invalidate.Y =  grid_drawing.CellsArea.Y;
1598                                 invalidate.Width = grid_drawing.CellsArea.Width;
1599                                 invalidate.Height = pixels;                             
1600                                 
1601                                 XplatUI.ScrollWindow (Handle, grid_drawing.CellsArea, 0, pixels, false);                                                                
1602                         }
1603                         
1604                         first_visiblerow =  vert_scrollbar.Value; 
1605                         grid_drawing.UpdateVisibleRowCount ();
1606                         Invalidate (invalidate);
1607                         Invalidate (grid_drawing.RowsHeadersArea);
1608                 }
1609                 
1610                 #endregion Private Instance Methods
1611
1612
1613                 #region Events
1614                 public event EventHandler AllowNavigationChanged;
1615                 public event EventHandler BackButtonClick;
1616                 public event EventHandler BackgroundColorChanged;
1617
1618                 [Browsable(false)]
1619                 [EditorBrowsable(EditorBrowsableState.Never)]
1620                 public new event EventHandler BackgroundImageChanged;
1621
1622                 public event EventHandler BorderStyleChanged;
1623                 public event EventHandler CaptionVisibleChanged;
1624                 public event EventHandler CurrentCellChanged;
1625
1626                 [Browsable(false)]
1627                 [EditorBrowsable(EditorBrowsableState.Never)]
1628                 public new event EventHandler CursorChanged;
1629
1630                 public event EventHandler DataSourceChanged;
1631                 public event EventHandler FlatModeChanged;
1632                 public event NavigateEventHandler Navigate;
1633                 public event EventHandler ParentRowsLabelStyleChanged;
1634                 public event EventHandler ParentRowsVisibleChanged;
1635                 public event EventHandler ReadOnlyChanged;
1636                 protected event EventHandler RowHeaderClick;
1637                 public event EventHandler Scroll;
1638                 public event EventHandler ShowParentDetailsButtonClick;
1639
1640                 [Browsable(false)]
1641                 [EditorBrowsable(EditorBrowsableState.Never)]
1642                 public new event EventHandler TextChanged;
1643                 #endregion      // Events
1644         }
1645 }