* TabControl.cs: Show the tooltip depending on the value
[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 : EventArgs {
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                 {
99                         if (rowIndex < 0 || rowIndex >= dataGridView.Rows.Count)
100                                 throw new InvalidOperationException ("Invalid RowIndex.");
101
102                         DataGridViewRow row = dataGridView.GetRowInternal (rowIndex);
103
104                         row.PaintCells (graphics, clipBounds, bounds, rowIndex, rowState, isFirstDisplayedRow, isLastVisibleRow, DataGridViewPaintParts.Focus);
105                 }
106
107                 public void PaintCells (Rectangle clipBounds, DataGridViewPaintParts paintParts)
108                 {
109                         if (rowIndex < 0 || rowIndex >= dataGridView.Rows.Count)
110                                 throw new InvalidOperationException ("Invalid RowIndex.");
111
112                         DataGridViewRow row = dataGridView.GetRowInternal (rowIndex);
113
114                         row.PaintCells (graphics, clipBounds, rowBounds, rowIndex, rowState, isFirstDisplayedRow, isLastVisibleRow, paintParts);
115                 }
116
117                 public void PaintCellsBackground (Rectangle clipBounds, bool cellsPaintSelectionBackground)
118                 {
119                         if (cellsPaintSelectionBackground)
120                                 PaintCells (clipBounds, DataGridViewPaintParts.All);
121                         else
122                                 PaintCells (clipBounds, DataGridViewPaintParts.All & ~DataGridViewPaintParts.SelectionBackground);
123                 }
124
125                 public void PaintCellsContent (Rectangle clipBounds)
126                 {
127                         PaintCells (clipBounds, DataGridViewPaintParts.ContentBackground | DataGridViewPaintParts.ContentForeground);
128                 }
129
130                 public void PaintHeader (bool paintSelectionBackground)
131                 {
132                         if (paintSelectionBackground)
133                                 PaintHeader (DataGridViewPaintParts.All);
134                         else
135                                 PaintHeader (DataGridViewPaintParts.All & ~DataGridViewPaintParts.SelectionBackground);
136                 }
137
138                 public void PaintHeader (DataGridViewPaintParts paintParts)
139                 {
140                         if (rowIndex < 0 || rowIndex >= dataGridView.Rows.Count)
141                                 throw new InvalidOperationException ("Invalid RowIndex.");
142
143                         DataGridViewRow row = dataGridView.GetRowInternal (rowIndex);
144
145                         row.PaintHeader (graphics, clipBounds, rowBounds, rowIndex, rowState, isFirstDisplayedRow, isLastVisibleRow, paintParts);
146                 }
147         }
148 }
149
150 #endif