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:
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
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.
20 // Copyright (c) 2004 Novell, Inc.
23 // Andreas Nahr (ClassDevelopment@A-SoftTech.com)
26 using System.ComponentModel;
28 using System.Runtime.InteropServices;
30 namespace System.Windows.Forms.Design
32 [ClassInterfaceAttribute (ClassInterfaceType.AutoDispatch)]
34 public abstract class ComponentEditorPage : Panel
36 private bool commitOnDeactivate = false;
37 private IComponent component;
38 private bool firstActivate = true;
40 private int loading = 0;
41 private bool loadRequired = false;
42 private IComponentEditorPageSite pageSite;
44 public ComponentEditorPage ()
49 [EditorBrowsable (EditorBrowsableState.Never)]
50 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
51 new public virtual bool AutoSize {
52 get { return base.AutoSize; }
53 set { base.AutoSize = value; }
56 public bool CommitOnDeactivate
58 get { return commitOnDeactivate; }
59 set { commitOnDeactivate = value; }
62 protected IComponent Component {
63 get { return component; }
64 set { component = value; }
67 [MonoTODO ("Find out what this does.")]
68 protected override CreateParams CreateParams {
70 throw new NotImplementedException ();
74 protected bool FirstActivate {
75 get { return firstActivate; }
76 set { firstActivate = value; }
84 protected int Loading {
85 get { return loading; }
86 set { loading = value; }
89 protected bool LoadRequired {
90 get { return loadRequired; }
91 set { loadRequired = value; }
94 protected IComponentEditorPageSite PageSite {
95 get { return pageSite; }
96 set { pageSite = value; }
99 public virtual string Title {
100 get { return base.Text; }
103 public virtual void Activate ()
106 firstActivate = false;
114 public virtual void ApplyChanges ()
119 public virtual void Deactivate ()
124 protected void EnterLoadingMode ()
129 protected void ExitLoadingMode ()
134 public virtual Control GetControl ()
139 protected IComponent GetSelectedComponent ()
144 protected bool IsFirstActivate ()
146 return firstActivate;
149 protected bool IsLoading ()
151 return (loading != 0);
154 public virtual bool IsPageMessage (ref Message msg)
156 return PreProcessMessage (ref msg);
159 protected abstract void LoadComponent ();
161 [MonoTODO ("Find out what this does.")]
162 public virtual void OnApplyComplete ()
166 protected virtual void ReloadComponent ()
171 protected abstract void SaveComponent ();
173 public virtual void SetComponent (IComponent component)
175 this.component = component;
179 [MonoTODO ("Find out what this does.")]
180 protected virtual void SetDirty ()
184 public virtual void SetSite (IComponentEditorPageSite site)
187 pageSite.GetControl ().Controls.Add (this);
191 public virtual void ShowHelp ()
195 public virtual bool SupportsHelp ()
200 #region Public Events
202 [EditorBrowsable (EditorBrowsableState.Never)]
203 public new event EventHandler AutoSizeChanged {
204 add { base.AutoSizeChanged += value; }
205 remove { base.AutoSizeChanged -= value; }