// Constructor.
	public DrawingWindowBuffer(IToolkitWindow windowToBuffer)
			{
				toolkit = windowToBuffer.Toolkit;
				widget = windowToBuffer as InputOutputWidget;
				buffer = null;
				graphics = null;
			}
Esempio n. 2
0
        // Create the toolkit window underlying this control.
        internal override IToolkitWindow CreateToolkitWindow(IToolkitWindow parent)
        {
            CreateParams cp     = CreateParams;
            int          x      = cp.X + ToolkitDrawOrigin.X;
            int          y      = cp.Y + ToolkitDrawOrigin.Y;
            int          width  = cp.Width - ToolkitDrawSize.Width;
            int          height = cp.Height - ToolkitDrawSize.Height;

            if (parent != null)
            {
                // Use the parent's toolkit to create.
                if (Parent is Form)
                {
                    // use ControlToolkitManager to create the window thread safe
                    return(ControlToolkitManager.CreateMdiClient(this,
                                                                 parent, x, y, width, height));
                }
                else
                {
                    // use ControlToolkitManager to create the window thread safe
                    return(ControlToolkitManager.CreateMdiClient(this,
                                                                 parent,
                                                                 x + Parent.ClientOrigin.X,
                                                                 y + Parent.ClientOrigin.Y, width, height));
                }
            }
            else
            {
                // Use the default toolkit to create.
                // use ControlToolkitManager to create the window thread safe
                return(ControlToolkitManager.CreateMdiClient(this, null, x, y, width, height));
            }
        }
Esempio n. 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);
        }
Esempio n. 4
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);
        }
Esempio n. 5
0
 // Constructor.
 public DrawingWindowBuffer(IToolkitWindow windowToBuffer)
 {
     toolkit  = windowToBuffer.Toolkit;
     widget   = windowToBuffer as InputOutputWidget;
     buffer   = null;
     graphics = null;
 }
Esempio n. 6
0
        // Reparent this window to underneath a new parent. If there is no parent then the parent is the desktop and the control is not visible.
        void IToolkitWindow.Reparent(IToolkitWindow parent, int x, int y)
        {
            if (parent != this.parent)
            {
                // window with no parent cant be visible
                if (parent == null || (parent as DrawingWindow).hwnd == IntPtr.Zero)
                {
                    IsMapped = false;
                }
                bool parented = (this.parent != null && this.parent.hwnd != IntPtr.Zero);

                // Adjust the heirararchy of parents and top of hierarchy
                ReparentOwn(parent as DrawingWindow);

                suspendExternalMoveResizeNotify = true;
                Win32.Api.SetParent(hwnd, parentHwnd);
                suspendExternalMoveResizeNotify = false;
                // Reposition this window on the client
                (this as IToolkitWindow).MoveResize(x, y, dimensions.Width, dimensions.Height);

                if (visible && !parented)
                {
                    SetVisible();
                }
            }
            //Console.WriteLine("DrawingWindow.Reparent, " + sink);
        }
Esempio n. 7
0
 // Convert a screen point for a window into a client point.
 public Point ScreenToClient(IToolkitWindow window, Point point)
 {
     Win32.Api.POINT p;
     p.x = point.X;
     p.y = point.Y;
     Win32.Api.ScreenToClient((window as DrawingWindow).hwnd, ref p);
     return(new Point(p.x, p.y));
 }
Esempio n. 8
0
        public void ToolkitMdiActivate(IToolkitWindow child)
        {
            IToolkitEventSink co = this.mControlWeakRef.Target as IToolkitEventSink;

            if (null != co)
            {
                co.ToolkitMdiActivate(child);
            }
        }
Esempio n. 9
0
        // Move this window to below one of its siblings.
        void IToolkitWindow.MoveToBelow(IToolkitWindow sibling)
        {
            DrawingWindow toWindow = sibling as DrawingWindow;

            MoveWindowTo(this, toWindow);
            // Make the same changes in win32.
            Win32.Api.SetWindowPos(hwnd, toWindow.hwnd, 0, 0, 0, 0, Win32.Api.SetWindowsPosFlags.SWP_NOMOVE | Win32.Api.SetWindowsPosFlags.SWP_NOSIZE | Win32.Api.SetWindowsPosFlags.SWP_NOACTIVATE);
            //Console.WriteLine("DrawingWindow.MoveToBelow, " + sink +", " + sibling);
        }
	internal override IToolkitWindow CreateToolkitWindow(IToolkitWindow parent)
	{
		CreateParams cp = CreateParams;

		// use ControlToolkitManager to create the window thread safe
		return ControlToolkitManager.CreatePopupWindow( this,
				cp.X + ToolkitDrawOrigin.X, cp.Y + ToolkitDrawOrigin.Y,
				 cp.Width - ToolkitDrawSize.Width, cp.Height - ToolkitDrawSize.Height);
	}
Esempio n. 11
0
        internal override IToolkitWindow CreateToolkitWindow(IToolkitWindow parent)
        {
            CreateParams cp = CreateParams;

            // use ControlToolkitManager to create the window thread safe
            return(ControlToolkitManager.CreatePopupWindow(this,
                                                           cp.X + ToolkitDrawOrigin.X, cp.Y + ToolkitDrawOrigin.Y,
                                                           cp.Width - ToolkitDrawSize.Width, cp.Height - ToolkitDrawSize.Height));
        }
Esempio n. 12
0
        protected internal override void MouseMove(int msg, int wParam, int lParam)
        {
            // Another popup window could grab the capture from this control. When we move back onto this control, we need to make sure that we regain the capture.
            IToolkitWindow window = (this as IToolkitWindow);

            if (window.Capture != visible)
            {
                window.Capture = base.IsMapped;
            }
            base.MouseMove(msg, wParam, lParam);
        }
Esempio n. 13
0
 // Reparent this window to underneath a new parent.
 void IToolkitWindow.Reparent(IToolkitWindow parent, int x, int y)
 {
     if (parent == null)
     {
         Reparent(((DrawingToolkit)Toolkit).placeholder, x, y);
     }
     else
     {
         Reparent((Widget)parent, x, y);
     }
 }
Esempio n. 14
0
 // Set this cursor on a toolkit window.
 internal void SetCursorOnWindow(IToolkitWindow window)
 {
     if (icon != null)
     {
         window.SetCursor(type, ToolkitManager.GetImageFrame(icon));
     }
     else
     {
         window.SetCursor(type, null);
     }
 }
Esempio n. 15
0
        // Convert a screen point for a window into a client point.
        public System.Drawing.Point ScreenToClient
            (IToolkitWindow window, System.Drawing.Point point)
        {
            Widget widget = (window as Widget);

            if (widget != null)
            {
                Xsharp.Point pt = widget.ScreenToWidget(point.X, point.Y);
                return(new System.Drawing.Point(pt.x, pt.y));
            }
            else
            {
                return(point);
            }
        }
Esempio n. 16
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));
        }
Esempio n. 17
0
 internal void Activate(IToolkitWindow child)
 {
     if (child == null)
     {
         activeChild = null;
     }
     else
     {
         activeChild = null;
         foreach (Form form in controls)
         {
             if (form.toolkitWindow == child)
             {
                 activeChild = form;
                 break;
             }
         }
     }
 }
Esempio n. 18
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);
        }
Esempio n. 19
0
        IToolkitWindow InternalCreateMdiClient(Control control, IToolkitWindow parent, int x, int y, int w, int h)
        {
            // be ThreadSafe
            if (IsInvokeRequired)
            {
                return((IToolkitTopLevelWindow)Invoke(
                           new DelegateCreateMdiClient(this.InternalCreateMdiClient),
                           new object[] { control, parent, x, y, w, h }
                           ));
            }

            if (null != parent)
            {
                return(parent.Toolkit.CreateMdiClient(parent, x, y, w, h, new ControlWeakRef(control)));
            }
            else
            {
                return(ToolkitManager.Toolkit.CreateMdiClient(null, x, y, w, h, new ControlWeakRef(control)));
            }
        }
	// Reparent this window to underneath a new parent. If there is no parent then the parent is the desktop and the control is not visible.
	void IToolkitWindow.Reparent(IToolkitWindow parent, int x, int y)
	{
		if (parent != this.parent)
		{
			// window with no parent cant be visible
			if (parent == null || (parent as DrawingWindow).hwnd == IntPtr.Zero)
				IsMapped = false;
			bool parented = (this.parent != null && this.parent.hwnd != IntPtr.Zero);

			// Adjust the heirararchy of parents and top of hierarchy
			ReparentOwn(parent as DrawingWindow);
			
			suspendExternalMoveResizeNotify = true;
			Win32.Api.SetParent( hwnd, parentHwnd);
			suspendExternalMoveResizeNotify = false;
			// Reposition this window on the client
			(this as IToolkitWindow).MoveResize(x, y, dimensions.Width, dimensions.Height);
			
			if (visible && !parented)
				SetVisible();
		}
		//Console.WriteLine("DrawingWindow.Reparent, " + sink);
	}
	private IToolkitWindow InternalCreateChildWindow( Control control, IToolkitWindow parent, int x, int y, int w, int h ) 
	{
		// be ThreadSafe
		if( IsInvokeRequired ) {
			return (IToolkitWindow) Invoke( 
					new DelegateCreateChildWindow( this.InternalCreateChildWindow), 
					new object[] { control, parent, x, y, w, h } 
				);
		}
		
		// Check parent Toolkit too, might be null in some difficult cases. 
		if(parent != null && parent.Toolkit != null )
		{
			return parent.Toolkit.CreateChildWindow
					(parent, x, y, w, h, new ControlWeakRef(control) );
		}
		else
		{
			// Use the default toolkit to create.
			return ToolkitManager.Toolkit.CreateChildWindow
					(null, x, y, w, h, new ControlWeakRef(control) );
		}
	}
Esempio n. 22
0
        private IToolkitWindow InternalCreateChildWindow(Control control, IToolkitWindow parent, int x, int y, int w, int h)
        {
            // be ThreadSafe
            if (IsInvokeRequired)
            {
                return((IToolkitWindow)Invoke(
                           new DelegateCreateChildWindow(this.InternalCreateChildWindow),
                           new object[] { control, parent, x, y, w, h }
                           ));
            }

            // Check parent Toolkit too, might be null in some difficult cases.
            if (parent != null && parent.Toolkit != null)
            {
                return(parent.Toolkit.CreateChildWindow
                           (parent, x, y, w, h, new ControlWeakRef(control)));
            }
            else
            {
                // Use the default toolkit to create.
                return(ToolkitManager.Toolkit.CreateChildWindow
                           (null, x, y, w, h, new ControlWeakRef(control)));
            }
        }
Esempio n. 23
0
	internal void Activate(IToolkitWindow child)
			{
				if(child == null)
				{
					activeChild = null;
				}
				else
				{
					activeChild = null;
					foreach(Form form in controls)
					{
						if(form.toolkitWindow == child)
						{
							activeChild = form;
							break;
						}
					}
				}
			}
	internal static IToolkitWindow CreateChildWindow(Control control, IToolkitWindow parent, int x, int y, int w, int h ) 
	{
		return Instance.InternalCreateChildWindow(control, parent, x, y, w, h );
	}
	// Move this window to below one of its siblings.
	void IToolkitWindow.MoveToBelow(IToolkitWindow sibling)
			{
				return;
			}
	// 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);
			}
Esempio n. 27
0
 // Receive notification that a particular child was activated.
 internal override void MdiActivate(IToolkitWindow child)
 {
     Activate(child);
 }
Esempio n. 28
0
 void IToolkitWindow.Reparent(IToolkitWindow parent, int x, int y)
 {
     throw new NotSupportedException("TopLevelWindow can't have a parent");
 }
	// Create a new window buffer.
	public IToolkitWindowBuffer CreateWindowBuffer(IToolkitWindow window)
			{
				return new DrawingWindowBuffer(window);
			}
Esempio n. 30
0
	protected virtual void CreateHandle()
			{
				if( toolkitWindow != null ) return; // already created
				
				// Cannot create the control if it has been disposed.
				if(GetControlFlag(ControlFlags.Disposed))
				{
					throw new ObjectDisposedException
						("control", S._("SWF_ControlDisposed"));
				}

				// Create the handle using the toolkit.
				if(parent != null)
				{
					toolkitWindow = CreateToolkitWindow(parent.toolkitWindow);

					// Mark this control as requiring a reparent, if needed.
					if(parent.toolkitWindow == null)
					{
						SetControlFlag(ControlFlags.NeedReparent, true);
					}
				}
				else
				{
					toolkitWindow = CreateToolkitWindow(null);
				}

				// Dont think we need this - Neil
				//toolkitWindow.Lower();

				// Copy color information into the toolkit window.
				toolkitWindow.SetForeground(ForeColor);
				toolkitWindow.SetBackground(BackColor);
				// TODO: background images

				// Set the initial cursor if we aren't inheriting our parent.
				if(cursor != null)
				{
					cursor.SetCursorOnWindow(toolkitWindow);
				}

				// createThread = Thread.CurrentThread; not needed anymore

				// Reparent the children which require it.
				for(int i = 0; i < numChildren; ++i)
				{
					if(children[i].GetControlFlag(ControlFlags.NeedReparent))
					{
						children[i].Reparent(this);
					}
				}

				// Notify subclasses that the handle has been created.
				OnHandleCreated(EventArgs.Empty);
			}
Esempio n. 31
0
 // Move this window to below one of its siblings.
 void IToolkitWindow.MoveToBelow(IToolkitWindow sibling)
 {
     return;
 }
Esempio n. 32
0
 // Move this window to above one of its siblings.
 void IToolkitWindow.MoveToAbove(IToolkitWindow sibling)
 {
     return;
 }
Esempio n. 33
0
 // Create a new window buffer.
 public IToolkitWindowBuffer CreateWindowBuffer(IToolkitWindow window)
 {
     return(new DrawingWindowBuffer(window));
 }
Esempio n. 34
0
 public DrawingWindowBuffer(IToolkitWindow windowToBuffer)
 {
     window = windowToBuffer as DrawingWindow;
     CreateBuffer(windowToBuffer.Dimensions.Size);
 }
Esempio n. 35
0
 internal static IToolkitWindow CreateChildWindow(Control control, IToolkitWindow parent, int x, int y, int w, int h)
 {
     return(Instance.InternalCreateChildWindow(control, parent, x, y, w, h));
 }
Esempio n. 36
0
	internal override IToolkitWindow CreateToolkitWindow(IToolkitWindow parent)
	{
		// When a Form is reparented to a normal container control 
		// which does work on Win32 unfortunately.
		if(mdiParent == null && (!TopLevel))
		{
			return base.CreateToolkitWindow(parent);
		}

		CreateParams cp = CreateParams;

		// Create the window and set its initial caption.
		IToolkitTopLevelWindow window;
		if(mdiParent == null)
		{
			// use ControlToolkitManager to create the window thread safe
			window = ControlToolkitManager.CreateTopLevelWindow( this,
					cp.Width - ToolkitDrawSize.Width,
					cp.Height - ToolkitDrawSize.Height);
		}
		else
		{
			mdiParent.mdiClient.CreateControl();
			IToolkitMdiClient mdi =
					(mdiParent.mdiClient.toolkitWindow as
					IToolkitMdiClient);
			
			// use ControlToolkitManager to create the window thread safe
			window = ControlToolkitManager.CreateMdiChildWindow( this, mdi, 
					cp.X, cp.Y,
					cp.Width - ToolkitDrawSize.Width,
					cp.Height - ToolkitDrawSize.Height);
		}
		
		window.SetTitle(cp.Caption);
		// Win32 requires this because if the window is maximized, the windows size needs to be set.
		toolkitWindow = window;

		// Adjust the window hints to match our requirements.
		SetWindowFlags(window);
		if(icon != null)
		{
			window.SetIcon(icon);
		}
		window.SetMaximumSize(maximumSize);
		window.SetMinimumSize(minimumSize);

#if !CONFIG_COMPACT_FORMS
		if(windowState == FormWindowState.Minimized)
		{
			window.Iconify();
		}
		else
#endif
		if(windowState == FormWindowState.Maximized)
		{
			window.Maximize();
		}

		// Center the window on-screen if necessary.
		if(formStartPosition == FormStartPosition.CenterScreen)
		{
			Size screenSize = ToolkitManager.Toolkit.GetScreenSize();
			window.MoveResize
					((screenSize.Width - cp.Width) / 2,
					(screenSize.Height - cp.Height) / 2,
					window.Dimensions.Width, window.Dimensions.Height);
		}
		else if(formStartPosition == FormStartPosition.Manual)
		{
			window.MoveResize
					(
					cp.X,
			cp.Y,
			window.Dimensions.Width,
			window.Dimensions.Height
					);
		}
		if(opacity != 1.0)
		{
			window.SetOpacity(opacity);
		}
		return window;
}
Esempio n. 37
0
 // Move this window to above one of its siblings.
 void IToolkitWindow.MoveToAbove(IToolkitWindow sibling)
 {
     throw new NotSupportedException();
     //Console.WriteLine("DrawingWindow.MoveToAbove, "+sink);
 }
Esempio n. 38
0
 public Point ScreenToClient(IToolkitWindow window, Point point)
 {
     throw new NotImplementedException();
 }
Esempio n. 39
0
 // Create an MDI client area.
 public IToolkitMdiClient CreateMdiClient
     (IToolkitWindow parent, int x, int y, int width, int height,
     IToolkitEventSink sink)
 {
     return(null);
 }
Esempio n. 40
0
	internal virtual void MdiActivate(IToolkitWindow child) {}
	// Convert a screen point for a window into a client point.
	public System.Drawing.Point ScreenToClient
				(IToolkitWindow window, System.Drawing.Point point)
			{
				Widget widget = (window as Widget);
				if(widget != null)
				{
					Xsharp.Point pt = widget.ScreenToWidget(point.X, point.Y);
					return new System.Drawing.Point(pt.x, pt.y);
				}
				else
				{
					return point;
				}
			}
Esempio n. 42
0
 public IToolkitWindowBuffer CreateWindowBuffer(IToolkitWindow window)
 {
     throw new NotImplementedException();
 }
	// Move this window to above one of its siblings.
	void IToolkitWindow.MoveToAbove(IToolkitWindow sibling)
			{
				return;
			}
	// Move this window to below one of its siblings.
	void IToolkitWindow.MoveToBelow(IToolkitWindow sibling)
			{
				// Move this window below the sibling widget.
				MoveToBelow(sibling as Widget);
			}
	IToolkitWindow InternalCreateMdiClient( Control control, IToolkitWindow parent, int x, int y, int w, int h )
	{
		// be ThreadSafe
		if( IsInvokeRequired ) {
			return (IToolkitTopLevelWindow) Invoke( 
					new DelegateCreateMdiClient( this.InternalCreateMdiClient), 
					new object[] { control, parent, x, y, w, h } 
				);
		}
		
		if( null != parent ) {
			return parent.Toolkit.CreateMdiClient( parent, x, y, w, h, new ControlWeakRef(control) );
		}
		else {
			return ToolkitManager.Toolkit.CreateMdiClient(null, x, y, w, h, new ControlWeakRef(control) );
		}
	}
	// 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;
			}
	public void ToolkitMdiActivate(IToolkitWindow child) {
		IToolkitEventSink co = this.mControlWeakRef.Target as IToolkitEventSink;
		if( null != co ) {
			co.ToolkitMdiActivate(child);
		}
	}
	void IToolkitWindow.Reparent(IToolkitWindow parent, int x, int y)
	{
		throw new NotSupportedException("TopLevelWindow can't have a parent");
	}
Esempio n. 49
0
	// Receive notification that a particular child was activated.
	internal override void MdiActivate(IToolkitWindow child) 
			{
				Activate(child);
			}
	// Move this window to below one of its siblings.
	void IToolkitWindow.MoveToBelow(IToolkitWindow sibling)
	{
		DrawingWindow toWindow = sibling as DrawingWindow;
		MoveWindowTo(this, toWindow);
		// Make the same changes in win32.
		Win32.Api.SetWindowPos(hwnd, toWindow.hwnd, 0, 0, 0, 0, Win32.Api.SetWindowsPosFlags.SWP_NOMOVE | Win32.Api.SetWindowsPosFlags.SWP_NOSIZE | Win32.Api.SetWindowsPosFlags.SWP_NOACTIVATE);
		//Console.WriteLine("DrawingWindow.MoveToBelow, " + sink +", " + sibling);
	}
Esempio n. 51
0
	// Create the toolkit window underlying this control.
	internal override IToolkitWindow CreateToolkitWindow(IToolkitWindow parent)
	{
		CreateParams cp = CreateParams;
		int x = cp.X + ToolkitDrawOrigin.X;
		int y = cp.Y + ToolkitDrawOrigin.Y;
		int width = cp.Width - ToolkitDrawSize.Width;
		int height = cp.Height - ToolkitDrawSize.Height;
						
		if(parent != null)
		{
						// Use the parent's toolkit to create.
			if(Parent is Form)
			{
				// use ControlToolkitManager to create the window thread safe
				return ControlToolkitManager.CreateMdiClient( this, 
						parent, x, y, width, height);
			}
			else
			{
				// use ControlToolkitManager to create the window thread safe
				return ControlToolkitManager.CreateMdiClient( this,
						parent,
						x + Parent.ClientOrigin.X,
						y +  Parent.ClientOrigin.Y, width, height);
			}
		}
		else
		{
			// Use the default toolkit to create.
			// use ControlToolkitManager to create the window thread safe
			return ControlToolkitManager.CreateMdiClient	(this, null, x, y, width, height);
		}
	}
Esempio n. 52
0
 // Move this window to below one of its siblings.
 void IToolkitWindow.MoveToBelow(IToolkitWindow sibling)
 {
     // Move this window below the sibling widget.
     MoveToBelow(sibling as Widget);
 }
	// Reparent this window to underneath a new parent.
	void IToolkitWindow.Reparent(IToolkitWindow parent, int x, int y)
			{
				if(parent == null)
				{
					Reparent(((DrawingToolkit)Toolkit).placeholder, x, y);
				}
				else
				{
					Reparent((Widget)parent, x, y);
				}
			}
	// Move this window to above one of its siblings.
	void IToolkitWindow.MoveToAbove(IToolkitWindow sibling)
	{
		throw new NotSupportedException();
		//Console.WriteLine("DrawingWindow.MoveToAbove, "+sink);
	}
Esempio n. 55
0
	protected virtual void DestroyHandle()
			{
				// Bail out if we don't have a handle.
				if(toolkitWindow == null)
				{
					return;
				}
				
				// process all pending InvokeEvents 
				// it could be that a BeginInvoke is waiting for EndInvoke.
				this.ProcessInvokeEvent( IntPtr.Zero );
				
				// Destroy all of the child controls.
				int child;
				for(child = 0; child < numChildren; ++child)
				{
					children[child].DestroyHandle();
				}

				// Destroy the toolkit window.
				if(toolkitWindow != null)
				{
					toolkitWindow.Destroy();
					toolkitWindow = null;
				}
				
				// Dispose DoubleBuffer too here
				if( buffer != null ) {
					buffer.Dispose();
					buffer = null;
				}
				
				// Notify event handlers that the handle is destroyed.
				OnHandleDestroyed(EventArgs.Empty);
			}
		public DrawingWindowBuffer(IToolkitWindow windowToBuffer)
		{
			window = windowToBuffer as DrawingWindow;
			CreateBuffer(windowToBuffer.Dimensions.Size);
		}
Esempio n. 57
0
	// Event that is called when an MDI child is activated or deactivated.
	internal override void MdiActivate(IToolkitWindow child)
			{
				if(mdiClient != null)
				{
					mdiClient.Activate(child);
				}
				OnMdiChildActivate(EventArgs.Empty);
			}
Esempio n. 58
0
	// Create the toolkit window underlying this control.
	internal virtual IToolkitWindow CreateToolkitWindow(IToolkitWindow parent)
			{
				// Because we use owner-draw in this implementation
				// for all widgets, we are only interested in the
				// position and size information from "CreateParams".
				CreateParams cp = CreateParams;
				// Convert to toolkit coordinates
				int x = cp.X + ToolkitDrawOrigin.X;
				int y = cp.Y + ToolkitDrawOrigin.Y;
				int width = cp.Width - ToolkitDrawSize.Width;
				int height = cp.Height - ToolkitDrawSize.Height;
					
				if(parent != null)
				{
					// Offset the co-ordinates to the client origin.
					// the toolkit co-ordinates must be relative to the draw origin.
					x += Parent.ClientOrigin.X - Parent.ToolkitDrawOrigin.X;
					y += Parent.ClientOrigin.Y - Parent.ToolkitDrawOrigin.Y; 
				}
				// use ControlToolkitManager to create the window thread safe
				return ControlToolkitManager.CreateChildWindow( this, parent, x, y, width, height );
			}
Esempio n. 59
0
	// Set the current state of the window decoration flags on a window.
	private void SetWindowFlags(IToolkitWindow window)
			{
				((IToolkitTopLevelWindow)window).SetWindowFlags(GetFullFlags());
			}
Esempio n. 60
0
	// Event that is emitted when the active MDI child window changes.
	// The "child" parameter is null if a window has been deactivated.
	void IToolkitEventSink.ToolkitMdiActivate(IToolkitWindow child)
			{
				MdiActivate(child);
			}