* TabControl.cs: Show the tooltip depending on the value
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / CreateParams.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-2006 Novell, Inc.
21 //
22 // Authors:
23 //      Peter Bartok    pbartok@novell.com
24 //
25
26
27 // COMPLETE
28
29 using System.Collections;
30 using System.ComponentModel;
31
32 namespace System.Windows.Forms {
33         public class CreateParams {
34                 #region Local Variables
35                 private string  caption;
36                 private string  class_name;
37                 private int     class_style;
38                 private int     ex_style;
39                 private int     x;
40                 private int     y;
41                 private int     height;
42                 private int     width;
43                 private int     style;
44                 private object  param;
45                 private IntPtr  parent;
46                 internal Menu   menu;
47                 internal Control        control;
48                 #endregion      // Local variables
49
50                 #region Public Constructors
51                 public CreateParams() {
52                 }
53                 #endregion      // Public Constructors
54
55                 #region Public Instance Properties
56                 public string Caption {
57                         get { return caption; }
58                         set { caption = value; }
59                 }
60
61                 public string ClassName {
62                         get { return class_name; }
63                         set { class_name = value; }
64                 }
65
66                 public int ClassStyle {
67                         get { return class_style; }
68                         set { class_style = value; }
69                 }
70
71                 public int ExStyle {
72                         get { return ex_style; }
73                         set { ex_style = value; }
74                 }
75
76                 public int X {
77                         get { return x; }
78                         set { x = value; }
79                 }
80
81                 public int Y {
82                         get { return y; }
83                         set { y = value; }
84                 }
85
86                 public int Width {
87                         get { return width; }
88                         set { width = value; }
89                 }
90
91                 public int Height {
92                         get { return height; }
93                         set { height = value; }
94                 }
95
96                 public int Style {
97                         get { return style; }
98                         set { style = value; }
99                 }
100
101                 public object Param {
102                         get { return param; }
103                         set { param = value; }
104                 }
105
106                 public IntPtr Parent {
107                         get { return parent; }
108                         set { parent = value; }
109                 }
110                 #endregion      // Public Instance Properties
111
112                 #region Internal Instance Methods
113                 internal bool IsSet (WindowStyles Style) {
114                         return (this.style & (int) Style) == (int) Style;
115                 }
116                 
117                 internal bool IsSet (WindowExStyles ExStyle) {
118                         return (this.ex_style & (int) ExStyle) == (int) ExStyle;
119                 }
120                 
121                 internal static bool IsSet (WindowExStyles ExStyle, WindowExStyles Option) {
122                         return (Option & ExStyle) == Option;
123                 }
124                 
125                 internal static bool IsSet (WindowStyles Style, WindowStyles Option) {
126                         return (Option & Style) == Option;
127                 }
128                 
129                 internal bool HasWindowManager {
130                         get {
131                                 if (control == null)
132                                         return false;
133                                 
134                                 Form form = control as Form;
135                                 
136                                 if (form == null)
137                                         return false;
138                                 
139                                 return form.window_manager != null;
140                         }
141                 }
142                 internal WindowExStyles WindowExStyle {
143                         get {
144                                 return (WindowExStyles) ex_style;
145                         }
146                         set
147                         {
148                                 ex_style = (int)value;
149                         }
150                 }
151                 
152                 internal WindowStyles WindowStyle {
153                         get {
154                                 return (WindowStyles) style;
155                         }
156                         set {
157                                 style = (int) value;
158                         }
159                 }
160                 #endregion
161
162                 #region Public Instance Methods
163                 public override string ToString() {
164                         return string.Format ("CreateParams {{'{0}', '{1}', 0x{2:X}, 0x{3:X}, {{{4}, {5}, {6}, {7}}}}}", 
165                                         class_name, caption, class_style, ex_style, x, y, width, height);
166                 }
167                 #endregion      // Public Instance Methods
168
169         }
170 }