New test.
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / DataGridViewCellPaintingEventArgs.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
32 namespace System.Windows.Forms {
33
34         public class DataGridViewCellPaintingEventArgs : HandledEventArgs {
35
36                 private DataGridView dataGridView;
37                 private Graphics graphics;
38                 private Rectangle clipBounds; 
39                 private Rectangle cellBounds;
40                 private int rowIndex;
41                 private int columnIndex;
42                 private DataGridViewElementStates cellState;
43                 private object cellValue;
44                 private object formattedValue;
45                 private string errorText;
46                 private DataGridViewCellStyle cellStyle;
47                 private DataGridViewAdvancedBorderStyle advancedBorderStyle;
48                 private DataGridViewPaintParts paintParts;
49
50                 public DataGridViewCellPaintingEventArgs (DataGridView dataGridView, Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, int columnIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) {
51                         this.dataGridView = dataGridView;
52                         this.graphics = graphics;
53                         this.clipBounds = clipBounds;
54                         this.cellBounds = cellBounds;
55                         this.rowIndex = rowIndex;
56                         this.columnIndex = columnIndex;
57                         this.cellState = cellState;
58                         this.cellValue = value;
59                         this.formattedValue = formattedValue;
60                         this.errorText = errorText;
61                         this.cellStyle = cellStyle;
62                         this.advancedBorderStyle = advancedBorderStyle;
63                         this.paintParts = paintParts;
64                 }
65
66                 public DataGridViewAdvancedBorderStyle AdvancedBorderStyle {
67                         get { return advancedBorderStyle; }
68                 }
69
70                 public Rectangle CellBounds {
71                         get { return cellBounds; }
72                 }
73
74                 public DataGridViewCellStyle CellStyle {
75                         get { return cellStyle; }
76                 }
77
78                 public Rectangle ClipBounds {
79                         get { return clipBounds; }
80                 }
81
82                 public int ColumnIndex {
83                         get { return columnIndex; }
84                 }
85
86                 public string ErrorText {
87                         get { return errorText; }
88                 }
89
90                 public object FormattedValue {
91                         get { return formattedValue; }
92                 }
93
94                 public Graphics Graphics {
95                         get { return graphics; }
96                 }
97
98                 public DataGridViewPaintParts PaintParts {
99                         get { return paintParts; }
100                 }
101
102                 public int RowIndex {
103                         get { return rowIndex; }
104                 }
105
106                 public DataGridViewElementStates State {
107                         get { return cellState; }
108                 }
109
110                 public object Value {
111                         get { return cellValue; }
112                 }
113
114                 public void Paint (Rectangle clipBounds, DataGridViewPaintParts paintParts) {
115                         if (rowIndex < -1 || rowIndex >= dataGridView.Rows.Count) {
116                                 throw new InvalidOperationException("Invalid \"RowIndex.\"");
117                         }
118                         if (columnIndex < -1 || columnIndex >= dataGridView.Columns.Count) {
119                                 throw new InvalidOperationException("Invalid \"ColumnIndex.\"");
120                         }
121                         throw new NotImplementedException();
122                 }
123
124                 public void PaintBackground (Rectangle clipBounds, bool cellsPaintSelectionBackground) {
125                         if (rowIndex < -1 || rowIndex >= dataGridView.Rows.Count) {
126                                 throw new InvalidOperationException("Invalid \"RowIndex.\"");
127                         }
128                         if (columnIndex < -1 || columnIndex >= dataGridView.Columns.Count) {
129                                 throw new InvalidOperationException("Invalid \"ColumnIndex.\"");
130                         }
131                         DataGridViewCell cell = dataGridView.Rows[rowIndex].Cells[columnIndex];
132                         Color color;
133                         if (cellsPaintSelectionBackground) {
134                                 color = cell.InheritedStyle.SelectionBackColor;
135                         }
136                         else {
137                                 color = cell.InheritedStyle.BackColor;
138                         }
139                         ///////// NOT CHECKED //////////////
140                         graphics.FillRectangle(new SolidBrush(color), clipBounds);
141                 }
142
143                 public void PaintContent (Rectangle clipBounds) {
144                         if (rowIndex < -1 || rowIndex >= dataGridView.Rows.Count) {
145                                 throw new InvalidOperationException("Invalid \"RowIndex.\"");
146                         }
147                         if (columnIndex < -1 || columnIndex >= dataGridView.Columns.Count) {
148                                 throw new InvalidOperationException("Invalid \"ColumnIndex.\"");
149                         }
150                         throw new NotImplementedException();
151                 }
152
153         }
154
155 }
156
157 #endif