cp.Style = (int)(WindowStyles.WS_CLIPCHILDREN | WindowStyles.WS_CLIPSIBLINGS);
+ if (Parent != null) {
+ cp.Parent = Parent.Handle;
+ cp.Style |= (int) WindowStyles.WS_CHILD;
+ }
+
if (IsMdiChild) {
cp.Style |= (int)(WindowStyles.WS_CHILD | WindowStyles.WS_CAPTION);
if (Parent != null) {
}
}
}
+#if NET_2_0
+ [MonoTODO ("Implemented for Win32, needs X11 implementation")]
+ protected virtual bool ShowWithoutActivation {
+ get { return false; }
+ }
+#endif
#endregion // Protected Instance Properties
#region Public Static Methods
}
if (owner == this) {
- throw new InvalidOperationException("The 'ownerWin32' cannot be the form being shown.");
+ throw new ArgumentException ("Forms cannot own themselves or their owners.", "owner");
}
if (is_modal) {
- throw new InvalidOperationException("The form is already displayed as a modal dialog.");
+ throw new InvalidOperationException ("The form is already displayed as a modal dialog.");
}
if (Visible) {
- throw new InvalidOperationException("Already visible forms cannot be displayed as a modal dialog. Set the Visible property to 'false' prior to calling Form.ShowDialog.");
+ throw new InvalidOperationException ("Forms that are already "
+ + " visible cannot be displayed as a modal dialog. Set the"
+ + " form's visible property to false before calling"
+ + " ShowDialog.");
}
if (!Enabled) {
- throw new InvalidOperationException("Cannot display a disabled form as modal dialog.");
+ throw new InvalidOperationException ("Forms that are not enabled"
+ + " cannot be displayed as a modal dialog. Set the form's"
+ + " enabled property to true before calling ShowDialog.");
}
if (TopLevelControl != this) {
- throw new InvalidOperationException("Can only display TopLevel forms as modal dialog.");
+ throw new InvalidOperationException ("Forms that are not top level"
+ + " forms cannot be displayed as a modal dialog. Remove the"
+ + " form from any parent form before calling ShowDialog.");
}
#if broken
}
}
+ if (this.ShowWithoutActivation)
+ Hwnd.ObjectFromHandle (this.Handle).no_activate = true;
+
XplatUI.SetWindowMinMax(window.Handle, maximized_bounds, minimum_size, maximum_size);
if ((FormBorderStyle != FormBorderStyle.FixedDialog) && (icon != null)) {
XplatUI.SetIcon(window.Handle, icon);
}
// Menu drawing
- case Msg.WM_NCLBUTTONDOWN: {
+ case Msg.WM_NCHITTEST: {
+ if (XplatUI.IsEnabled (Handle) && ActiveMenu != null) {
+ int x = LowOrder ((int)m.LParam.ToInt32 ());
+ int y = HighOrder ((int)m.LParam.ToInt32 ());
+
+ XplatUI.ScreenToMenu (ActiveMenu.Wnd.window.Handle, ref x, ref y);
+
+ // If point is under menu return HTMENU, it prevents Win32 to return HTMOVE.
+ if ((x > 0) && (y > 0) && (x < ActiveMenu.Rect.Width) && (y < ActiveMenu.Rect.Height)) {
+ m.Result = new IntPtr ((int)HitTest.HTMENU);
+ return;
+ }
+ }
+
+ base.WndProc (ref m);
+ return;
+ }
+
+ case Msg.WM_NCLBUTTONDOWN: {
if (XplatUI.IsEnabled (Handle) && ActiveMenu != null) {
ActiveMenu.OnMouseDown(this, new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()), mouse_clicks, Control.MousePosition.X, Control.MousePosition.Y, 0));
}
base.WndProc(ref m);
return;
}
- case Msg.WM_NCLBUTTONUP: {
+
+ case Msg.WM_NCLBUTTONUP: {
if (ActiveMaximizedMdiChild != null) {
ActiveMaximizedMdiChild.HandleMenuMouseUp (ActiveMenu,
LowOrder ((int)m.LParam.ToInt32 ()),
active_tracker.OnMouseDown(new MouseEventArgs (args.Button, args.Clicks, Control.MousePosition.X, Control.MousePosition.Y, args.Delta));
return;
}
- base.WndProc(ref m);
+#if NET_2_0
+ ToolStripManager.FireAppClicked ();
+#endif
+ base.WndProc (ref m);
return;
}