2007-03-29 Jonathan Pobst <monkey@jpobst.com>
[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) != 0;
115                 }
116                 
117                 internal bool IsSet (WindowExStyles ExStyle) {
118                         return (this.ex_style & (int)ExStyle) != 0;
119                 }
120                 
121                 internal bool HasWindowManager {
122                         get {
123                                 return control != null && control is Form && ((Form) control).window_manager != null;
124                         }
125                 }
126                 internal WindowExStyles WindowExStyle {
127                         get {
128                                 return (WindowExStyles) ex_style;
129                         }
130                         set
131                         {
132                                 ex_style = (int)value;
133                         }
134                 }
135                 
136                 internal WindowStyles WindowStyle {
137                         get {
138                                 return (WindowStyles) style;
139                         }
140                         set {
141                                 style = (int) value;
142                         }
143                 }
144                 #endregion
145
146                 #region Public Instance Methods
147                 public override string ToString() {
148                         return "CreateParams {'" + class_name + 
149                                 "', '" + caption + 
150                                 "', " + String.Format("0x{0:X}", class_style) +
151                                 ", " + String.Format("0x{0:X}", ex_style) +
152                                 ", {" + String.Format("{0}", x) +
153                                 ", " + String.Format("{0}", y) +
154                                 ", " + String.Format("{0}", width) +
155                                 ", " + String.Format("{0}", height) +
156                                 "}}";
157                 }
158                 #endregion      // Public Instance Methods
159
160         }
161 }