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