**** Merged from MCS ****
[mono-project.git] / mcs / class / System.Windows.Forms / System.Windows.Forms / Panel.cs
bloba3a036c3119ed7f913143f39264affe2c7754706
1 //
2 // System.Windows.Forms.Panel.cs
3 //
4 // Author:
5 // stubbed out by Paul Osman (paul.osman@sympatico.ca)
6 // Dennis Hayes (dennish@raytek.com)
7 //
8 // (C) 2002 Ximian, Inc
9 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 using System.Drawing;
32 using System.Runtime.Remoting;
33 using System.ComponentModel;
35 namespace System.Windows.Forms {
37 // <summary>
38 // Represents a Windows Panel control
39 // </summary>
41 public class Panel : ScrollableControl {
43 BorderStyle borderStyle = BorderStyle.None;
45 // --- Constructor
47 [MonoTODO]
48 public Panel() {
49 SetStyle ( ControlStyles.Selectable, false );
50 SetStyle ( ControlStyles.UserPaint, true );
54 // --- Public Properties
56 public BorderStyle BorderStyle {
57 get { return borderStyle; }
58 set {
59 if ( !Enum.IsDefined ( typeof(BorderStyle), value ) )
60 throw new InvalidEnumArgumentException( "BorderStyle",
61 (int)value,
62 typeof(BorderStyle));
64 if ( borderStyle != value ) {
65 int oldStyle = Win32.getBorderStyle ( borderStyle );
66 int oldExStyle = Win32.getBorderExStyle ( borderStyle );
67 borderStyle = value;
69 if ( IsHandleCreated ) {
70 Win32.UpdateWindowStyle ( Handle, oldStyle, Win32.getBorderStyle ( borderStyle ) );
71 Win32.UpdateWindowExStyle ( Handle, oldExStyle, Win32.getBorderExStyle ( borderStyle ) );
77 [MonoTODO]
78 public override ISite Site {
79 get {
80 //FIXME:
81 return base.Site;
83 set {
84 //FIXME:
85 base.Site = value;
89 [EditorBrowsable (EditorBrowsableState.Never)]
90 public override string Text {
91 get { return base.Text; }
92 set { base.Text = value;}
96 // --- Protected Properties
98 [MonoTODO]
99 protected override CreateParams CreateParams {
100 get {
101 CreateParams createParams = base.CreateParams;
103 createParams.Style |= (int) (
104 WindowStyles.WS_CHILD |
105 WindowStyles.WS_CLIPCHILDREN |
106 WindowStyles.WS_CLIPSIBLINGS);
108 createParams.Style |= Win32.getBorderStyle ( BorderStyle );
109 createParams.ExStyle |= Win32.getBorderExStyle ( BorderStyle );
111 return createParams;
115 protected override Size DefaultSize {
116 get { return new Size(219,109); }
118 [MonoTODO]
119 protected override void OnResize(EventArgs e) {
120 //FIXME:
121 base.OnResize(e);
124 public override string ToString()
126 return GetType().FullName.ToString() + ", BorderStyle: " + BorderStyle.ToString();