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
33 [ClassInterfaceAttribute (ClassInterfaceType.AutoDispatch)]
36 public abstract class ComponentEditorPage : Panel
38 private bool commitOnDeactivate = false;
39 private IComponent component;
40 private bool firstActivate = true;
42 private int loading = 0;
43 private bool loadRequired = false;
44 private IComponentEditorPageSite pageSite;
46 public ComponentEditorPage ()
52 [EditorBrowsable (EditorBrowsableState.Never)]
53 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
54 new public virtual bool AutoSize {
55 get { return base.AutoSize; }
56 set { base.AutoSize = value; }
60 public bool CommitOnDeactivate
62 get { return commitOnDeactivate; }
63 set { commitOnDeactivate = value; }
66 protected IComponent Component {
67 get { return component; }
68 set { component = value; }
71 [MonoTODO ("Find out what this does.")]
72 protected override CreateParams CreateParams {
74 throw new NotImplementedException ();
78 protected bool FirstActivate {
79 get { return firstActivate; }
80 set { firstActivate = value; }
88 protected int Loading {
89 get { return loading; }
90 set { loading = value; }
93 protected bool LoadRequired {
94 get { return loadRequired; }
95 set { loadRequired = value; }
98 protected IComponentEditorPageSite PageSite {
99 get { return pageSite; }
100 set { pageSite = value; }
103 public virtual string Title {
104 get { return base.Text; }
107 public virtual void Activate ()
110 firstActivate = false;
118 public virtual void ApplyChanges ()
123 public virtual void Deactivate ()
128 protected void EnterLoadingMode ()
133 protected void ExitLoadingMode ()
138 public virtual Control GetControl ()
143 protected IComponent GetSelectedComponent ()
148 protected bool IsFirstActivate ()
150 return firstActivate;
153 protected bool IsLoading ()
155 return (loading != 0);
158 public virtual bool IsPageMessage (ref Message msg)
160 return PreProcessMessage (ref msg);
163 protected abstract void LoadComponent ();
165 [MonoTODO ("Find out what this does.")]
166 public virtual void OnApplyComplete ()
170 protected virtual void ReloadComponent ()
175 protected abstract void SaveComponent ();
177 public virtual void SetComponent (IComponent component)
179 this.component = component;
183 [MonoTODO ("Find out what this does.")]
184 protected virtual void SetDirty ()
188 public virtual void SetSite (IComponentEditorPageSite site)
191 pageSite.GetControl ().Controls.Add (this);
195 public virtual void ShowHelp ()
199 public virtual bool SupportsHelp ()
204 #region Public Events
207 [EditorBrowsable (EditorBrowsableState.Never)]
208 public new event EventHandler AutoSizeChanged {
209 add { base.AutoSizeChanged += value; }
210 remove { base.AutoSizeChanged -= value; }