* TabControl.cs: Show the tooltip depending on the value
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / DrawListViewColumnHeaderEventArgs.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 using System.Drawing.Drawing2D;
30
31 namespace System.Windows.Forms
32 {
33     public class DrawListViewColumnHeaderEventArgs : EventArgs
34     {
35         #region Private Fields
36
37         private Color backColor;
38         private Rectangle bounds;
39         private int columnIndex;
40         private bool drawDefault;
41         private Font font;
42         private Color foreColor;
43         private Graphics graphics;
44         private ColumnHeader header;
45         private ListViewItemStates state;
46
47         #endregion Private Fields
48
49
50         #region Properties
51
52         public Color BackColor {
53             get { return backColor; }
54         }
55
56         public Rectangle Bounds {
57             get { return bounds; }
58         }
59
60         public int ColumnIndex {
61             get { return columnIndex; }
62         }
63
64         public bool DrawDefault {
65             get { return drawDefault; }
66             set { drawDefault = value; }
67         }
68
69         public Font Font {
70             get { return font; }
71         }
72
73         public Color ForeColor {
74             get { return foreColor; }
75         }
76
77         public Graphics Graphics {
78             get { return graphics; }
79         }
80
81         public ColumnHeader Header {
82             get { return header; }
83         }
84
85         public ListViewItemStates State {
86             get { return state; }
87         }
88
89         #endregion Properties
90
91
92         #region Constructors
93
94         public DrawListViewColumnHeaderEventArgs(Graphics graphics, Rectangle bounds, int columnIndex,
95                                         ColumnHeader header, ListViewItemStates state, Color foreColor,
96                                         Color backColor, Font font)
97         {
98             this.backColor = backColor;
99             this.bounds = bounds;
100             this.columnIndex = columnIndex;
101             this.font = font;
102             this.foreColor = foreColor;
103             this.graphics = graphics;
104             this.header = header;
105             this.state = state;
106         }
107
108         #endregion Constructors
109
110
111         #region Methods
112
113         public void DrawBackground ()
114         {
115                 // Always draw a non-pushed button
116                 ThemeEngine.Current.CPDrawButton (graphics, bounds, ButtonState.Normal);
117         }
118
119         public void DrawText ()
120         {
121                 DrawText (TextFormatFlags.EndEllipsis | TextFormatFlags.SingleLine);
122         }
123
124         public void DrawText (TextFormatFlags flags)
125         {
126                 // Text adjustments
127                 Rectangle text_bounds = new Rectangle (bounds.X + 8, bounds.Y, bounds.Width - 13, bounds.Height);
128                 TextRenderer.DrawText (graphics, header.Text, font, text_bounds, foreColor, flags);
129         }
130
131         #endregion Methods
132     }
133 }
134
135 #endif