// 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 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); }
// 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); }
// 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); }
// 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); }
//WM_WINDOWPOSCHANGING internal void WindowPosChanging(int lParam) { //When window is created - CreateWindow(), WindowPosChanging is called when the initial size is set //because sink==null, its size and position will be set if (sink != null) { //TODO Pointers are not available yet //Win32.Api.WINDOWPOS *pos = (Win32.Api.WINDOWPOS*)lParam; Win32.Api.WINDOWPOS pos = (Win32.Api.WINDOWPOS)Marshal.PtrToStructure(new IntPtr(lParam), typeof(Win32.Api.WINDOWPOS)); if (suspendExternalMoveResizeNotify) { return; } // If moving if (((Win32.Api.SetWindowsPosFlags)pos.flags & Win32.Api.SetWindowsPosFlags.SWP_NOMOVE) == 0) { int leftAdjust, topAdjust, rightAdjust, bottomAdjust; Toolkit.GetWindowAdjust(out leftAdjust, out topAdjust, out rightAdjust, out bottomAdjust, flags); sink.ToolkitExternalMove(pos.x + leftAdjust, pos.y + topAdjust); } // If sizing if (((Win32.Api.SetWindowsPosFlags)pos.flags & Win32.Api.SetWindowsPosFlags.SWP_NOSIZE) == 0) { int leftAdjust, topAdjust, rightAdjust, bottomAdjust; Toolkit.GetWindowAdjust(out leftAdjust, out topAdjust, out rightAdjust, out bottomAdjust, flags); int width = pos.cx; int height = pos.cy; DrawingTopLevelWindow form = this as DrawingTopLevelWindow; // Restrict the size if necessary. if (form != null) { if (form.minimumSize != Size.Empty) { if (width < form.minimumSize.Width) { width = form.minimumSize.Width; } if (height < form.minimumSize.Height) { height = form.minimumSize.Height; } } if (form.maximumSize != Size.Empty) { if (width > form.maximumSize.Width) { width = form.maximumSize.Width; } if (height > form.maximumSize.Height) { height = form.maximumSize.Height; } } } sink.ToolkitExternalResize(width - leftAdjust - rightAdjust, height - topAdjust - bottomAdjust); } // Now prevent windows from changing the position or size, System.Windows.Control will do that //TODO Pointers are not available yet //pos.flags |= (uint)0x3; Marshal.WriteInt32(new IntPtr(lParam), 24, (int)pos.flags | 0x3); } }
// 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 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; }