Made gmcs specific
[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                         DataGridViewRow row = DataGridView.Rows[rowIndex];
395
396                         if (row.Displayed)
397                                 state |= DataGridViewElementStates.Displayed;
398                         if (row.Frozen)
399                                 state |= DataGridViewElementStates.Frozen;
400                         if (row.ReadOnly)
401                                 state |= DataGridViewElementStates.ReadOnly;
402                         if (row.Resizable == DataGridViewTriState.True || (row.Resizable == DataGridViewTriState.NotSet && DataGridView.AllowUserToResizeRows))
403                                 state |= DataGridViewElementStates.Resizable;
404                         if (row.Resizable == DataGridViewTriState.True)
405                                 state |= DataGridViewElementStates.ResizableSet;
406                         if (row.Selected)
407                                 state |= DataGridViewElementStates.Selected;
408                         if (row.Visible)
409                                 state |= DataGridViewElementStates.Visible;
410                                 
411                         return state;
412                 }
413
414                 public bool SetValues (params object[] values)
415                 {
416                         if (values == null) {
417                                 throw new ArgumentNullException("vues is null");
418                         }
419                         if (DataGridView != null && DataGridView.VirtualMode) {
420                                 throw new InvalidOperationException("DataGridView is operating in virtual mode");
421                         }
422                         /////// COLUMNAS //////////
423                         for (int i = 0; i < values.Length; i++) {
424                                 DataGridViewCell cell;
425                                 if (cells.Count > i) {
426                                         cell = cells [i];
427                                 } else {
428                                         cell = new DataGridViewTextBoxCell ();
429                                         cells.Add (cell);
430                                 }
431                                 cell.Value = values[i];
432                         }
433                         
434                         // XXX
435                         return true;
436                 }
437
438                 public override string ToString ()
439                 {
440                         return this.GetType().Name + ", Band Index: " + base.Index.ToString();
441                 }
442
443                 protected virtual AccessibleObject CreateAccessibilityInstance ()
444                 {
445                         return new DataGridViewRowAccessibleObject(this);
446                 }
447
448                 [EditorBrowsable (EditorBrowsableState.Advanced)]
449                 protected virtual DataGridViewCellCollection CreateCellsInstance ()
450                 {
451                         cells = new DataGridViewCellCollection(this);
452                         return cells;
453                 }
454
455                 [EditorBrowsable (EditorBrowsableState.Advanced)]
456                 protected internal virtual void DrawFocus (Graphics graphics, Rectangle clipBounds, Rectangle bounds, int rowIndex, DataGridViewElementStates rowState, DataGridViewCellStyle cellStyle, bool cellsPaintSelectionBackground)
457                 {
458                 }
459
460                 protected internal virtual void Paint (Graphics graphics, Rectangle clipBounds, Rectangle rowBounds, int rowIndex, DataGridViewElementStates rowState, bool isFirstDisplayedRow, bool isLastVisibleRow)
461                 {
462                         DataGridViewRowPrePaintEventArgs pre = new DataGridViewRowPrePaintEventArgs (DataGridView, graphics, clipBounds, rowBounds, rowIndex, rowState, string.Empty, InheritedStyle, isFirstDisplayedRow, isLastVisibleRow);
463                         pre.PaintParts = DataGridViewPaintParts.All;
464
465                         DataGridView.OnRowPrePaint (pre);
466
467                         // The user has elected for us to not do anything
468                         if (pre.Handled)
469                                 return;
470
471                         if (DataGridView.RowHeadersVisible)
472                                 PaintHeader (graphics, pre.ClipBounds, rowBounds, rowIndex, rowState, isFirstDisplayedRow, isLastVisibleRow, pre.PaintParts);
473                         
474                         PaintCells (graphics, pre.ClipBounds, rowBounds, rowIndex, rowState, isFirstDisplayedRow, isLastVisibleRow, pre.PaintParts);
475
476                         DataGridViewRowPostPaintEventArgs post = new DataGridViewRowPostPaintEventArgs (DataGridView, graphics, pre.ClipBounds, rowBounds, rowIndex, rowState, pre.ErrorText, InheritedStyle, isFirstDisplayedRow, isLastVisibleRow);
477                         DataGridView.OnRowPostPaint (post);
478                 }
479
480                 [EditorBrowsable (EditorBrowsableState.Advanced)]
481                 protected internal virtual void PaintCells (Graphics graphics, Rectangle clipBounds, Rectangle rowBounds, int rowIndex, DataGridViewElementStates rowState, bool isFirstDisplayedRow, bool isLastVisibleRow, DataGridViewPaintParts paintParts)
482                 {
483                         ArrayList sortedColumns = DataGridView.Columns.ColumnDisplayIndexSortedArrayList;
484                         
485                         Rectangle bounds = rowBounds;
486                         
487                         // If row headers are visible, adjust our starting point
488                         if (DataGridView.RowHeadersVisible) {
489                                 bounds.X += DataGridView.RowHeadersWidth;
490                                 bounds.Width -= DataGridView.RowHeadersWidth;
491                         }
492                         
493                         foreach (DataGridViewCell cell in Cells) {
494                                 bounds.Width = DataGridView.Columns[cell.ColumnIndex].Width;
495                                 
496                                 graphics.FillRectangle (Brushes.White, bounds);
497                                 
498                                 DataGridViewCellStyle style;
499
500                                 if (cell.RowIndex == -1)
501                                         style = DefaultCellStyle;
502                                 else
503                                         style = cell.InheritedStyle;
504
505                                 object value;
506                                 object formattedValue;
507                                 string errorText;
508                                 DataGridViewElementStates cellState;
509                                 
510                                 if (cell.RowIndex == -1) {
511                                         // TODO: Look up value if databound.
512                                         value = null;
513                                         formattedValue = null;
514                                         errorText = null;
515                                         cellState = cell.State;
516                                 } else {
517                                         value = cell.Value;
518                                         formattedValue = cell.FormattedValue;
519                                         errorText = cell.ErrorText;
520                                         cellState = cell.InheritedState;
521                                 }
522
523                                 DataGridViewAdvancedBorderStyle intermediateBorderStyle = (DataGridViewAdvancedBorderStyle)((ICloneable)DataGridView.AdvancedCellBorderStyle).Clone ();
524                                 DataGridViewAdvancedBorderStyle borderStyle = cell.AdjustCellBorderStyle (DataGridView.AdvancedCellBorderStyle, intermediateBorderStyle, true, true, cell.ColumnIndex == 0, cell.RowIndex == 0);
525                                 DataGridView.OnCellFormattingInternal (new DataGridViewCellFormattingEventArgs (cell.ColumnIndex, cell.RowIndex, value, cell.FormattedValueType, style));
526
527                                 cell.PaintWork (graphics, clipBounds, bounds, rowIndex, cellState, cell.InheritedStyle, borderStyle, paintParts);
528                                 bounds.X += bounds.Width;
529                         }
530                 }
531
532                 [EditorBrowsable (EditorBrowsableState.Advanced)]
533                 protected internal virtual void PaintHeader (Graphics graphics, Rectangle clipBounds, Rectangle rowBounds, int rowIndex, DataGridViewElementStates rowState, bool isFirstDisplayedRow, bool isLastVisibleRow, DataGridViewPaintParts paintParts)
534                 {
535                         rowBounds.Width = DataGridView.RowHeadersWidth;
536                         graphics.FillRectangle (Brushes.White, rowBounds);
537         
538                         HeaderCell.PaintWork (graphics, clipBounds, rowBounds, rowIndex, rowState, HeaderCell.InheritedStyle, DataGridView.AdvancedRowHeadersBorderStyle, paintParts);
539                 }
540
541                 internal override void SetDataGridView (DataGridView dataGridView)
542                 {
543                         base.SetDataGridView(dataGridView);
544                         headerCell.SetDataGridView(dataGridView);
545                         foreach (DataGridViewCell cell in cells)
546                                 cell.SetDataGridView (dataGridView);
547                 }
548
549                 internal override void SetState (DataGridViewElementStates state)
550                 {
551                         if (State != state) {
552                                 base.SetState(state);
553                                 if (DataGridView != null) {
554                                         DataGridView.OnRowStateChanged(this.Index, new DataGridViewRowStateChangedEventArgs(this, state));
555                                 }
556                         }
557                 }
558
559                 [ComVisibleAttribute(true)]
560                 protected class DataGridViewRowAccessibleObject : AccessibleObject {
561
562                         private DataGridViewRow dataGridViewRow;
563
564                         public DataGridViewRowAccessibleObject ()
565                         {
566                         }
567
568                         public DataGridViewRowAccessibleObject (DataGridViewRow owner)
569                         {
570                                 this.dataGridViewRow = owner;
571                         }
572
573                         public override Rectangle Bounds {
574                                 get { throw new NotImplementedException(); }
575                         }
576
577                         public override string Name {
578                                 get { return "Index: " + dataGridViewRow.Index.ToString(); }
579                         }
580
581                         public DataGridViewRow Owner {
582                                 get { return dataGridViewRow; }
583                                 set { dataGridViewRow = value; }
584                         }
585
586                         public override AccessibleObject Parent {
587                                 get { return dataGridViewRow.AccessibilityObject; }
588                         }
589
590                         public override AccessibleRole Role {
591                                 get { return AccessibleRole.Row; }
592                         }
593
594                         public override AccessibleStates State {
595                                 get {
596                                         if (dataGridViewRow.Selected) {
597                                                 return AccessibleStates.Selected;
598                                         }
599                                         else {
600                                                 return AccessibleStates.Focused;
601                                         }
602                                 }
603                         }
604
605                         public override string Value {
606                                 get {
607                                         if (dataGridViewRow.Cells.Count == 0) {
608                                                 return "(Create New)";
609                                         }
610                                         string result = "";
611                                         foreach (DataGridViewCell cell in dataGridViewRow.Cells) {
612                                                 result += cell.AccessibilityObject.Value;
613                                         }
614                                         return result;
615                                 }
616                         }
617
618                         public override AccessibleObject GetChild (int index) {
619                                 throw new NotImplementedException();
620                         }
621
622                         public override int GetChildCount () {
623                                 throw new NotImplementedException();
624                         }
625
626                         public override AccessibleObject GetFocused () {
627                                 return null;
628                         }
629
630                         public override AccessibleObject GetSelected () {
631                                 return null;
632                         }
633
634                         public override AccessibleObject Navigate (AccessibleNavigation navigationDirection) {
635                                 switch (navigationDirection) {
636                                         case AccessibleNavigation.Right:
637                                                 break;
638                                         case AccessibleNavigation.Left:
639                                                 break;
640                                         case AccessibleNavigation.Next:
641                                                 break;
642                                         case AccessibleNavigation.Previous:
643                                                 break;
644                                         case AccessibleNavigation.Up:
645                                                 break;
646                                         case AccessibleNavigation.Down:
647                                                 break;
648                                         default:
649                                                 return null;
650                                 }
651                                 return null;
652                         }
653
654                         public override void Select (AccessibleSelection flags) {
655                                 switch (flags) {
656                                         case AccessibleSelection.TakeFocus:
657                                                 dataGridViewRow.DataGridView.Focus();
658                                                 break;
659                                         case AccessibleSelection.TakeSelection:
660                                                 //dataGridViewRow.Focus();
661                                                 break;
662                                         case AccessibleSelection.AddSelection:
663                                                 dataGridViewRow.DataGridView.SelectedRows.InternalAdd(dataGridViewRow);
664                                                 break;
665                                         case AccessibleSelection.RemoveSelection:
666                                                 dataGridViewRow.DataGridView.SelectedRows.InternalRemove(dataGridViewRow);
667                                                 break;
668                                 }
669                         }
670
671                 }
672
673
674
675         }
676         
677         internal class DataGridRowConverter : TypeConverter
678         {
679         }
680 }
681
682 #endif