2008-03-27 Carlos Alberto Cortez <calberto.cortez@gmail.com>
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / DataGridViewRow.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 //      Pedro Martínez Juliá <pedromj@gmail.com>
24 //
25
26
27 #if NET_2_0
28
29 using System.ComponentModel;
30 using System.Drawing;
31 using System.Runtime.InteropServices;
32 using System.Collections;
33
34 namespace System.Windows.Forms {
35
36         [TypeConverter (typeof (DataGridRowConverter))]
37         public class DataGridViewRow : DataGridViewBand {
38
39                 private AccessibleObject accessibilityObject;
40                 private DataGridViewCellCollection cells;
41                 private ContextMenuStrip contextMenuStrip;
42                 private object dataBoundItem;
43                 private int dividerHeight;
44                 private string errorText;
45                 private DataGridViewRowHeaderCell headerCell;
46                 private int height;
47                 private int minimumHeight;
48
49                 public DataGridViewRow ()
50                 {
51                         cells = new DataGridViewCellCollection(this);
52                         minimumHeight = 3;
53                         height = -1;
54                         headerCell = new DataGridViewRowHeaderCell();
55                         accessibilityObject = new AccessibleObject ();
56                         SetState (DataGridViewElementStates.Visible);
57                 }
58
59                 [Browsable (false)]
60                 public AccessibleObject AccessibilityObject {
61                         get { return accessibilityObject; }
62                 }
63
64                 [Browsable (false)]
65                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
66                 public DataGridViewCellCollection Cells {
67                         get { return cells; }
68                 }
69
70                 [DefaultValue (null)]
71                 public override ContextMenuStrip ContextMenuStrip {
72                         get {
73                                 if (IsShared)
74                                         throw new InvalidOperationException ("Operation cannot be performed on a shared row.");
75                                         
76                                 return contextMenuStrip;
77                         }
78                         set {
79                                 if (contextMenuStrip != value) {
80                                         contextMenuStrip = value;
81                                         if (DataGridView != null) {
82                                                 DataGridView.OnRowContextMenuStripChanged(new DataGridViewRowEventArgs(this));
83                                         }
84                                 }
85                         }
86                 }
87
88                 [Browsable (false)]
89                 [EditorBrowsable (EditorBrowsableState.Advanced)]
90                 public object DataBoundItem {
91                         get { return dataBoundItem; }
92                 }
93
94                 [Browsable (true)]
95                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
96                 [NotifyParentProperty (true)]
97                 public override DataGridViewCellStyle DefaultCellStyle {
98                         get { return base.DefaultCellStyle; }
99                         set {
100                                 if (DefaultCellStyle != value) {
101                                         base.DefaultCellStyle = value;
102                                         if (DataGridView != null) {
103                                                 DataGridView.OnRowDefaultCellStyleChanged(new DataGridViewRowEventArgs(this));
104                                         }
105                                 }
106                         }
107                 }
108
109                 [Browsable (false)]
110                 public override bool Displayed {
111                         get {
112                                 if (IsShared)
113                                         throw new InvalidOperationException ("Getting the Displayed property of a shared row is not a valid operation.");
114                                         
115                                 return base.Displayed;
116                         }
117                 }
118
119                 [DefaultValue (0)]
120                 [NotifyParentProperty (true)]
121                 public int DividerHeight {
122                         get { return dividerHeight; }
123                         set { dividerHeight = value; }
124                 }
125
126                 [DefaultValue ("")]
127                 [NotifyParentProperty (true)]
128                 public string ErrorText {
129                         get {
130                                 if (IsShared)
131                                         throw new InvalidOperationException ("Operation cannot be performed on a shared row.");
132                                         
133                                 return errorText == null ? string.Empty : errorText;
134                         }
135                         set {
136                                 if (errorText != value) {
137                                         errorText = value;
138                                         if (DataGridView != null) {
139                                                 DataGridView.OnRowErrorTextChanged(new DataGridViewRowEventArgs(this));
140                                         }
141                                 }
142                         }
143                 }
144
145                 [Browsable (false)]
146                 public override bool Frozen {
147                         get {
148                                 if (IsShared)
149                                         throw new InvalidOperationException ("Getting the Frozen property of a shared row is not a valid operation.");
150                                         
151                                 return base.Frozen;
152                         }
153                         set { base.Frozen = value; }
154                 }
155
156                 [Browsable (false)]
157                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
158                 public DataGridViewRowHeaderCell HeaderCell {
159                         get { return headerCell; }
160                         set {
161                                 if (headerCell != value) {
162                                         headerCell = value;
163                                         if (DataGridView != null) {
164                                                 DataGridView.OnRowHeaderCellChanged(new DataGridViewRowEventArgs(this));
165                                         }
166                                 }
167                         }
168                 }
169
170                 [DefaultValue (22)]
171                 [NotifyParentProperty (true)]
172                 public int Height {
173                         get {
174                                 if (height < 0) {
175                                         if (DefaultCellStyle != null && DefaultCellStyle.Font != null) {
176                                                 return DefaultCellStyle.Font.Height + 9;
177                                         }
178                                         if (Index >= 0 && InheritedStyle != null && InheritedStyle.Font != null) {
179                                                 return InheritedStyle.Font.Height + 9;
180                                         }
181                                         return System.Windows.Forms.Control.DefaultFont.Height + 9;
182                                 }
183                                 return height;
184                         }
185                         set {
186                                 if (height != value) {
187                                         if (value < minimumHeight) {
188                                                 throw new ArgumentOutOfRangeException("Height can't be less than MinimumHeight.");
189                                         }
190                                         height = value;
191                                         if (DataGridView != null) {
192                                                 DataGridView.OnRowHeightChanged(new DataGridViewRowEventArgs(this));
193                                         }
194                                 }
195                         }
196                 }
197
198                 public override DataGridViewCellStyle InheritedStyle {
199                         get {
200                                 if (Index == -1)
201                                         throw new InvalidOperationException ("Getting the InheritedStyle property of a shared row is not a valid operation.");
202                                         
203                                 if (DataGridView == null) {
204                                         return DefaultCellStyle;
205                                 }
206                                 else {
207                                         if (DefaultCellStyle == null) {
208                                                 return DataGridView.DefaultCellStyle;
209                                         }
210                                         else {
211                                                 DataGridViewCellStyle style = (DataGridViewCellStyle) DefaultCellStyle.Clone();
212                                                 /////// Combination with dataGridView.DefaultCellStyle
213                                                 return style;
214                                         }
215                                 }
216                         }
217                 }
218
219                 [Browsable (false)]
220                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
221                 public bool IsNewRow {
222                         get {
223                                 if (DataGridView != null && DataGridView.Rows[DataGridView.Rows.Count - 1] == this && DataGridView.NewRowIndex == Index) {
224                                         return true;
225                                 }
226                                 return false;
227                         }
228                 }
229
230                 internal bool IsShared {
231                         get {
232                                 return Index == -1 && DataGridView != null;
233                         }
234                 }
235
236                 [Browsable (false)]
237                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
238                 public int MinimumHeight {
239                         get { return minimumHeight; }
240                         set {
241                                 if (minimumHeight != value) {
242                                         if (value < 2 || value > Int32.MaxValue) {
243                                                 throw new ArgumentOutOfRangeException("MinimumHeight should be between 2 and Int32.MaxValue.");
244                                         }
245                                         minimumHeight = value;
246                                         if (DataGridView != null) {
247                                                 DataGridView.OnRowMinimumHeightChanged(new DataGridViewRowEventArgs(this));
248                                         }
249                                 }
250                         }
251                 }
252
253                 [Browsable (true)]
254                 [DefaultValue (false)]
255                 [NotifyParentProperty (true)]
256                 public override bool ReadOnly {
257                         get {
258                                 if (IsShared)
259                                         throw new InvalidOperationException ("Getting the ReadOnly property of a shared row is not a valid operation.");
260                                         
261                                 if (DataGridView != null && DataGridView.ReadOnly)
262                                         return true;
263                                         
264                                 return base.ReadOnly;
265                         }
266                         set { base.ReadOnly = value; }
267                 }
268
269                 [NotifyParentProperty (true)]
270                 public override DataGridViewTriState Resizable {
271                         get {
272                                 if (IsShared)
273                                         throw new InvalidOperationException ("Getting the Resizable property of a shared row is not a valid operation.");
274                                         
275                                 return base.Resizable;
276                         }
277                         set { base.Resizable = value; }
278                 }
279
280                 public override bool Selected {
281                         get {
282                                 if (IsShared)
283                                         throw new InvalidOperationException ("Getting the Selected property of a shared row is not a valid operation.");
284                                         
285                                 return base.Selected;
286                         }
287                         set {
288                                 if (Index == -1) {
289                                         throw new InvalidOperationException("The row is a shared row.");
290                                 }
291                                 if (DataGridView == null) {
292                                         throw new InvalidOperationException("The row has not been added to a DataGridView control.");
293                                 }
294                                 base.Selected = value;
295                         }
296                 }
297
298                 public override DataGridViewElementStates State {
299                         get {
300                                 if (IsShared)
301                                         throw new InvalidOperationException ("Getting the State property of a shared row is not a valid operation.");
302                                         
303                                 return base.State;
304                         }
305                 }
306
307                 [Browsable (false)]
308                 public override bool Visible {
309                         get {
310                                 if (IsShared)
311                                         throw new InvalidOperationException ("Getting the Visible property of a shared row is not a valid operation.");
312                                         
313                                 return base.Visible;
314                         }
315                         set {
316                                 if (IsNewRow && value == false) {
317                                         throw new InvalidOperationException("Cant make invisible a new row.");
318                                 }
319                                 base.Visible = value;
320                         }
321                 }
322
323                 [EditorBrowsable (EditorBrowsableState.Advanced)]
324                 public virtual DataGridViewAdvancedBorderStyle AdjustRowHeaderBorderStyle (DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStyleInput, DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStylePlaceholder, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedRow, bool isLastVisibleRow)
325                 {
326                         throw new NotImplementedException();
327                 }
328
329                 public override object Clone ()
330                 {
331                         DataGridViewRow row = (DataGridViewRow) MemberwiseClone();
332                         row.cells = new DataGridViewCellCollection(row);
333                         foreach (DataGridViewCell cell in cells) {
334                                 row.cells.Add(cell.Clone() as DataGridViewCell);
335                         }
336                         return row;
337                 }
338
339                 public void CreateCells (DataGridView dataGridView)
340                 {
341                         if (dataGridView == null) {
342                                 throw new ArgumentNullException("DataGridView is null.");
343                         }
344                         if (dataGridView.Rows.Contains(this)) {
345                                 throw new InvalidOperationException("The row already exists in the DataGridView.");
346                         }
347                         DataGridViewCellCollection newCellCollection = new DataGridViewCellCollection(this);
348                         foreach (DataGridViewColumn column in dataGridView.Columns) {
349                                 if (column.CellTemplate == null) {
350                                         throw new InvalidOperationException("Cell template not set in column: " + column.Index.ToString() + ".");
351                                 }
352                                 newCellCollection.Add((DataGridViewCell) column.CellTemplate.Clone());
353                         }
354                         cells = newCellCollection;
355                 }
356
357                 public void CreateCells (DataGridView dataGridView, params object[] values)
358                 {
359                         if (values == null) {
360                                 throw new ArgumentNullException("values is null");
361                         }
362                         CreateCells(dataGridView);
363                         for (int i = 0; i < values.Length; i++) {
364                                 cells[i].Value = values[i];
365                         }
366                 }
367
368                 public ContextMenuStrip GetContextMenuStrip (int rowIndex)
369                 {
370                         if (rowIndex == -1) {
371                                 throw new InvalidOperationException("rowIndex is -1");
372                         }
373                         if (rowIndex < 0 || rowIndex >= DataGridView.Rows.Count) {
374                                 throw new ArgumentOutOfRangeException("rowIndex is out of range");
375                         }
376
377                         return null; // XXX
378                 }
379
380                 public string GetErrorText (int rowIndex)
381                 {
382                         return "";
383                 }
384
385                 public virtual int GetPreferredHeight (int rowIndex, DataGridViewAutoSizeRowMode autoSizeRowMode, bool fixedWidth)
386                 {
387                         throw new NotImplementedException();
388                 }
389
390                 [EditorBrowsable (EditorBrowsableState.Advanced)]
391                 public virtual DataGridViewElementStates GetState (int rowIndex)
392                 {
393                         DataGridViewElementStates state = DataGridViewElementStates.None;
394                         
395                         if (rowIndex == -1) {
396                                 state |= DataGridViewElementStates.Displayed;
397                                 
398                                 if (DataGridView.ReadOnly)
399                                         state |= DataGridViewElementStates.ReadOnly;
400                                 if (DataGridView.AllowUserToResizeRows)
401                                         state |= DataGridViewElementStates.Resizable;
402                                 if (DataGridView.Visible)
403                                         state |= DataGridViewElementStates.Visible;
404                         
405                                 return state;
406                         }
407                         
408                         DataGridViewRow row = DataGridView.Rows[rowIndex];
409
410                         if (row.Displayed)
411                                 state |= DataGridViewElementStates.Displayed;
412                         if (row.Frozen)
413                                 state |= DataGridViewElementStates.Frozen;
414                         if (row.ReadOnly)
415                                 state |= DataGridViewElementStates.ReadOnly;
416                         if (row.Resizable == DataGridViewTriState.True || (row.Resizable == DataGridViewTriState.NotSet && DataGridView.AllowUserToResizeRows))
417                                 state |= DataGridViewElementStates.Resizable;
418                         if (row.Resizable == DataGridViewTriState.True)
419                                 state |= DataGridViewElementStates.ResizableSet;
420                         if (row.Selected)
421                                 state |= DataGridViewElementStates.Selected;
422                         if (row.Visible)
423                                 state |= DataGridViewElementStates.Visible;
424                                 
425                         return state;
426                 }
427
428                 public bool SetValues (params object[] values)
429                 {
430                         if (values == null) {
431                                 throw new ArgumentNullException("vues is null");
432                         }
433                         if (DataGridView != null && DataGridView.VirtualMode) {
434                                 throw new InvalidOperationException("DataGridView is operating in virtual mode");
435                         }
436                         /////// COLUMNAS //////////
437                         for (int i = 0; i < values.Length; i++) {
438                                 DataGridViewCell cell;
439                                 if (cells.Count > i) {
440                                         cell = cells [i];
441                                 } else {
442                                         cell = new DataGridViewTextBoxCell ();
443                                         cells.Add (cell);
444                                 }
445                                 cell.Value = values[i];
446                         }
447                         
448                         // XXX
449                         return true;
450                 }
451
452                 public override string ToString ()
453                 {
454                         return this.GetType().Name + ", Band Index: " + base.Index.ToString();
455                 }
456
457                 protected virtual AccessibleObject CreateAccessibilityInstance ()
458                 {
459                         return new DataGridViewRowAccessibleObject(this);
460                 }
461
462                 [EditorBrowsable (EditorBrowsableState.Advanced)]
463                 protected virtual DataGridViewCellCollection CreateCellsInstance ()
464                 {
465                         cells = new DataGridViewCellCollection(this);
466                         return cells;
467                 }
468
469                 [EditorBrowsable (EditorBrowsableState.Advanced)]
470                 protected internal virtual void DrawFocus (Graphics graphics, Rectangle clipBounds, Rectangle bounds, int rowIndex, DataGridViewElementStates rowState, DataGridViewCellStyle cellStyle, bool cellsPaintSelectionBackground)
471                 {
472                 }
473
474                 protected internal virtual void Paint (Graphics graphics, Rectangle clipBounds, Rectangle rowBounds, int rowIndex, DataGridViewElementStates rowState, bool isFirstDisplayedRow, bool isLastVisibleRow)
475                 {
476                         DataGridViewCellStyle style;
477                         
478                         if (Index == -1)
479                                 style = DataGridView.RowsDefaultCellStyle;
480                         else
481                                 style = InheritedStyle;
482                                 
483                         DataGridViewRowPrePaintEventArgs pre = new DataGridViewRowPrePaintEventArgs (DataGridView, graphics, clipBounds, rowBounds, rowIndex, rowState, string.Empty, style, isFirstDisplayedRow, isLastVisibleRow);
484                         pre.PaintParts = DataGridViewPaintParts.All;
485
486                         DataGridView.OnRowPrePaint (pre);
487
488                         // The user has elected for us to not do anything
489                         if (pre.Handled)
490                                 return;
491
492                         if (DataGridView.RowHeadersVisible)
493                                 PaintHeader (graphics, pre.ClipBounds, rowBounds, rowIndex, rowState, isFirstDisplayedRow, isLastVisibleRow, pre.PaintParts);
494                         
495                         PaintCells (graphics, pre.ClipBounds, rowBounds, rowIndex, rowState, isFirstDisplayedRow, isLastVisibleRow, pre.PaintParts);
496
497                         DataGridViewRowPostPaintEventArgs post = new DataGridViewRowPostPaintEventArgs (DataGridView, graphics, pre.ClipBounds, rowBounds, rowIndex, rowState, pre.ErrorText, style, isFirstDisplayedRow, isLastVisibleRow);
498                         DataGridView.OnRowPostPaint (post);
499                 }
500
501                 [EditorBrowsable (EditorBrowsableState.Advanced)]
502                 protected internal virtual void PaintCells (Graphics graphics, Rectangle clipBounds, Rectangle rowBounds, int rowIndex, DataGridViewElementStates rowState, bool isFirstDisplayedRow, bool isLastVisibleRow, DataGridViewPaintParts paintParts)
503                 {
504                         ArrayList sortedColumns = DataGridView.Columns.ColumnDisplayIndexSortedArrayList;
505                         
506                         Rectangle bounds = rowBounds;
507                         
508                         // If row headers are visible, adjust our starting point
509                         if (DataGridView.RowHeadersVisible) {
510                                 bounds.X += DataGridView.RowHeadersWidth;
511                                 bounds.Width -= DataGridView.RowHeadersWidth;
512                         }
513                         
514                         for (int i = DataGridView.first_col_index; i < sortedColumns.Count; i++) {
515                                 DataGridViewColumn col = (DataGridViewColumn)sortedColumns[i];
516                                 bounds.Width = col.Width;
517                                 DataGridViewCell cell = Cells[col.Index];
518                                 
519                                 graphics.FillRectangle (Brushes.White, bounds);
520                                 
521                                 DataGridViewCellStyle style;
522
523                                 if (cell.RowIndex == -1)
524                                         style = DefaultCellStyle;
525                                 else
526                                         style = cell.InheritedStyle;
527
528                                 object value;
529                                 object formattedValue;
530                                 string errorText;
531                                 DataGridViewElementStates cellState;
532                                 
533                                 if (cell.RowIndex == -1) {
534                                         // TODO: Look up value if databound.
535                                         value = null;
536                                         formattedValue = null;
537                                         errorText = null;
538                                         cellState = cell.State;
539                                 } else {
540                                         value = cell.Value;
541                                         formattedValue = cell.FormattedValue;
542                                         errorText = cell.ErrorText;
543                                         cellState = cell.InheritedState;
544                                 }
545
546                                 DataGridViewAdvancedBorderStyle intermediateBorderStyle = (DataGridViewAdvancedBorderStyle)((ICloneable)DataGridView.AdvancedCellBorderStyle).Clone ();
547                                 DataGridViewAdvancedBorderStyle borderStyle = cell.AdjustCellBorderStyle (DataGridView.AdvancedCellBorderStyle, intermediateBorderStyle, true, true, cell.ColumnIndex == 0, cell.RowIndex == 0);
548                                 DataGridView.OnCellFormattingInternal (new DataGridViewCellFormattingEventArgs (cell.ColumnIndex, cell.RowIndex, value, cell.FormattedValueType, style));
549
550
551                                 cell.PaintWork (graphics, clipBounds, bounds, rowIndex, cellState, style, borderStyle, paintParts);
552                                 bounds.X += bounds.Width;
553                         }
554                 }
555
556                 [EditorBrowsable (EditorBrowsableState.Advanced)]
557                 protected internal virtual void PaintHeader (Graphics graphics, Rectangle clipBounds, Rectangle rowBounds, int rowIndex, DataGridViewElementStates rowState, bool isFirstDisplayedRow, bool isLastVisibleRow, DataGridViewPaintParts paintParts)
558                 {
559                         rowBounds.Width = DataGridView.RowHeadersWidth;
560                         graphics.FillRectangle (Brushes.White, rowBounds);
561         
562                         HeaderCell.PaintWork (graphics, clipBounds, rowBounds, rowIndex, rowState, HeaderCell.InheritedStyle, DataGridView.AdvancedRowHeadersBorderStyle, paintParts);
563                 }
564
565                 internal override void SetDataGridView (DataGridView dataGridView)
566                 {
567                         base.SetDataGridView(dataGridView);
568                         headerCell.SetDataGridView(dataGridView);
569                         foreach (DataGridViewCell cell in cells)
570                                 cell.SetDataGridView (dataGridView);
571                 }
572
573                 internal override void SetState (DataGridViewElementStates state)
574                 {
575                         if (State != state) {
576                                 base.SetState(state);
577                                 if (DataGridView != null) {
578                                         DataGridView.OnRowStateChanged(this.Index, new DataGridViewRowStateChangedEventArgs(this, state));
579                                 }
580                         }
581                 }
582
583                 [ComVisibleAttribute(true)]
584                 protected class DataGridViewRowAccessibleObject : AccessibleObject {
585
586                         private DataGridViewRow dataGridViewRow;
587
588                         public DataGridViewRowAccessibleObject ()
589                         {
590                         }
591
592                         public DataGridViewRowAccessibleObject (DataGridViewRow owner)
593                         {
594                                 this.dataGridViewRow = owner;
595                         }
596
597                         public override Rectangle Bounds {
598                                 get { throw new NotImplementedException(); }
599                         }
600
601                         public override string Name {
602                                 get { return "Index: " + dataGridViewRow.Index.ToString(); }
603                         }
604
605                         public DataGridViewRow Owner {
606                                 get { return dataGridViewRow; }
607                                 set { dataGridViewRow = value; }
608                         }
609
610                         public override AccessibleObject Parent {
611                                 get { return dataGridViewRow.AccessibilityObject; }
612                         }
613
614                         public override AccessibleRole Role {
615                                 get { return AccessibleRole.Row; }
616                         }
617
618                         public override AccessibleStates State {
619                                 get {
620                                         if (dataGridViewRow.Selected) {
621                                                 return AccessibleStates.Selected;
622                                         }
623                                         else {
624                                                 return AccessibleStates.Focused;
625                                         }
626                                 }
627                         }
628
629                         public override string Value {
630                                 get {
631                                         if (dataGridViewRow.Cells.Count == 0) {
632                                                 return "(Create New)";
633                                         }
634                                         string result = "";
635                                         foreach (DataGridViewCell cell in dataGridViewRow.Cells) {
636                                                 result += cell.AccessibilityObject.Value;
637                                         }
638                                         return result;
639                                 }
640                         }
641
642                         public override AccessibleObject GetChild (int index) {
643                                 throw new NotImplementedException();
644                         }
645
646                         public override int GetChildCount () {
647                                 throw new NotImplementedException();
648                         }
649
650                         public override AccessibleObject GetFocused () {
651                                 return null;
652                         }
653
654                         public override AccessibleObject GetSelected () {
655                                 return null;
656                         }
657
658                         public override AccessibleObject Navigate (AccessibleNavigation navigationDirection) {
659                                 switch (navigationDirection) {
660                                         case AccessibleNavigation.Right:
661                                                 break;
662                                         case AccessibleNavigation.Left:
663                                                 break;
664                                         case AccessibleNavigation.Next:
665                                                 break;
666                                         case AccessibleNavigation.Previous:
667                                                 break;
668                                         case AccessibleNavigation.Up:
669                                                 break;
670                                         case AccessibleNavigation.Down:
671                                                 break;
672                                         default:
673                                                 return null;
674                                 }
675                                 return null;
676                         }
677
678                         public override void Select (AccessibleSelection flags) {
679                                 switch (flags) {
680                                         case AccessibleSelection.TakeFocus:
681                                                 dataGridViewRow.DataGridView.Focus();
682                                                 break;
683                                         case AccessibleSelection.TakeSelection:
684                                                 //dataGridViewRow.Focus();
685                                                 break;
686                                         case AccessibleSelection.AddSelection:
687                                                 dataGridViewRow.DataGridView.SelectedRows.InternalAdd(dataGridViewRow);
688                                                 break;
689                                         case AccessibleSelection.RemoveSelection:
690                                                 dataGridViewRow.DataGridView.SelectedRows.InternalRemove(dataGridViewRow);
691                                                 break;
692                                 }
693                         }
694
695                 }
696
697
698
699         }
700         
701         internal class DataGridRowConverter : TypeConverter
702         {
703         }
704 }
705
706 #endif