* TabControl.cs: Show the tooltip depending on the value
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / DrawListViewItemEventArgs.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) 2004-2005 Novell, Inc.
21 //
22 // Authors:
23 //      Alan McGovern (alan.mcgovern@gmail.com)
24 //
25
26 #if NET_2_0
27
28 using System.Drawing;
29
30 namespace System.Windows.Forms
31 {
32     public class DrawListViewItemEventArgs : EventArgs
33     {
34         #region Private Fields
35
36         private Rectangle bounds;
37         private bool drawDefault;
38         private Graphics graphics;
39         private ListViewItem item;
40         private int itemIndex;
41         private ListViewItemStates state;
42
43         #endregion Private Fields
44
45
46         #region Properties
47
48         public bool DrawDefault {
49             get { return drawDefault; }
50             set { drawDefault = value; }
51         }
52
53         public Rectangle Bounds {
54             get { return bounds; }
55         }
56
57         public Graphics Graphics {
58             get { return graphics; }
59         }
60
61         public ListViewItem Item {
62             get { return item; }
63         }
64
65         public int ItemIndex {
66             get { return itemIndex; }
67         }
68
69         public ListViewItemStates State {
70             get { return state; }
71         }
72
73         #endregion Properties
74
75
76         #region Constructors
77
78         public DrawListViewItemEventArgs (Graphics graphics, ListViewItem item,
79                                         Rectangle bounds, int itemIndex, ListViewItemStates state)
80         {
81             this.graphics = graphics;
82             this.item = item;
83             this.bounds = bounds;
84             this.itemIndex = itemIndex;
85             this.state = state;
86         }
87
88         #endregion Constructors
89
90
91         #region Public Methods
92
93         public void DrawBackground ()
94         {
95                 graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (item.BackColor), bounds);
96         }
97
98         public void DrawFocusRectangle ()
99         {
100                 if ((state & ListViewItemStates.Focused) != 0)
101                         ThemeEngine.Current.CPDrawFocusRectangle (graphics, bounds, item.ListView.ForeColor, item.ListView.BackColor);
102         }
103
104         public void DrawText ()
105         {
106                 DrawText (TextFormatFlags.Default);
107         }
108
109         public void DrawText (TextFormatFlags flags)
110         {
111                 TextRenderer.DrawText (graphics, item.Text, item.Font, bounds, item.ForeColor, flags);
112         }
113
114         #endregion Public Methods
115     }
116 }
117
118 #endif