New test.
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / DataGridViewRowPrePaintEventArgs.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 DataGridViewRowPrePaintEventArgs : HandledEventArgs {
35
36                 private DataGridView dataGridView;
37                 private Graphics graphics;
38                 private Rectangle clipBounds;
39                 private Rectangle rowBounds;
40                 private int rowIndex;
41                 private DataGridViewElementStates rowState;
42                 private string errorText;
43                 private DataGridViewCellStyle inheritedRowStyle;
44                 private bool isFirstDisplayedRow;
45                 private bool isLastVisibleRow;
46                 private DataGridViewPaintParts paintParts;
47
48                 public DataGridViewRowPrePaintEventArgs (DataGridView dataGridView, Graphics graphics, Rectangle clipBounds, Rectangle rowBounds, int rowIndex, DataGridViewElementStates rowState, string errorText, DataGridViewCellStyle inheritedRowStyle, bool isFirstDisplayedRow, bool isLastVisibleRow) {
49                         this.dataGridView = dataGridView;
50                         this.graphics = graphics;
51                         this.clipBounds = clipBounds;
52                         this.rowBounds = rowBounds;
53                         this.rowIndex = rowIndex;
54                         this.rowState = rowState;
55                         this.errorText = errorText;
56                         this.inheritedRowStyle = inheritedRowStyle;
57                         this.isFirstDisplayedRow = isFirstDisplayedRow;
58                         this.isLastVisibleRow = isLastVisibleRow;
59                 }
60
61                 public Rectangle ClipBounds {
62                         get { return clipBounds; }
63                         set { clipBounds = value; }
64                 }
65
66                 public string ErrorText {
67                         get { return errorText; }
68                 }
69
70                 public Graphics Graphics {
71                         get { return graphics; }
72                 }
73
74                 public DataGridViewCellStyle InheritedRowStyle {
75                         get { return inheritedRowStyle; }
76                 }
77
78                 public bool IsFirstDisplayedRow {
79                         get { return isFirstDisplayedRow; }
80                 }
81
82                 public bool IsLastVisibleRow {
83                         get { return isLastVisibleRow; }
84                 }
85
86                 public DataGridViewPaintParts PaintParts {
87                         get { return paintParts; }
88                         set { paintParts = value; }
89                 }
90
91                 public Rectangle RowBounds {
92                         get { return rowBounds; }
93                 }
94
95                 public int RowIndex {
96                         get { return rowIndex; }
97                 }
98
99                 public DataGridViewElementStates State {
100                         get { return rowState; }
101                 }
102
103                 public void DrawFocus (Rectangle bounds, bool cellsPaintSelectionBackground) {
104                         if (rowIndex < 0 || rowIndex >= dataGridView.Rows.Count) {
105                                 throw new InvalidOperationException("Invalid RowIndex.");
106                         }
107                         Color color;
108                         if (cellsPaintSelectionBackground) {
109                                 color = dataGridView.Rows[rowIndex].InheritedStyle.SelectionBackColor;
110                         }
111                         else {
112                                 color = dataGridView.Rows[rowIndex].InheritedStyle.BackColor;
113                         }
114                         ///////// NOT CHECKED //////////////
115                         graphics.FillRectangle(new SolidBrush(color), bounds);
116                 }
117
118                 public void PaintCells (Rectangle clipBounds, DataGridViewPaintParts paintParts) {
119                         if (rowIndex < 0 || rowIndex >= dataGridView.Rows.Count) {
120                                 throw new InvalidOperationException("Invalid RowIndex.");
121                         }
122                         throw new NotImplementedException();
123                 }
124
125                 public void PaintCellsBackground (Rectangle clipBounds, bool cellsPaintSelectionBackground) {
126                         if (rowIndex < 0 || rowIndex >= dataGridView.Rows.Count) {
127                                 throw new InvalidOperationException("Invalid RowIndex.");
128                         }
129                         Color color;
130                         if (cellsPaintSelectionBackground) {
131                                 color = dataGridView.Rows[rowIndex].InheritedStyle.SelectionBackColor;
132                         }
133                         else {
134                                 color = dataGridView.Rows[rowIndex].InheritedStyle.BackColor;
135                         }
136                         ///////// NOT CHECKED //////////////
137                         graphics.FillRectangle(new SolidBrush(color), clipBounds);
138                 }
139
140                 public void PaintCellsContent (Rectangle clipBounds) {
141                         if (rowIndex < 0 || rowIndex >= dataGridView.Rows.Count) {
142                                 throw new InvalidOperationException("Invalid RowIndex.");
143                         }
144                         throw new NotImplementedException();
145                 }
146
147                 public void PaintHeader (bool paintSelectionBackground) {
148                         if (rowIndex < 0 || rowIndex >= dataGridView.Rows.Count) {
149                                 throw new InvalidOperationException("Invalid RowIndex.");
150                         }
151                         Color color;
152                         if (paintSelectionBackground) {
153                                 color = dataGridView.Rows[rowIndex].InheritedStyle.SelectionBackColor;
154                         }
155                         else {
156                                 color = dataGridView.RowHeadersDefaultCellStyle.BackColor;
157                         }
158                         ///////// NOT CHECKED //////////////
159                         graphics.FillRectangle(new SolidBrush(color), clipBounds);
160                 }
161
162                 public void PaintHeader (DataGridViewPaintParts paintParts) {
163                         if (rowIndex < 0 || rowIndex >= dataGridView.Rows.Count) {
164                                 throw new InvalidOperationException("Invalid RowIndex.");
165                         }
166                         throw new NotImplementedException();
167                 }
168
169         }
170
171 }
172
173 #endif