2 // System.Windows.Forms.AxHost
5 // stubbed out by Jaak Simm (jaaksimm@firm.ee)
6 // Dennis hayes (dennish@raytek.com)
8 // (C) Ximian, Inc., 2002/3
13 // Permission is hereby granted, free of charge, to any person obtaining
14 // a copy of this software and associated documentation files (the
15 // "Software"), to deal in the Software without restriction, including
16 // without limitation the rights to use, copy, modify, merge, publish,
17 // distribute, sublicense, and/or sell copies of the Software, and to
18 // permit persons to whom the Software is furnished to do so, subject to
19 // the following conditions:
21 // The above copyright notice and this permission notice shall be
22 // included in all copies or substantial portions of the Software.
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 using System
.ComponentModel
;
35 using System
.Runtime
.Serialization
;
37 namespace System
.Windows
.Forms
{
40 /// Wraps ActiveX controls and exposes them as fully featured Windows Forms controls.
44 public abstract class AxHost
: Control
, ISupportInitialize
, ICustomTypeDescriptor
{
46 /// --- Constructors ---
47 /// Class AxHost does not have a constructor for non-internal purposes.
48 /// Thus, no constructor is stubbed out.
49 /// Here are the two AxHost constructors for supporting .NET Framework infrastructure:
50 protected AxHost(string clsid
){
53 protected AxHost(string clsid
,int flags
){
56 /// --- public Properties ---
57 /// Properties supporting .NET framework, only. Not stubbed out:
58 public bool EditMode
{
60 throw new NotImplementedException ();
65 public override Color BackColor
{
68 return base.BackColor
;
72 base.BackColor
= value;
77 public override Image BackgroundImage
{
80 return base.BackgroundImage
;
84 base.BackgroundImage
= value;
89 public ContainerControl ContainingControl
{
91 throw new NotImplementedException ();
99 public override ContextMenu ContextMenu
{
102 return base.ContextMenu
;
106 base.ContextMenu
= value;
111 protected override CreateParams CreateParams
{
114 return base.CreateParams
;
119 public override Cursor Cursor
{
131 protected override Size DefaultSize
{
134 return base.DefaultSize
;
139 public new virtual bool Enabled
{
142 throw new NotImplementedException ();
150 public override Font Font
{
162 public override Color ForeColor
{
165 return base.ForeColor
;
169 base.ForeColor
= value;
174 public bool HasAboutBox
{
176 throw new NotImplementedException ();
181 public AxHost
.State OcxState
{
184 throw new NotImplementedException ();
193 public new virtual bool RightToLeft
{
195 throw new NotImplementedException ();
203 public override ISite Site
{
210 public override string Text
{
222 /// internal .NET framework supporting methods, not stubbed out:
226 protected virtual void CreateSink(){
230 protected virtual void DetachSink(){
234 public void DoVerb(int verb
){
238 [CLSCompliant(false)]
239 protected static Color
GetColorFromOleColor(uint color
){
240 throw new NotImplementedException ();
244 protected static Font
GetFontFromIFont(object font
){
245 throw new NotImplementedException ();
249 protected static Font
GetFontFromIFontDisp(object font
){
250 throw new NotImplementedException ();
254 protected static object GetIFontDispFromFont(Font font
){
255 throw new NotImplementedException ();
259 protected static object GetIFontFromFont(Font font
){
260 throw new NotImplementedException ();
264 protected static object GetIPictureDispFromPicture(Image image
){
265 throw new NotImplementedException ();
269 protected static object GetIPictureFromCursor(Cursor cursor
){
270 throw new NotImplementedException ();
274 protected static object GetIPictureFromPicture(Image image
){
275 throw new NotImplementedException ();
279 protected static double GetOADateFromTime(DateTime time
){
280 throw new NotImplementedException ();
284 [CLSCompliant(false)]
285 protected static uint GetOleColorFromColor(Color color
){
286 throw new NotImplementedException ();
290 protected static Image
GetPictureFromIPicture(object picture
){
291 throw new NotImplementedException ();
295 protected static Image
GetPictureFromIPictureDisp(object picture
){
296 throw new NotImplementedException ();
300 protected static DateTime
GetTimeFromOADate(double date
){
301 throw new NotImplementedException ();
305 public void InvokeEditMode(){
309 public void MakeDirty(){
312 protected bool PropsValid(){
313 throw new NotImplementedException ();
316 protected void RaiseOnMouseDown(short button
,short shift
,int x
,int y
){
319 protected void RaiseOnMouseDown(short button
,short shift
,float x
,float y
){
322 protected void RaiseOnMouseDown(object o1
,object o2
,object o3
,object o4
){
325 protected void RaiseOnMouseMove(short button
,short shift
,int x
,int y
){
328 protected void RaiseOnMouseMove(short button
,short shift
,float x
,float y
){
331 protected void RaiseOnMouseMove(object o1
,object o2
,object o3
,object o4
){
334 protected void RaiseOnMouseUp(short button
,short shift
,int x
,int y
){
337 protected void RaiseOnMouseUp(short button
,short shift
,float x
,float y
){
340 protected void RaiseOnMouseUp(object o1
,object o2
,object o3
,object o4
){
344 protected virtual void AttachInterfaces() {
349 public void BeginInit() {
354 protected override void CreateHandle() {
360 protected override void DestroyHandle() {
362 base.DestroyHandle();
366 protected override void Dispose(bool disposing
) {
368 base.Dispose(disposing
);
372 public virtual void EndInit() {
377 public object GetOcx() {
378 throw new NotImplementedException ();
382 public bool HasPropertyPages() {
383 throw new NotImplementedException ();
387 protected override bool IsInputChar(char charCode
) {
389 return base.IsInputChar(charCode
);
392 /// --- methods used with events ---
394 protected override void OnBackColorChanged(EventArgs e
) {
396 base.OnBackColorChanged(e
);
400 protected override void OnFontChanged(EventArgs e
) {
402 base.OnFontChanged(e
);
406 protected override void OnForeColorChanged(EventArgs e
) {
408 base.OnForeColorChanged(e
);
412 protected override void OnHandleCreated(EventArgs e
) {
414 base.OnHandleCreated(e
);
418 protected virtual void OnInPlaceActive() {
424 protected override void OnLostFocus(EventArgs e
) {
428 /// --- END OF: methods used with events ---
431 public override bool PreProcessMessage(ref Message msg
) {
433 return base.PreProcessMessage(ref msg
);
437 protected override bool ProcessMnemonic(char charCode
) {
439 return base.ProcessMnemonic(charCode
);
443 protected override bool ProcessDialogKey(Keys keyData
) { // .NET V1.1 Beta
445 return base.ProcessDialogKey(keyData
);
449 protected void SetAboutBoxDelegate(AxHost
.AboutBoxDelegate d
) {
454 protected override void SetBoundsCore(int x
,int y
,int width
,int height
,BoundsSpecified specified
) {
456 base.SetBoundsCore(x
,y
,width
,height
,specified
);
460 protected override void SetVisibleCore(bool value) {
462 base.SetVisibleCore(value);
466 public void ShowAboutBox() {
471 public void ShowPropertyPages() {
476 public void ShowPropertyPages(Control control
) {
481 protected override void WndProc(ref Message m
) {
486 /// --- public delegates ---
488 protected delegate void AboutBoxDelegate();
490 /// --- ICustomTypeDescriptor methods ---
491 /// Note: all of them are supporting .NET framework, but have to be stubbed out for the interface
494 AttributeCollection ICustomTypeDescriptor
.GetAttributes()
496 throw new NotImplementedException ();
500 string ICustomTypeDescriptor
.GetClassName()
507 string ICustomTypeDescriptor
.GetComponentName()
514 TypeConverter ICustomTypeDescriptor
.GetConverter()
516 throw new NotImplementedException ();
520 EventDescriptor ICustomTypeDescriptor
.GetDefaultEvent()
522 throw new NotImplementedException ();
526 PropertyDescriptor ICustomTypeDescriptor
.GetDefaultProperty()
528 throw new NotImplementedException ();
532 object ICustomTypeDescriptor
.GetEditor(Type editorBaseType
)
534 throw new NotImplementedException ();
538 EventDescriptorCollection ICustomTypeDescriptor
.GetEvents()
540 throw new NotImplementedException ();
544 EventDescriptorCollection ICustomTypeDescriptor
.GetEvents(Attribute
[] attributes
)
546 throw new NotImplementedException ();
550 PropertyDescriptorCollection ICustomTypeDescriptor
.GetProperties()
552 throw new NotImplementedException ();
556 PropertyDescriptorCollection ICustomTypeDescriptor
.GetProperties(Attribute
[] attributes
)
558 throw new NotImplementedException ();
562 object ICustomTypeDescriptor
.GetPropertyOwner(PropertyDescriptor pd
)
564 throw new NotImplementedException ();
568 /// sub-class: AxHost.InvalidActiveXStateException
570 /// The exception that is thrown when the ActiveX control is referenced while in an invalid state.
573 public class InvalidActiveXStateException
: Exception
{
578 /// sub-class: AxHost.State
580 /// Encapsulates the persisted state of an ActiveX control.
582 /// Note: the class does not contain any documented methods, just only those supporting .NET framework
586 public class State
: ISerializable
{
588 /// The classes only constructor is supporting .NET framework, and thus not stubbed out:
589 /// - [Serializable] public AxHost.State(Stream ms,int storageType,bool manualUpdate,string licKey);
593 void ISerializable
.GetObjectData(SerializationInfo si
,StreamingContext context
)
595 throw new NotImplementedException ();
599 //protected bool RenderRightToLeft{
602 public enum ActiveXInvokeKind
{
609 public class AxComponentEditor
{// add ref to swf.desing : WindowsFormsComponentEditor {
614 public class ConnectionPointCookie
{
617 public class StateConverter
: System
.ComponentModel
.TypeConverter
{
620 [AttributeUsage(AttributeTargets
.Class
)]
621 public sealed class ClsidAttribute
: Attribute
{
624 public ClsidAttribute (string clsid
)
629 public string Value
{
636 [AttributeUsage(AttributeTargets
.Assembly
)]
637 public sealed class TypeLibraryTimeStampAttribute
: Attribute
{