private static void DisableFormsForModalLoop(Queue toplevels, ApplicationContext context) { Form f; lock (forms) { IEnumerator control = forms.GetEnumerator(); while (control.MoveNext()) { f = (Form)control.Current; // Don't disable the main form. if (f == context.MainForm) { continue; } // Don't disable any children of the main form. // These do not have to be MDI children. Control current = f; bool is_child_of_main = false;; do { if (current.Parent == context.MainForm) { is_child_of_main = true; break; } current = current.Parent; }while (current != null); if (is_child_of_main) { continue; } // Disable the rest if (f.IsHandleCreated && XplatUI.IsEnabled(f.Handle)) { #if DebugRunLoop Console.WriteLine(" Disabling form {0}", f); #endif XplatUI.EnableWindow(f.Handle, false); toplevels.Enqueue(f); } } } }
protected virtual bool HandleNCLButtonDown(ref Message m) { Activate(); start = Cursor.Position; virtual_position = form.Bounds; int x = Control.LowOrder((int)m.LParam.ToInt32()); int y = Control.HighOrder((int)m.LParam.ToInt32()); // Need to adjust because we are in NC land NCPointToClient(ref x, ref y); FormPos pos = FormPosForCoords(x, y); if (form.ActiveMenu != null && XplatUI.IsEnabled(form.Handle)) { MouseEventArgs mea = new MouseEventArgs(Form.FromParamToMouseButtons(m.WParam.ToInt32()), form.mouse_clicks, x, y - TitleBarHeight, 0); form.ActiveMenu.OnMouseDown(form, mea); } if (pos == FormPos.TitleBar) { HandleTitleBarDown(x, y); return(true); } if (IsSizable) { if ((pos & FormPos.AnyEdge) == 0) { return(false); } virtual_position = form.Bounds; state = State.Sizing; sizing_edge = pos; form.Capture = true; return(true); } return(false); }
protected virtual bool HandleNCMouseMove(ref Message m) { int x = Control.LowOrder((int)m.LParam.ToInt32( )); int y = Control.HighOrder((int)m.LParam.ToInt32( )); NCPointToClient(ref x, ref y); FormPos pos = FormPosForCoords(x, y); if (pos == FormPos.TitleBar) { HandleTitleBarMouseMove(x, y); return(true); } if (form.ActiveMenu != null && XplatUI.IsEnabled(form.Handle)) { MouseEventArgs mea = new MouseEventArgs(Form.FromParamToMouseButtons(m.WParam.ToInt32()), form.mouse_clicks, x, y, 0); form.ActiveMenu.OnMouseMove(form, mea); } return(true); }