Merge remote-tracking branch 'joncham/sgen-msvc2'
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / AxHost.cs
index 17b5568e906f707525ecd2118465088f02d3f6a5..867f9f96503566bd6aef342d6783f468dcb1308e 100644 (file)
@@ -184,20 +184,23 @@ namespace System.Windows.Forms {
                #endregion      // AxHost.StateConverter Class
                #endregion      // AxHost Subclasses
 
-               private int flags;
-               private Guid clsid;
+               //private int flags;
+               //private Guid clsid;
+               private AboutBoxDelegate aboutDelegate = null;
 
                #region Protected Constructors
 
+               [MonoTODO]
                protected AxHost (string clsid) : this(clsid, 0)
                {
 
                }
 
+               [MonoTODO]
                protected AxHost (string clsid, int flags)
                {
-                       this.clsid = new Guid(clsid);
-                       this.flags = flags;
+                       //this.clsid = new Guid(clsid);
+                       //this.flags = flags;
                }
                #endregion      // Public Instance Properties
 
@@ -325,8 +328,8 @@ namespace System.Windows.Forms {
                [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
                [EditorBrowsable (EditorBrowsableState.Advanced)]
                public bool HasAboutBox {
-                       get { 
-                               throw new NotImplementedException("COM/ActiveX support is not implemented");
+                       get {
+                               return aboutDelegate != null;
                        }
                }
 
@@ -480,9 +483,9 @@ namespace System.Windows.Forms {
 
                #region Public Instance Methods
                [EditorBrowsable (EditorBrowsableState.Advanced)]
+               [MonoTODO]
                public void BeginInit ()
                {
-                       throw new NotImplementedException("COM/ActiveX support is not implemented");
                }
                
                public void DoVerb (int verb)
@@ -491,9 +494,9 @@ namespace System.Windows.Forms {
                }
 
                [EditorBrowsable (EditorBrowsableState.Advanced)]
+               [MonoTODO]
                public void EndInit ()
                {
-                       throw new NotImplementedException("COM/ActiveX support is not implemented");
                }
 
                [EditorBrowsable (EditorBrowsableState.Advanced)]
@@ -526,7 +529,8 @@ namespace System.Windows.Forms {
 
                public void ShowAboutBox ()
                {
-                       throw new NotImplementedException("COM/ActiveX support is not implemented");
+                       if (aboutDelegate != null)
+                               this.aboutDelegate();
                }
                
                public void ShowPropertyPages ()
@@ -597,17 +601,17 @@ namespace System.Windows.Forms {
                
                protected override void OnBackColorChanged (EventArgs e)
                {
-                       throw new NotImplementedException("COM/ActiveX support is not implemented");
+                       base.OnBackColorChanged(e);
                }
                
                protected override void OnFontChanged (EventArgs e)
                {
-                       throw new NotImplementedException("COM/ActiveX support is not implemented");
+                       base.OnFontChanged(e);
                }
                
                protected override void OnForeColorChanged (EventArgs e)
                {
-                       throw new NotImplementedException("COM/ActiveX support is not implemented");
+                       base.OnForeColorChanged(e);
                }
                
                protected override void OnHandleCreated (EventArgs e)
@@ -628,7 +632,7 @@ namespace System.Windows.Forms {
                
                protected override bool ProcessDialogKey (Keys keyData)
                {
-                       throw new NotImplementedException("COM/ActiveX support is not implemented");
+                       return base.ProcessDialogKey(keyData);
                }
 
                protected override bool ProcessMnemonic (char charCode)
@@ -698,12 +702,12 @@ namespace System.Windows.Forms {
 
                protected void SetAboutBoxDelegate (AxHost.AboutBoxDelegate d)
                {
-                       throw new NotImplementedException("COM/ActiveX support is not implemented");
+                       this.aboutDelegate = d;
                }
                
                protected override void SetBoundsCore (int x, int y, int width, int height, BoundsSpecified specified)
                {
-                       throw new NotImplementedException("COM/ActiveX support is not implemented");
+                       base.SetBoundsCore(x, y, width, height, specified);
                }
                
                protected override void SetVisibleCore (bool value)
@@ -721,270 +725,267 @@ namespace System.Windows.Forms {
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event EventHandler BackColorChanged {
-                       add { base.BackColorChanged += value; }
-                       remove { base.BackColorChanged -= value; }
+                       add { throw new NotSupportedException("BackColorChanged"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event EventHandler BackgroundImageChanged {
-                       add { base.BackgroundImageChanged += value; }
-                       remove { base.BackgroundImageChanged -= value; }
+                       add { throw new NotSupportedException("BackgroundImageChanged"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event EventHandler BindingContextChanged {
-                       add { base.BindingContextChanged += value; }
-                       remove { base.BindingContextChanged -= value; }
+                       add { throw new NotSupportedException("BackgroundImageChanged"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event UICuesEventHandler ChangeUICues {
-                       add { base.ChangeUICues += value; }
-                       remove { base.ChangeUICues -= value; }
+                       add { throw new NotSupportedException("ChangeUICues"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event EventHandler Click {
-                       add { base.Click += value; }
-                       remove { base.Click -= value; }
+                       add { throw new NotSupportedException("Click"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event EventHandler ContextMenuChanged {
-                       add { base.ContextMenuChanged += value; }
-                       remove { base.ContextMenuChanged -= value; }
+                       add { throw new NotSupportedException("ContextMenuChanged"); }
+                       remove { }
                }
        
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event EventHandler CursorChanged {
-                       add { base.CursorChanged += value; }
-                       remove { base.CursorChanged -= value; }
+                       add { throw new NotSupportedException("CursorChanged"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event EventHandler DoubleClick {
-                       add { base.DoubleClick += value; }
-                       remove { base.DoubleClick -= value; }
+                       add { throw new NotSupportedException("DoubleClick"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event DragEventHandler DragDrop {
-                       add { base.DragDrop += value; }
-                       remove { base.DragDrop -= value; }
+                       add { throw new NotSupportedException("DragDrop"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event DragEventHandler DragEnter {
-                       add { base.DragEnter += value; }
-                       remove { base.DragEnter -= value; }
+                       add { throw new NotSupportedException("DragEnter"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event EventHandler DragLeave {
-                       add { base.DragLeave += value; }
-                       remove { base.DragLeave -= value; }
+                       add { throw new NotSupportedException("DragLeave"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event DragEventHandler DragOver {
-                       add { base.DragOver += value; }
-                       remove { base.DragOver -= value; }
+                       add { throw new NotSupportedException("DragOver"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event EventHandler EnabledChanged {
-                       add { base.EnabledChanged += value; }
-                       remove { base.EnabledChanged -= value; }
+                       add { throw new NotSupportedException("EnabledChanged"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event EventHandler FontChanged {
-                       add { base.FontChanged += value; }
-                       remove { base.FontChanged -= value; }
+                       add { throw new NotSupportedException("FontChanged"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event EventHandler ForeColorChanged {
-                       add { base.ForeColorChanged += value; }
-                       remove { base.ForeColorChanged -= value; }
+                       add { throw new NotSupportedException("ForeColorChanged"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event GiveFeedbackEventHandler GiveFeedback {
-                       add { base.GiveFeedback += value; }
-                       remove { base.GiveFeedback -= value; }
+                       add { throw new NotSupportedException("GiveFeedback"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event HelpEventHandler HelpRequested {
-                       add { base.HelpRequested += value; }
-                       remove { base.HelpRequested -= value; }
+                       add { throw new NotSupportedException("HelpRequested"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event EventHandler ImeModeChanged {
-                       add { base.ImeModeChanged += value; }
-                       remove { base.ImeModeChanged -= value; }
+                       add { throw new NotSupportedException("ImeModeChanged"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event KeyEventHandler KeyDown {
-                       add { base.KeyDown += value; }
-                       remove { base.KeyDown -= value; }
+                       add { throw new NotSupportedException("KeyDown"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event KeyPressEventHandler KeyPress {
-                       add { base.KeyPress += value; }
-                       remove { base.KeyPress -= value; }
+                       add { throw new NotSupportedException("KeyPress"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event KeyEventHandler KeyUp {
-                       add { base.KeyUp += value; }
-                       remove { base.KeyUp -= value; }
+                       add { throw new NotSupportedException("KeyUp"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event LayoutEventHandler Layout {
-                       add { base.Layout += value; }
-                       remove { base.Layout -= value; }
+                       add { throw new NotSupportedException("Layout"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event MouseEventHandler MouseDown {
-                       add { base.MouseDown += value; }
-                       remove { base.MouseDown -= value; }
+                       add { throw new NotSupportedException("MouseDown"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event EventHandler MouseEnter {
-                       add { base.MouseEnter += value; }
-                       remove { base.MouseEnter -= value; }
+                       add { throw new NotSupportedException("MouseEnter"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event EventHandler MouseHover {
-                       add { base.MouseHover += value; }
-                       remove { base.MouseHover -= value; }
+                       add { throw new NotSupportedException("MouseHover"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event EventHandler MouseLeave {
-                       add { base.MouseLeave += value; }
-                       remove { base.MouseLeave -= value; }
+                       add { throw new NotSupportedException("MouseLeave"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event MouseEventHandler MouseMove {
-                       add { base.MouseMove += value; }
-                       remove { base.MouseMove -= value; }
+                       add { throw new NotSupportedException("MouseMove"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event MouseEventHandler MouseUp {
-                       add { base.MouseUp += value; }
-                       remove { base.MouseUp -= value; }
+                       add { throw new NotSupportedException("MouseUp"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event MouseEventHandler MouseWheel {
-                       add { base.MouseWheel += value; }
-                       remove { base.MouseWheel -= value; }
+                       add { throw new NotSupportedException("MouseWheel"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event PaintEventHandler Paint {
-                       add { base.Paint += value; }
-                       remove { base.Paint -= value; }
+                       add { throw new NotSupportedException("Paint"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event QueryAccessibilityHelpEventHandler QueryAccessibilityHelp {
-                       add { base.QueryAccessibilityHelp += value; }
-                       remove { base.QueryAccessibilityHelp -= value; }
+                       add { throw new NotSupportedException("QueryAccessibilityHelp"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event QueryContinueDragEventHandler QueryContinueDrag {
-                       add { base.QueryContinueDrag += value; }
-                       remove { base.QueryContinueDrag -= value; }
+                       add { throw new NotSupportedException("QueryContinueDrag"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event EventHandler RightToLeftChanged {
-                       add { base.RightToLeftChanged += value; }
-                       remove { base.RightToLeftChanged -= value; }
+                       add { throw new NotSupportedException("RightToLeftChanged"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event EventHandler StyleChanged {
-                       add { base.StyleChanged += value; }
-                       remove { base.StyleChanged -= value; }
+                       add { throw new NotSupportedException("StyleChanged"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event EventHandler BackgroundImageLayoutChanged {
-                       add { base.BackgroundImageLayoutChanged += value; }
-                       remove { base.BackgroundImageLayoutChanged -= value; }
+                       add { throw new NotSupportedException("BackgroundImageChanged"); }
+                       remove { }
                }
 
-               static object MouseClickEvent = new object ();
-               static object MouseDoubleClickEvent = new object ();
-
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event EventHandler MouseClick {
-                       add { Events.AddHandler (MouseClickEvent, value); }
-                       remove { Events.RemoveHandler (MouseClickEvent, value); }
+                       add { throw new NotSupportedException("BackgroundImMouseClickageChanged"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event EventHandler MouseDoubleClick {
-                       add { Events.AddHandler (MouseDoubleClickEvent, value); }
-                       remove { Events.RemoveHandler (MouseDoubleClickEvent, value); }
+                       add { throw new NotSupportedException("MouseDoubleClick"); }
+                       remove { }
                }
 
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                public new event EventHandler TextChanged {
-                       add { base.TextChanged += value; }
-                       remove { base.TextChanged -= value; }
+                       add { throw new NotSupportedException("TextChanged"); }
+                       remove { }
                }
                #endregion      // Events