Beispiel #1
0
 // Create a top-level application window.
 public IToolkitTopLevelWindow CreateTopLevelWindow
     (int width, int height, IToolkitEventSink sink)
 {
     ValidateWindowSize(ref width, ref height);
     return(new DrawingTopLevelWindow
                (this, String.Empty, width, height, sink));
 }
Beispiel #2
0
        // Create a top-level dialog shell.
        public IToolkitWindow CreateTopLevelDialog
            (int width, int height, bool modal, bool resizable,
            IToolkitWindow dialogParent, IToolkitEventSink sink)
        {
            DrawingTopLevelWindow window;

            window = new DrawingTopLevelWindow
                         (this, String.Empty, width, height, sink);

            /*if(dialogParent is TopLevelWindow)
             *      {
             *              window.TransientFor = (TopLevelWindow)dialogParent;
             *      }
             *      if(modal)
             *      {
             *              window.InputType = MotifInputType.ApplicationModal;
             *      }
             *      else
             *      {
             *              window.InputType = MotifInputType.Modeless;
             *      }
             *      if(!resizable)
             *      {
             *              window.Decorations = MotifDecorations.Border |
             *                                                              MotifDecorations.Title |
             *                                                              MotifDecorations.Menu;
             *              window.Functions = MotifFunctions.Move |
             *                                                      MotifFunctions.Close;
             *      }*/
            AddWindow(window, dialogParent as DrawingWindow);
            window.CreateWindow();
            return(window);
        }
Beispiel #3
0
        // Create a top-level dialog shell.
        public IToolkitWindow CreateTopLevelDialog
            (int width, int height, bool modal, bool resizable,
            IToolkitWindow dialogParent, IToolkitEventSink sink)
        {
            DrawingTopLevelWindow window;

            ValidateWindowSize(ref width, ref height);
            window = new DrawingTopLevelWindow
                         (this, String.Empty, width, height, sink);
            if (dialogParent is TopLevelWindow)
            {
                window.TransientFor = (TopLevelWindow)dialogParent;
            }
            if (modal)
            {
                window.InputType = MotifInputType.ApplicationModal;
            }
            else
            {
                window.InputType = MotifInputType.Modeless;
            }
            if (!resizable)
            {
                window.Decorations = MotifDecorations.Border |
                                     MotifDecorations.Title |
                                     MotifDecorations.Menu;
                window.Functions = MotifFunctions.Move |
                                   MotifFunctions.Close;
            }
            return(window);
        }
Beispiel #4
0
        public DrawingTopLevelWindow(DrawingToolkit toolkit, String name,
                                     int width, int height, IToolkitEventSink sink) : base(toolkit)
        {
            this.sink = sink;
            //Console.WriteLine("DrawingTopLevelWindow");
            dimensions = new Rectangle(0, 0, width, height);

            // At the moment we create a unique class name for EVERY window. SWF does it for each unique window class
            className = "DrawingTopLevelWindow" + createCount++;

            // Register the windows class
            windowsClass             = new Win32.Api.WNDCLASS();
            windowsClass.style       = Win32.Api.WindowClassStyle.CS_DBLCLKS;
            windowsClass.lpfnWndProc = new Win32.Api.WNDPROC(toolkit.WindowsLoop);
            // We will draw
            windowsClass.hbrBackground = IntPtr.Zero;
            windowsClass.lpszClassName = className;
            if (Win32.Api.RegisterClassA(ref windowsClass) == 0)
            {
                throw new Exception("Failed to register Windows class " + className);
            }

            // Set default window characteristics
            flags = ToolkitWindowFlags.Menu | ToolkitWindowFlags.Close | ToolkitWindowFlags.Minimize | ToolkitWindowFlags.Maximize | ToolkitWindowFlags.Caption | ToolkitWindowFlags.ResizeHandles;
            toolkit.GetWin32StylesFromFlags(flags, out style, out extendedStyle);
            menu           = false;
            extendedStyle  = 0;
            topOfhierarchy = this;
        }
	public DrawingTopLevelWindow(DrawingToolkit toolkit, String name,
		int width, int height, IToolkitEventSink sink) : base ( toolkit )
	{
		this.sink = sink;
		//Console.WriteLine("DrawingTopLevelWindow");
		dimensions = new Rectangle(0, 0, width, height);

		// At the moment we create a unique class name for EVERY window. SWF does it for each unique window class
		className = "DrawingTopLevelWindow" + createCount++;

		// Register the windows class
		windowsClass = new Win32.Api.WNDCLASS();
		windowsClass.style = Win32.Api.WindowClassStyle.CS_DBLCLKS;
		windowsClass.lpfnWndProc = new Win32.Api.WNDPROC(toolkit.WindowsLoop);
		// We will draw
		windowsClass.hbrBackground = IntPtr.Zero;
		windowsClass.lpszClassName = className ;
		if (Win32.Api.RegisterClassA( ref windowsClass)==0) 
		{
			throw new Exception("Failed to register Windows class " + className);
		}
			
		// Set default window characteristics
		flags = ToolkitWindowFlags.Menu | ToolkitWindowFlags.Close | ToolkitWindowFlags.Minimize | ToolkitWindowFlags.Maximize | ToolkitWindowFlags.Caption | ToolkitWindowFlags.ResizeHandles;
		toolkit.GetWin32StylesFromFlags( flags, out style, out extendedStyle);
		menu = false;
		extendedStyle = 0;
		topOfhierarchy = this;
	}
	public DrawingPopupWindow(DrawingToolkit toolkit, int x, int y, int width, int height,
		IToolkitEventSink sink) : base ( toolkit )
	{
		//Console.WriteLine("DrawingPopupWindow");
		this.sink = sink;
		dimensions = new Rectangle(x, y, width, height);

		// At the moment we create a unique class name for EVERY window. SWF does it for each unique window class
		className = "DrawingPopupWindow" + createCount++;

		// Register the windows class
		windowsClass = new Win32.Api.WNDCLASS();
		windowsClass.style = Win32.Api.WindowClassStyle.CS_DBLCLKS;
		windowsClass.lpfnWndProc = new Win32.Api.WNDPROC(toolkit.WindowsLoop);
		// We will draw
		windowsClass.hbrBackground = IntPtr.Zero;
		windowsClass.lpszClassName = className ;
		if (Win32.Api.RegisterClassA( ref windowsClass)==0) 
		{
			throw new Exception("Failed to register Windows class " + className);
		}
			
		// Set default window characteristics
		style = Win32.Api.WindowStyle.WS_POPUP;
		menu = false;
		extendedStyle = Win32.Api.WindowsExtendedStyle.WS_EX_TOOLWINDOW;
		// We capture the mouse, and we want the client windows to be notified
		topOfhierarchy = this;
	}
Beispiel #7
0
        public DrawingPopupWindow(DrawingToolkit toolkit, int x, int y, int width, int height,
                                  IToolkitEventSink sink) : base(toolkit)
        {
            //Console.WriteLine("DrawingPopupWindow");
            this.sink  = sink;
            dimensions = new Rectangle(x, y, width, height);

            // At the moment we create a unique class name for EVERY window. SWF does it for each unique window class
            className = "DrawingPopupWindow" + createCount++;

            // Register the windows class
            windowsClass             = new Win32.Api.WNDCLASS();
            windowsClass.style       = Win32.Api.WindowClassStyle.CS_DBLCLKS;
            windowsClass.lpfnWndProc = new Win32.Api.WNDPROC(toolkit.WindowsLoop);
            // We will draw
            windowsClass.hbrBackground = IntPtr.Zero;
            windowsClass.lpszClassName = className;
            if (Win32.Api.RegisterClassA(ref windowsClass) == 0)
            {
                throw new Exception("Failed to register Windows class " + className);
            }

            // Set default window characteristics
            style         = Win32.Api.WindowStyle.WS_POPUP;
            menu          = false;
            extendedStyle = Win32.Api.WindowsExtendedStyle.WS_EX_TOOLWINDOW;
            // We capture the mouse, and we want the client windows to be notified
            topOfhierarchy = this;
        }
	// Constructors.
	public DrawingTopLevelWindow(IToolkit toolkit, String name,
						 		 int width, int height, IToolkitEventSink sink)
			: base(name, width, height)
			{
				this.sink = sink;
				this.toolkit = toolkit;
				this.AutoMapChildren = false;
			}
Beispiel #9
0
        // Create a form.
        public IToolkitTopLevelWindow CreateTopLevelWindow(int width, int height, IToolkitEventSink sink)
        {
            DrawingTopLevelWindow window = new DrawingTopLevelWindow(this, string.Empty, width, height, sink);

            AddWindow(window, null);
            window.CreateWindow();
            return(window);
        }
Beispiel #10
0
 // Constructors.
 public DrawingTopLevelWindow(IToolkit toolkit, String name,
                              int width, int height, IToolkitEventSink sink)
     : base(name, width, height)
 {
     this.sink            = sink;
     this.toolkit         = toolkit;
     this.AutoMapChildren = false;
 }
Beispiel #11
0
        public void ToolkitStateChanged(int state)
        {
            IToolkitEventSink co = this.mControlWeakRef.Target as IToolkitEventSink;

            if (null != co)
            {
                co.ToolkitStateChanged(state);
            }
        }
Beispiel #12
0
        public void ToolkitMdiActivate(IToolkitWindow child)
        {
            IToolkitEventSink co = this.mControlWeakRef.Target as IToolkitEventSink;

            if (null != co)
            {
                co.ToolkitMdiActivate(child);
            }
        }
Beispiel #13
0
        public void ToolkitBeginInvoke(IntPtr i_gch)
        {
            IToolkitEventSink co = this.mControlWeakRef.Target as IToolkitEventSink;

            if (null != co)
            {
                co.ToolkitBeginInvoke(i_gch);
            }
        }
Beispiel #14
0
        public void ToolkitPrimaryFocusLeave()
        {
            IToolkitEventSink co = this.mControlWeakRef.Target as IToolkitEventSink;

            if (null != co)
            {
                co.ToolkitPrimaryFocusLeave();
            }
        }
	// Constructor.
	public DrawingPopupWindow
				(IToolkit toolkit, int x, int y, int width, int height,
				 IToolkitEventSink sink)
			: base(x, y, width, height)
			{
				this.sink = sink;
				this.toolkit = toolkit;
				this.AutoMapChildren = false;
			}
Beispiel #16
0
        public void ToolkitExternalResize(int width, int height)
        {
            IToolkitEventSink co = this.mControlWeakRef.Target as IToolkitEventSink;

            if (null != co)
            {
                co.ToolkitExternalResize(width, height);
            }
        }
Beispiel #17
0
        public void ToolkitExternalMove(int x, int y)
        {
            IToolkitEventSink co = this.mControlWeakRef.Target as IToolkitEventSink;

            if (null != co)
            {
                co.ToolkitExternalMove(x, y);
            }
        }
Beispiel #18
0
        // Create a top-level popup window.  Popup windows do not have
        // any borders and grab the mouse and keyboard when they are mapped
        // to the screen.  They are used for menus, drop-down lists, etc.
        public IToolkitWindow CreatePopupWindow
            (int x, int y, int width, int height, IToolkitEventSink sink)
        {
            DrawingWindow window = new DrawingPopupWindow(this, x, y, width, height, sink);

            AddWindow(window, null);
            window.CreateWindow();
            return(window);
        }
Beispiel #19
0
 // Constructor.
 public DrawingPopupWindow
     (IToolkit toolkit, int x, int y, int width, int height,
     IToolkitEventSink sink)
     : base(x, y, width, height)
 {
     this.sink            = sink;
     this.toolkit         = toolkit;
     this.AutoMapChildren = false;
 }
Beispiel #20
0
        public void ToolkitMouseWheel(ToolkitMouseButtons buttons, ToolkitKeys modifiers, int clicks, int x, int y, int delta)
        {
            IToolkitEventSink co = this.mControlWeakRef.Target as IToolkitEventSink;

            if (null != co)
            {
                co.ToolkitMouseWheel(buttons, modifiers, clicks, x, y, delta);
            }
        }
Beispiel #21
0
 // Constructor.
 public DrawingMdiClient
     (IToolkit toolkit, Widget parent,
     int x, int y, int width, int height, IToolkitEventSink sink)
     : base(parent, x, y, width, height)
 {
     this.sink            = sink;
     this.toolkit         = toolkit;
     this.AutoMapChildren = false;
 }
	// Constructor.
	public DrawingMdiClient
				(IToolkit toolkit, Widget parent,
				 int x, int y, int width, int height, IToolkitEventSink sink)
			: base(parent, x, y, width, height)
			{
				this.sink = sink;
				this.toolkit = toolkit;
				this.AutoMapChildren = false;
			}
Beispiel #23
0
        public void ToolkitHelp()
        {
            IToolkitEventSink co = this.mControlWeakRef.Target as IToolkitEventSink;

            if (null != co)
            {
                co.ToolkitHelp();
            }
        }
Beispiel #24
0
        public void ToolkitExpose(Graphics graphics)
        {
            IToolkitEventSink co = this.mControlWeakRef.Target as IToolkitEventSink;

            if (null != co)
            {
                co.ToolkitExpose(graphics);
            }
        }
Beispiel #25
0
        public bool ToolkitKeyUp(ToolkitKeys key)
        {
            IToolkitEventSink co = this.mControlWeakRef.Target as IToolkitEventSink;

            if (null != co)
            {
                return(co.ToolkitKeyUp(key));
            }
            return(false);
        }
Beispiel #26
0
        public bool ToolkitKeyChar(char charCode)
        {
            IToolkitEventSink co = this.mControlWeakRef.Target as IToolkitEventSink;

            if (null != co)
            {
                return(co.ToolkitKeyChar(charCode));
            }
            return(false);
        }
Beispiel #27
0
        // Destroy this window and all of its children.
        void IToolkitWindow.Destroy()
        {
            Destroy();

            /*
             * if the window is destroyed, set toolkit and sink to zero.
             * otherwise, we couold get events like LostFocus...
             */
            toolkit = null;
            sink    = null;
        }
Beispiel #28
0
        // Create a child window underneath this MDI client.
        IToolkitTopLevelWindow IToolkitMdiClient.CreateChildWindow
            (int x, int y, int width, int height, IToolkitEventSink sink)
        {
            DrawingTopLevelWindow window =
                CreateChild(String.Empty, width, height,
                            typeof(DrawingTopLevelWindow))
                as DrawingTopLevelWindow;

            window.SetSink(sink);
            return(window);
        }
Beispiel #29
0
        // Create a child window.  If "parent" is null, then the child
        // does not yet have a "real" parent - it will be reparented later.
        public IToolkitWindow CreateChildWindow
            (IToolkitWindow parent, int x, int y, int width, int height,
            IToolkitEventSink sink)
        {
            Widget wparent;

            if (parent is Widget)
            {
                wparent = ((Widget)parent);
            }
            else
            {
                wparent = placeholder;
            }
            ValidateWindowPosition(ref x, ref y);
            ValidateWindowSize(ref width, ref height);
            return(new DrawingWindow(this, wparent, x, y, width, height, sink));
        }
Beispiel #30
0
        // Create a child window.  If "parent" is null, then the child
        // does not yet have a "real" parent - it will be reparented later.
        public IToolkitWindow CreateChildWindow
            (IToolkitWindow parent, int x, int y, int width, int height,
            IToolkitEventSink sink)
        {
            DrawingWindow dparent;

            if (parent is DrawingWindow)
            {
                dparent = ((DrawingWindow)parent);
            }
            else
            {
                dparent = null;
            }
            DrawingWindow window = new DrawingControlWindow(this, "", dparent, x, y, width, height, sink);

            AddWindow(window, parent as DrawingWindow);
            window.CreateWindow();
            return(window);
        }
Beispiel #31
0
        public DrawingHiddenWindow(DrawingToolkit toolkit, String name,
                                   int width, int height, IToolkitEventSink sink) : base(toolkit)
        {
            className = "DrawingHiddenWindow";
            // Register the windows class
            windowsClass             = new Win32.Api.WNDCLASS();
            windowsClass.style       = Win32.Api.WindowClassStyle.CS_DBLCLKS;
            windowsClass.lpfnWndProc = new Win32.Api.WNDPROC(toolkit.WindowsLoop);
            // We will draw
            windowsClass.hbrBackground = IntPtr.Zero;
            windowsClass.lpszClassName = className;
            if (Win32.Api.RegisterClassA(ref windowsClass) == 0)
            {
                throw new Exception("Failed to register Windows class " + className);
            }

            // Set default window characteristics
            style          = Win32.Api.WindowStyle.WS_OVERLAPPEDWINDOW;
            extendedStyle  = 0;
            topOfhierarchy = this;
        }
	public DrawingHiddenWindow(DrawingToolkit toolkit, String name,
		int width, int height, IToolkitEventSink sink) : base ( toolkit )
	{
		className = "DrawingHiddenWindow";
		// Register the windows class
		windowsClass = new Win32.Api.WNDCLASS();
		windowsClass.style = Win32.Api.WindowClassStyle.CS_DBLCLKS;
		windowsClass.lpfnWndProc = new Win32.Api.WNDPROC(toolkit.WindowsLoop);
		// We will draw
		windowsClass.hbrBackground = IntPtr.Zero;
		windowsClass.lpszClassName = className ;
		if (Win32.Api.RegisterClassA( ref windowsClass)==0) 
		{
			throw new Exception("Failed to register Windows class " + className);
		}
			
		// Set default window characteristics
		style = Win32.Api.WindowStyle.WS_OVERLAPPEDWINDOW;
		extendedStyle = 0;
		topOfhierarchy = this;
	}
	public DrawingControlWindow(DrawingToolkit toolkit, string name, DrawingWindow parent, int x, int y, int width, int height, IToolkitEventSink sink) : base (toolkit)
	{
		this.sink = sink;
		//Console.WriteLine("DrawingControlWindow");
		this.parent = parent;
		dimensions = new Rectangle( x, y, width, height );
		//At the moment we create a unique class name for EVERY window. SWF does it for each window type
		className = "DrawingControlWindow" + createCount++;
		//Register the windows class
		windowsClass = new Win32.Api.WNDCLASS();
		windowsClass.style = Win32.Api.WindowClassStyle.CS_DBLCLKS;
		windowsClass.lpfnWndProc = new Win32.Api.WNDPROC(toolkit.WindowsLoop);
		windowsClass.hbrBackground = IntPtr.Zero; //(IntPtr)(Win32.Api.COLOR_WINDOW + 1);
		windowsClass.lpszClassName = className ;
		if (Win32.Api.RegisterClassA( ref windowsClass)==0) 
		{
			throw new Exception("Failed to register Windows class " + className);
		}
		//Set default windows settings
		style = Win32.Api.WindowStyle.WS_CHILD | Win32.Api.WindowStyle.WS_TABSTOP | Win32.Api.WindowStyle.WS_CLIPSIBLINGS;
		extendedStyle = 0;
	}
	// Create a child window.  If "parent" is null, then the child
	// does not yet have a "real" parent - it will be reparented later.
	public virtual IToolkitWindow CreateChildWindow
				(IToolkitWindow parent, int x, int y, int width, int height,
				 IToolkitEventSink sink)
			{
				return null;
			}
	// Create a child window underneath this MDI client.
	IToolkitTopLevelWindow IToolkitMdiClient.CreateChildWindow
				(int x, int y, int width, int height, IToolkitEventSink sink)
			{
				DrawingTopLevelWindow window =
					CreateChild(String.Empty, width, height,
								typeof(DrawingTopLevelWindow))
						as DrawingTopLevelWindow;
				window.SetSink(sink);
				return window;
			}
	// Create a top-level popup window.  Popup windows do not have
	// any borders and grab the mouse and keyboard when they are mapped
	// to the screen.  They are used for menus, drop-down lists, etc.
	public IToolkitWindow CreatePopupWindow
		(int x, int y, int width, int height, IToolkitEventSink sink)
	{
		DrawingWindow window = new DrawingPopupWindow(this, x, y, width, height, sink);
		AddWindow(window, null);
		window.CreateWindow();
		return window;
	}
	// Create a child window.  If "parent" is null, then the child
	// does not yet have a "real" parent - it will be reparented later.
	public IToolkitWindow CreateChildWindow
		(IToolkitWindow parent, int x, int y, int width, int height,
		IToolkitEventSink sink)
	{
		DrawingWindow dparent;
		if(parent is DrawingWindow)
		{
			dparent = ((DrawingWindow)parent);
		}
		else
		{
			dparent = null;
		}
		DrawingWindow window = new DrawingControlWindow(this, "", dparent, x, y, width, height, sink);
		AddWindow(window, parent as DrawingWindow);
		window.CreateWindow();
		return window;
	}
	public DrawingRootTopLevelWindow(DrawingToolkit toolkit, String name,
		int width, int height, IToolkitEventSink sink) : base (toolkit, name, width, height, sink) {}
	// Create an MDI client area.
	public virtual IToolkitMdiClient CreateMdiClient
				(IToolkitWindow parent, int x, int y, int width, int height,
				 IToolkitEventSink sink)
			{
				return null;
			}
 public DrawingRootTopLevelWindow(DrawingToolkit toolkit, String name,
                                  int width, int height, IToolkitEventSink sink) : base(toolkit, name, width, height, sink)
 {
 }
Beispiel #41
0
 // Set the sink.
 public void SetSink(IToolkitEventSink sink)
 {
     this.sink = sink;
 }
	// Create a top-level dialog shell.
	public IToolkitWindow CreateTopLevelDialog
				(int width, int height, bool modal, bool resizable,
				 IToolkitWindow dialogParent, IToolkitEventSink sink)
			{
				DrawingTopLevelWindow window;
				ValidateWindowSize(ref width, ref height);
				window = new DrawingTopLevelWindow
					(this, String.Empty, width, height, sink);
				if(dialogParent is TopLevelWindow)
				{
					window.TransientFor = (TopLevelWindow)dialogParent;
				}
				if(modal)
				{
					window.InputType = MotifInputType.ApplicationModal;
				}
				else
				{
					window.InputType = MotifInputType.Modeless;
				}
				if(!resizable)
				{
					window.Decorations = MotifDecorations.Border |
										 MotifDecorations.Title |
										 MotifDecorations.Menu;
					window.Functions = MotifFunctions.Move |
									   MotifFunctions.Close;
				}
				return window;
			}
	// Create a top-level application window.
	public IToolkitTopLevelWindow CreateTopLevelWindow
				(int width, int height, IToolkitEventSink sink)
			{
				ValidateWindowSize(ref width, ref height);
				return new DrawingTopLevelWindow
					(this, String.Empty, width, height, sink);
			}
	// Create a top-level popup window.  Popup windows do not have
	// any borders and grab the mouse and keyboard when they are mapped
	// to the screen.  They are used for menus, drop-down lists, etc.
	public IToolkitWindow CreatePopupWindow
				(int x, int y, int width, int height, IToolkitEventSink sink)
			{
				return new DrawingPopupWindow(this, x, y, width, height, sink);
			}
	// Set the sink.
	public void SetSink(IToolkitEventSink sink)
			{
				this.sink = sink;
			}
	// Create a form.
	public IToolkitTopLevelWindow CreateTopLevelWindow(int width, int height, IToolkitEventSink sink)
	{
		DrawingTopLevelWindow window = new DrawingTopLevelWindow(this, string.Empty, width, height, sink);
		AddWindow(window, null);
		window.CreateWindow();
		return window;
	}
	public ControlWeakRef( IToolkitEventSink control ) {
		this.mControlWeakRef = new WeakReference( control, false );
	}
	// Create a top-level application window.
	public virtual IToolkitTopLevelWindow CreateTopLevelWindow
				(int width, int height, IToolkitEventSink sink)
			{
				return null;
			}
Beispiel #49
0
 public ControlWeakRef(IToolkitEventSink control)
 {
     this.mControlWeakRef = new WeakReference(control, false);
 }
	// Create a top-level popup window.  Popup windows do not have
	// any borders and grab the mouse and keyboard when they are mapped
	// to the screen.  They are used for menus, drop-down lists, etc.
	public virtual IToolkitWindow CreatePopupWindow
				(int x, int y, int width, int height, IToolkitEventSink sink)
			{
				return null;
			}
	// Create an MDI client area.
	public IToolkitMdiClient CreateMdiClient
				(IToolkitWindow parent, int x, int y, int width, int height,
				 IToolkitEventSink sink)
			{
				Widget wparent;
				if(parent is Widget)
				{
					wparent = ((Widget)parent);
				}
				else
				{
					wparent = placeholder;
				}
				ValidateWindowPosition(ref x, ref y);
				ValidateWindowSize(ref width, ref height);
				return new DrawingMdiClient
					(this, wparent, x, y, width, height, sink);
			}
	// Create a top-level dialog shell.
	public virtual IToolkitWindow CreateTopLevelDialog
				(int width, int height, bool modal, bool resizable,
				 IToolkitWindow dialogParent, IToolkitEventSink sink)
			{
				return null;
			}
Beispiel #53
0
 public DrawingControlWindow(DrawingToolkit toolkit, string name, DrawingWindow parent, int x, int y, int width, int height, IToolkitEventSink sink) : base(toolkit)
 {
     this.sink = sink;
     //Console.WriteLine("DrawingControlWindow");
     this.parent = parent;
     dimensions  = new Rectangle(x, y, width, height);
     //At the moment we create a unique class name for EVERY window. SWF does it for each window type
     className = "DrawingControlWindow" + createCount++;
     //Register the windows class
     windowsClass               = new Win32.Api.WNDCLASS();
     windowsClass.style         = Win32.Api.WindowClassStyle.CS_DBLCLKS;
     windowsClass.lpfnWndProc   = new Win32.Api.WNDPROC(toolkit.WindowsLoop);
     windowsClass.hbrBackground = IntPtr.Zero;     //(IntPtr)(Win32.Api.COLOR_WINDOW + 1);
     windowsClass.lpszClassName = className;
     if (Win32.Api.RegisterClassA(ref windowsClass) == 0)
     {
         throw new Exception("Failed to register Windows class " + className);
     }
     //Set default windows settings
     style         = Win32.Api.WindowStyle.WS_CHILD | Win32.Api.WindowStyle.WS_TABSTOP | Win32.Api.WindowStyle.WS_CLIPSIBLINGS;
     extendedStyle = 0;
 }
	// Destroy this window and all of its children.
	void IToolkitWindow.Destroy()
			{
				Destroy();
				/*
				 * if the window is destroyed, set toolkit and sink to zero.
				 * otherwise, we couold get events like LostFocus...
				*/
				toolkit = null;
				sink    = null;
			}