Exemplo n.º 1
0
        // Override the key press event from Xsharp.
        protected override bool OnKeyPress(KeyName key,
                                           ModifierMask modifiers, String str)
        {
            bool processed = false;

            if (sink != null)
            {
                // Emit the "KeyDown" event.
                ToolkitKeys keyData = DrawingWindow.MapKey(key, modifiers);
                if (sink.ToolkitKeyDown(keyData))
                {
                    processed = true;
                }

                // Emit the "KeyChar" event if necessary.
                if (str != null)
                {
                    foreach (char ch in str)
                    {
                        if (sink.ToolkitKeyChar(ch))
                        {
                            processed = true;
                        }
                    }
                }
            }
            return(processed);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
 internal virtual int MouseActivate(DrawingWindow activateWindow)
 {
     //Console.WriteLine("DrawingWindow.MouseActivate, " + sink +"," + activateWindow.sink);
     if (activateWindow is DrawingPopupWindow)
     {
         return((int)Win32.Api.WM_MOUSEACTIVATEReturn.MA_NOACTIVATE);
     }
     return((int)Win32.Api.WM_MOUSEACTIVATEReturn.MA_ACTIVATE);
 }
Exemplo n.º 4
0
 // Set the child right next to the parent in the heirarchy sure the parent window is before the child.
 // Set the correct TopOfHierarchy for all the childwindows.
 protected internal void ReparentOwn(DrawingWindow parent)
 {
     SetTopOfHierarchy();
     this.parent = parent;
     if (parent != null)
     {
         MoveWindowTo(this, parent);
     }
 }
Exemplo n.º 5
0
 // Override the key release event from Xsharp.
 protected override bool OnKeyRelease(KeyName key, ModifierMask modifiers)
 {
     if (sink != null)
     {
         // Emit the "KeyUp" event.
         ToolkitKeys keyData = DrawingWindow.MapKey(key, modifiers);
         return(sink.ToolkitKeyUp(keyData));
     }
     return(false);
 }
Exemplo n.º 6
0
 // Add a new DrawingWindow and make room if necessary
 internal void AddWindow(DrawingWindow window, DrawingWindow parent)
 {
     if (windows.Length == windowCount)
     {
         DrawingWindow[] newWindows = new DrawingWindow[windows.Length * 2];
         windows.CopyTo(newWindows, 0);
         windows = newWindows;
     }
     windows[windowCount++] = window;
 }
Exemplo n.º 7
0
        internal void DoubleClick(int msg, int wParam, int lParam)
        {
            int           x, y;
            DrawingWindow found = FindDeepestChild(lParam, out x, out y);

            if (found != null)
            {
                found.sink.ToolkitMouseDown(MapToToolkitMouseButtons(wParam), MapMouseToToolkitKeys(wParam), 2, x, y, 0);
                //Console.WriteLine("DrawingWindow.DoubleClick " + found.sink + ",[" + x + "," + y + "], key:" + MapMouseToToolkitKeys(wParam) + ", button:" + MapToToolkitMouseButtons(wParam));
            }
        }
Exemplo n.º 8
0
 // Override the pointer motion event from Xsharp.
 protected override void OnPointerMotion
     (int x, int y, ModifierMask modifiers)
 {
     if (sink != null)
     {
         sink.ToolkitMouseMove
             (DrawingWindow.MapButton(button),
             DrawingWindow.MapKey(KeyName.XK_VoidSymbol, modifiers),
             0, x, y, 0);
     }
 }
Exemplo n.º 9
0
 // Override the button double click event from Xsharp.
 protected override void OnButtonDoubleClick
     (int x, int y, ButtonName button, ModifierMask modifiers)
 {
     if (sink != null)
     {
         sink.ToolkitMouseDown
             (DrawingWindow.MapButton(button),
             DrawingWindow.MapKey(KeyName.XK_VoidSymbol, modifiers),
             2, x, y, 0);
     }
 }
Exemplo n.º 10
0
 // Override the button release event from Xsharp.
 protected override void OnButtonRelease(int x, int y, ButtonName button,
                                         ModifierMask modifiers)
 {
     if (sink != null)
     {
         sink.ToolkitMouseUp
             (DrawingWindow.MapButton(button),
             DrawingWindow.MapKey(KeyName.XK_VoidSymbol, modifiers),
             1, x, y, 0);
     }
 }
Exemplo n.º 11
0
 // Returns whether a DrawingWindow is the parent of this window or is the window
 protected bool IsParentOf(DrawingWindow window)
 {
     for (DrawingWindow w = window; w != null; w = w.parent)
     {
         if (w == this)
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 12
0
 internal DrawingWindow DrawingWindow(IntPtr hwnd)
 {
     for (int i = 0; i < windowCount; i++)
     {
         DrawingWindow window = windows[i];
         if (window.hwnd == hwnd)
         {
             return(window);
         }
     }
     return(null);
 }
Exemplo n.º 13
0
        // Called when windows receives WM_MOUSEWHEEL
        internal void MouseWheel(int msg, int wParam, int lParam)
        {
            int           wheelDelta = (wParam >> 16) / 120;
            int           x, y;
            DrawingWindow found = FindDeepestChild(lParam, out x, out y);

            if (found != null)
            {
                found.sink.ToolkitMouseWheel(ToolkitMouseButtons.None, MapMouseToToolkitKeys(wParam), 0, x, y, wheelDelta);
                //Console.WriteLine("DrawingWindow.MouseWheel " + found.sink + " [" + x + "," + y + "], key:" + MapMouseToToolkitKeys(wParam) + ", wheel:" + wheelDelta);
            }
        }
Exemplo n.º 14
0
 // Handle a paint event from Xsharp.
 protected override void OnPaint(Xsharp.Graphics graphics)
 {
     if (sink != null)
     {
         System.Drawing.Region clip = DrawingWindow.RegionToDrawingRegion
                                          (graphics.ExposeRegion);
         DrawingGraphics g = new DrawingGraphics(toolkit, graphics);
         using (System.Drawing.Graphics gr =
                    ToolkitManager.CreateGraphics(g, clip))
         {
             sink.ToolkitExpose(gr);
         }
     }
 }
Exemplo n.º 15
0
        // Move this window underneath the last window with the same parent.
        void IToolkitWindow.Lower()
        {
            // Find the last window with the same parent as this.
            DrawingWindow toWindow = null;

            for (int to = toolkit.windowCount - 1; to >= 0; to--)
            {
                toWindow = toolkit.windows[to];
                if (parent.IsParentOf(toWindow))
                {
                    break;
                }
            }
            (this as IToolkitWindow).MoveToBelow(toWindow as IToolkitWindow);
            //Console.WriteLine("DrawingWindow.Lower, " + sink);
        }
Exemplo n.º 16
0
        protected virtual internal void ButtonDown(int msg, int wParam, int lParam)
        {
            int x, y;

            DrawingWindow found = FindDeepestChild(lParam, out x, out y);

            if (found != null)
            {
                found.sink.ToolkitMouseDown(MapToToolkitMouseButtons(wParam), MapMouseToToolkitKeys(wParam), 1, x, y, 0);
                //Console.WriteLine("DrawingWindow.ButtonDown " + found.sink + " [" + x + "," + y + "], key:" + MapMouseToToolkitKeys(wParam) + ", button:" + MapToToolkitMouseButtons(wParam));
            }
            else
            {
                CaptureTopLevel(null);
            }
        }
Exemplo n.º 17
0
 // Set the capture to the top most parent of a window, or release the capture.
 private void CaptureTopLevel(DrawingWindow window)
 {
     if (window == null)
     {
         if (toolkit.capturedTopWindow != null)
         {
             //Console.WriteLine("CaptureTopLevel, Releasing " + toolkit.capturedTopWindow);
             Win32.Api.ReleaseCapture();
             toolkit.capturedTopWindow = null;
         }
     }
     else if (toolkit.capturedTopWindow != window.topOfhierarchy)
     {
         Win32.Api.ReleaseCapture();
         Win32.Api.SetCapture(window.topOfhierarchy.hwnd);
         //Console.WriteLine("CaptureTopLevel, Switching " + toolkit.capturedTopWindow + " to " + window.topOfhierarchy);
         toolkit.capturedTopWindow = window.topOfhierarchy;
     }
 }
Exemplo n.º 18
0
 // Need to look at z-order so we can't do this ourselves yet..
 private DrawingWindow WindowFromPoint(int x, int y)
 {
     for (int i = toolkit.windowCount - 1; i >= 0; i--)
     {
         DrawingWindow         w   = toolkit.windows[i];
         DrawingTopLevelWindow top = w as DrawingTopLevelWindow;
         if (top != null)
         {
             if (top.outsideDimensions.Contains(x, y))
             {
                 return(w);
             }
         }
         else if (w.DimensionsScreen.Contains(x, y))
         {
             return(w);
         }
     }
     return(null);
 }
	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;
	}
Exemplo n.º 20
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;
 }
Exemplo n.º 21
0
        protected void SetTopOfHierarchy()
        {
            // Find all children windows and set their new top of hierarchy
            DrawingWindow newTopOfhierarchy;

            if (parent == null)
            {
                newTopOfhierarchy = this;
            }
            else
            {
                newTopOfhierarchy = (parent as DrawingWindow).topOfhierarchy;
            }
            for (int i = 0; i < toolkit.windowCount; i++)
            {
                DrawingWindow w = toolkit.windows[i];
                if (this.IsParentOf(w))
                {
                    w.topOfhierarchy = newTopOfhierarchy;
                }
            }
        }
	internal override int MouseActivate(DrawingWindow activateWindow)
	{
		return (int)Win32.Api.WM_MOUSEACTIVATEReturn.MA_NOACTIVATE;
	}
Exemplo n.º 23
0
        // Post Mouse Move to the window that needs it. Handle Mouse Enter and Leave
        protected internal virtual void MouseMove(int msg, int wParam, int lParam)
        {
            ToolkitMouseButtons buttons = MapToToolkitMouseButtons(wParam);
            ToolkitKeys         keys = MapMouseToToolkitKeys(wParam);
            int x, y;

            DrawingWindow actual;
            DrawingWindow found = FindDeepestChild(lParam, out x, out y, out actual);

            // Do Leave and Entered events.
            if (toolkit.enteredWindow != actual)
            {
                if (toolkit.enteredWindow != null)
                {
                    //Console.WriteLine("DrawingWindow.MouseLeave, " + toolkit.enteredWindow.sink);
                    toolkit.enteredWindow.sink.ToolkitMouseLeave();
                    toolkit.enteredWindow = null;
                }
                if (actual != null)
                {
                    //Console.WriteLine("DrawingWindow.MouseEnter, " + actual.sink);
                    toolkit.enteredWindow = actual;
                    actual.sink.ToolkitMouseEnter();
                }
            }

            // If there are no child windows to receive the captured input then give it to the window doing the capturing
            if (toolkit.capturedWindow != null && found == null)
            {
                found = toolkit.capturedWindow;
            }

            // If this is the first time over a window, set the capture and try again
            if (toolkit.capturedTopWindow == null)
            {
                if (toolkit.capturedWindow == null)
                {
                    CaptureTopLevel(this);
                    MouseMove(msg, wParam, lParam);
                }
                else
                {
                    CaptureTopLevel(toolkit.capturedWindow);
                }
                return;
            }

            Win32.Api.POINT mouse;
            mouse.x = MouseX(lParam) + DimensionsScreen.X;
            mouse.y = MouseY(lParam) + DimensionsScreen.Y;
            DrawingWindow actualWindow = toolkit.DrawingWindow(Win32.Api.WindowFromPoint(mouse));

            if (actualWindow != null && actualWindow.topOfhierarchy == toolkit.capturedTopWindow)
            {
                // On the window decorations.
                if (found == null)
                {
                    CaptureTopLevel(null);
                }
                else
                {
                    // Send the message to the client window
                    found.sink.ToolkitMouseMove(buttons, keys, 0, x, y, 0);
                }
                //Console.WriteLine("DrawingWindow.MouseMove, " + (actual==null?"null":actual.sink.ToString()) +", (" + x +", " + y +"), " + buttons +"," + keys );
            }
            else
            {
                if (toolkit.capturedWindow == null)
                {
                    CaptureTopLevel(null);
                }
                else
                {
                    found.sink.ToolkitMouseMove(buttons, keys, 0, x, y, 0);
                }
                // ?Send the last mouse move beyond the window (Win NT+ behaviour)
            }
        }
		public DrawingWindowBuffer(IToolkitWindow windowToBuffer)
		{
			window = windowToBuffer as DrawingWindow;
			CreateBuffer(windowToBuffer.Dimensions.Size);
		}
Exemplo n.º 25
0
	// Returns whether a DrawingWindow is the parent of this window or is the window
	protected bool IsParentOf(DrawingWindow window)
	{
		for (DrawingWindow w = window; w != null; w = w.parent)
			if (w == this)
				return true;
		return false;
	}
Exemplo n.º 26
0
	// Move the window at position from to position to
	// Also move all the children in the from windows hierarchy
	protected void MoveWindowTo(DrawingWindow fromWindow, DrawingWindow toWindow)
	{
		// Find the from position.
		int from;
		for (from = 0; from < toolkit.windowCount; from++)
		{
			if (toolkit.windows[from] == fromWindow)
				break;
		}
		// Find the to position.
		int to;
		for (to = 0; to < toolkit.windowCount; to++)
		{
			if (toolkit.windows[to] == toWindow)
				break;
		}
		if(to == toolkit.windowCount)
		{
			to--;
		}

		if (from == to + 1 || from == to)
			return;
		DrawingWindow[] move = new DrawingWindow[16];
		int nextMove = 0;
		int toPosition = to;
		// Move all children of "win" into the move array.
		// Mark the children with null if they have been moved.
		for (int i = from; i < toolkit.windowCount; i++)
		{
			DrawingWindow current = toolkit.windows[i];
			if (fromWindow.IsParentOf(current) || current == fromWindow)
			{
				if (nextMove == move.Length)
				{
					DrawingWindow[] newMove = new DrawingWindow[move.Length * 2];
					move.CopyTo(newMove, 0);
					move = newMove;
				}
				toolkit.windows[i] = null;
				move[nextMove++] = current;
				if (i <= toPosition)
				{
					to--;
				}
			}
		}

		// Fill in the null "holes".
		int nonNullItem = from;
		for(int i = from; i < toolkit.windowCount - nextMove; i++)
		{
			DrawingWindow window = toolkit.windows[i];
			// Make sure we fill it with the next non null window.
			for(;; nonNullItem++)
			{
				if (toolkit.windows[nonNullItem] != null)
				{
					toolkit.windows[i] = toolkit.windows[nonNullItem++];
					break;
				}
			}
		}

		// Make room for the new windows.
		Array.Copy(toolkit.windows,to + 1, toolkit.windows, to + 1 + nextMove, toolkit.windowCount - 1 - to - nextMove);
		// Copy the move entries after the to location.
		Array.Copy(move, 0, toolkit.windows , to + 1, nextMove);
	}
Exemplo n.º 27
0
 public DrawingWindowBuffer(IToolkitWindow windowToBuffer)
 {
     window = windowToBuffer as DrawingWindow;
     CreateBuffer(windowToBuffer.Dimensions.Size);
 }
Exemplo n.º 28
0
 // Set the cursor.  The toolkit may ignore "frame" if it already
 // has a system-defined association for "cursorType".  Setting
 // "cursorType" to "ToolkitCursorType.InheritParent" will reset
 // the cursor to be the same as the parent window's.
 void IToolkitWindow.SetCursor(ToolkitCursorType cursorType, Frame frame)
 {
     DrawingWindow.ModifyCursor(this, cursorType, frame);
 }
Exemplo n.º 29
0
        // Returns the bottom child window that is underneath x, y and that has a top level window of capturedTopWindow or capturedWindow (if some window has captured the mouse). The window must be visible and toplevelwindows decorations are excluded. Returns x and y relative to the found windows coordinates.
        private DrawingWindow FindDeepestChild(int lParam, out int x, out int y, out DrawingWindow actualFound)
        {
            // Convert the mouse to screen coordinates
            Point pt = DimensionsScreen.Location;

            x = MouseX(lParam) + pt.X;
            y = MouseY(lParam) + pt.Y;

            DrawingWindow found = null;

            // Child windows lower down the hierarchy will always be last in the windows list
            for (int i = toolkit.windowCount - 1; i >= 0; i--)
            {
                DrawingWindow w = toolkit.windows[i];
                if (!w.visible || !w.Visible)
                {
                    continue;
                }
                if (toolkit.capturedWindow == null)
                {
                    if (toolkit.capturedTopWindow == w.topOfhierarchy)
                    {
                        // This will occur when the mouse is over the titlebar of a toplevel window.
                        if (w.DimensionsScreen.Contains(x, y))
                        {
                            found = w;
                            break;
                        }
                        else if (w is DrawingTopLevelWindow && w.outsideDimensions.Contains(x, y))
                        {
                            actualFound = null;
                            return(null);
                        }
                    }
                }
                else
                {
                    if (toolkit.capturedWindow.IsParentOf(w) && w.DimensionsScreen.Contains(x, y))
                    {
                        found = w;
                        break;
                    }
                }
            }

            actualFound = found;
            // If there are no child windows to receive the captured input then give it to the window doing the capturing
            if (toolkit.capturedWindow != null && found == null)
            {
                found = toolkit.capturedWindow;
            }

            if (found != null)
            {
                // Adjust the coordinates relative to the "found" window.
                Rectangle child = found.DimensionsScreen;
                x -= child.X;
                y -= child.Y;
            }
            return(found);
        }
Exemplo n.º 30
0
	internal virtual int MouseActivate(DrawingWindow activateWindow)
	{
		//Console.WriteLine("DrawingWindow.MouseActivate, " + sink +"," + activateWindow.sink);
		if (activateWindow is DrawingPopupWindow)
			return (int)Win32.Api.WM_MOUSEACTIVATEReturn.MA_NOACTIVATE;
		return (int)Win32.Api.WM_MOUSEACTIVATEReturn.MA_ACTIVATE;
	}
Exemplo n.º 31
0
	// Set the capture to the top most parent of a window, or release the capture.
	private void CaptureTopLevel(DrawingWindow window)
	{
			if (window == null)
			{
				if (toolkit.capturedTopWindow != null)
				{
					//Console.WriteLine("CaptureTopLevel, Releasing " + toolkit.capturedTopWindow);
					Win32.Api.ReleaseCapture();
					toolkit.capturedTopWindow = null;
				}
			}
			else if (toolkit.capturedTopWindow != window.topOfhierarchy)
			{
				Win32.Api.ReleaseCapture();
				Win32.Api.SetCapture(window.topOfhierarchy.hwnd);
				//Console.WriteLine("CaptureTopLevel, Switching " + toolkit.capturedTopWindow + " to " + window.topOfhierarchy);
				toolkit.capturedTopWindow = window.topOfhierarchy;
			}
	}
Exemplo n.º 32
0
	// Returns the bottom child window that is underneath x, y and that has a top level window of capturedTopWindow or capturedWindow (if some window has captured the mouse). The window must be visible and toplevelwindows decorations are excluded. Returns x and y relative to the found windows coordinates.
	private DrawingWindow FindDeepestChild(int lParam, out int x, out int y, out DrawingWindow actualFound)
	{
		// Convert the mouse to screen coordinates
		Point pt = DimensionsScreen.Location;
		x = MouseX(lParam) + pt.X;
		y = MouseY(lParam) + pt.Y;

		DrawingWindow found = null;

		// Child windows lower down the hierarchy will always be last in the windows list
		for (int i = toolkit.windowCount - 1; i >= 0; i--)
		{
			DrawingWindow w = toolkit.windows[i];
			if (!w.visible || !w.Visible)
				continue;
			if (toolkit.capturedWindow == null)
			{
				if (toolkit.capturedTopWindow == w.topOfhierarchy)
				{
					// This will occur when the mouse is over the titlebar of a toplevel window.
					if (w.DimensionsScreen.Contains(x, y))
					{
						found = w;
						break;
					}
					else if (w is DrawingTopLevelWindow && w.outsideDimensions.Contains(x,y))
					{
						actualFound = null;
						return null;
					}
				}
			}
			else
			{
				if (toolkit.capturedWindow.IsParentOf(w) && w.DimensionsScreen.Contains(x,y))
				{
					found = w;
					break;
				}
			}
		}

		actualFound = found;
		// If there are no child windows to receive the captured input then give it to the window doing the capturing
		if (toolkit.capturedWindow != null && found == null)
			found = toolkit.capturedWindow;
	
		if (found != null)
		{
			// Adjust the coordinates relative to the "found" window.
			Rectangle child = found.DimensionsScreen;
			x -= child.X;
			y -= child.Y;
		}
		return found;
	}
Exemplo n.º 33
0
        // Move the window at position from to position to
        // Also move all the children in the from windows hierarchy
        protected void MoveWindowTo(DrawingWindow fromWindow, DrawingWindow toWindow)
        {
            // Find the from position.
            int from;

            for (from = 0; from < toolkit.windowCount; from++)
            {
                if (toolkit.windows[from] == fromWindow)
                {
                    break;
                }
            }
            // Find the to position.
            int to;

            for (to = 0; to < toolkit.windowCount; to++)
            {
                if (toolkit.windows[to] == toWindow)
                {
                    break;
                }
            }
            if (to == toolkit.windowCount)
            {
                to--;
            }

            if (from == to + 1 || from == to)
            {
                return;
            }
            DrawingWindow[] move       = new DrawingWindow[16];
            int             nextMove   = 0;
            int             toPosition = to;

            // Move all children of "win" into the move array.
            // Mark the children with null if they have been moved.
            for (int i = from; i < toolkit.windowCount; i++)
            {
                DrawingWindow current = toolkit.windows[i];
                if (fromWindow.IsParentOf(current) || current == fromWindow)
                {
                    if (nextMove == move.Length)
                    {
                        DrawingWindow[] newMove = new DrawingWindow[move.Length * 2];
                        move.CopyTo(newMove, 0);
                        move = newMove;
                    }
                    toolkit.windows[i] = null;
                    move[nextMove++]   = current;
                    if (i <= toPosition)
                    {
                        to--;
                    }
                }
            }

            // Fill in the null "holes".
            int nonNullItem = from;

            for (int i = from; i < toolkit.windowCount - nextMove; i++)
            {
                DrawingWindow window = toolkit.windows[i];
                // Make sure we fill it with the next non null window.
                for (;; nonNullItem++)
                {
                    if (toolkit.windows[nonNullItem] != null)
                    {
                        toolkit.windows[i] = toolkit.windows[nonNullItem++];
                        break;
                    }
                }
            }

            // Make room for the new windows.
            Array.Copy(toolkit.windows, to + 1, toolkit.windows, to + 1 + nextMove, toolkit.windowCount - 1 - to - nextMove);
            // Copy the move entries after the to location.
            Array.Copy(move, 0, toolkit.windows, to + 1, nextMove);
        }
Exemplo n.º 34
0
	// Set the child right next to the parent in the heirarchy sure the parent window is before the child.
	// Set the correct TopOfHierarchy for all the childwindows.
	protected internal void ReparentOwn(DrawingWindow parent)
	{
		SetTopOfHierarchy();
		this.parent = parent;
		if (parent != null)
			MoveWindowTo(this, parent);
	}
Exemplo n.º 35
0
 internal override int MouseActivate(DrawingWindow activateWindow)
 {
     return((int)Win32.Api.WM_MOUSEACTIVATEReturn.MA_NOACTIVATE);
 }
Exemplo n.º 36
0
	// Add a new DrawingWindow and make room if necessary
	internal void AddWindow(DrawingWindow window, DrawingWindow parent)
	{
		if (windows.Length == windowCount)
		{
			DrawingWindow[] newWindows = new DrawingWindow[windows.Length * 2];
			windows.CopyTo(newWindows, 0);
			windows = newWindows;
		}
		windows[windowCount++] = window;
	}