LowOrder() static private method

static private LowOrder ( int param ) : int
param int
return int
Example #1
0
        protected override bool HandleLButtonDown(ref Message m)
        {
            int x = Control.LowOrder((int)m.LParam.ToInt32());
            int y = Control.HighOrder((int)m.LParam.ToInt32());

            // Correct y since we are in NC land.
            NCClientToNC(ref x, ref y);

            if (IconRectangleContains(x, y))
            {
                if ((DateTime.Now - icon_clicked_time).TotalMilliseconds <= SystemInformation.DoubleClickTime)
                {
                    if (icon_popup_menu != null && icon_popup_menu.Wnd != null)
                    {
                        icon_popup_menu.Wnd.Hide();
                    }
                    form.Close();
                    return(true);
                }
                else if (form.Capture)
                {
                    icon_dont_show_popup = true;
                }
            }
            return(base.HandleLButtonDown(ref m));
        }
Example #2
0
        private bool HandleNCLButtonUp(ref Message m)
        {
            if (form.Capture)
            {
                ClearVirtualPosition();

                form.Capture = false;
                state        = State.Idle;
                if (form.MdiContainer != null)
                {
                    form.MdiContainer.SizeScrollBars();
                }
            }

            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)
            {
                HandleTitleBarUp(x, y);
                return(true);
            }

            return(true);
        }
Example #3
0
        protected virtual bool HandleNCHitTest(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)
            {
                m.Result = new IntPtr((int)HitTest.HTCAPTION);
                return(true);
            }

            if (!IsSizable)
            {
                return(false);
            }

            switch (pos)
            {
            case FormPos.Top:
                m.Result = new IntPtr((int)HitTest.HTTOP);
                break;

            case FormPos.Left:
                m.Result = new IntPtr((int)HitTest.HTLEFT);
                break;

            case FormPos.Right:
                m.Result = new IntPtr((int)HitTest.HTRIGHT);
                break;

            case FormPos.Bottom:
                m.Result = new IntPtr((int)HitTest.HTBOTTOM);
                break;

            case FormPos.TopLeft:
                m.Result = new IntPtr((int)HitTest.HTTOPLEFT);
                break;

            case FormPos.TopRight:
                m.Result = new IntPtr((int)HitTest.HTTOPRIGHT);
                break;

            case FormPos.BottomLeft:
                m.Result = new IntPtr((int)HitTest.HTBOTTOMLEFT);
                break;

            case FormPos.BottomRight:
                m.Result = new IntPtr((int)HitTest.HTBOTTOMRIGHT);
                break;

            default:
                // We return false so that DefWndProc handles things
                return(false);
            }
            return(true);
        }
Example #4
0
        protected virtual void HandleNCLButtonDblClick(ref Message m)
        {
            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 (pos == FormPos.TitleBar || pos == FormPos.Top)
            {
                HandleTitleBarDoubleClick(x, y);
            }
        }
Example #5
0
        protected virtual bool HandleNCMouseLeave(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)
            {
                HandleTitleBarLeave(x, y);
                return(true);
            }

            return(true);
        }
Example #6
0
        protected override bool HandleLButtonDblClick(ref Message m)
        {
            int x = Control.LowOrder((int)m.LParam.ToInt32());
            int y = Control.HighOrder((int)m.LParam.ToInt32());

            // Correct since we are in NC land.
            NCClientToNC(ref x, ref y);

            if (IconRectangleContains(x, y))
            {
                icon_popup_menu.Wnd.Hide();
                form.Close();
                return(true);
            }

            return(base.HandleLButtonDblClick(ref m));
        }
Example #7
0
        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);
        }
Example #8
0
        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);
        }
        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 (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);
        }
Example #10
0
        public virtual bool WndProc(ref Message m)
        {
#if debug
            Console.WriteLine(DateTime.Now.ToLongTimeString() + " " + this.GetType().Name + " (Handle={0},Text={1}) received message {2}", form.IsHandleCreated ? form.Handle : IntPtr.Zero, form.Text, m.ToString());
#endif

            switch ((Msg)m.Msg)
            {
            // The mouse handling messages are actually
            // not WM_NC* messages except for the first button and NCMOVEs
            // down because we capture on the form

            case Msg.WM_MOUSEMOVE:
                return(HandleMouseMove(form, ref m));

            case Msg.WM_LBUTTONUP:
                HandleLButtonUp(ref m);
                break;

            case Msg.WM_RBUTTONDOWN:
                return(HandleRButtonDown(ref m));

            case Msg.WM_LBUTTONDOWN:
                return(HandleLButtonDown(ref m));

            case Msg.WM_LBUTTONDBLCLK:
                return(HandleLButtonDblClick(ref m));

            case Msg.WM_PARENTNOTIFY:
                if (Control.LowOrder(m.WParam.ToInt32()) == (int)Msg.WM_LBUTTONDOWN)
                {
                    Activate();
                }
                break;

            case Msg.WM_NCHITTEST:
                return(HandleNCHitTest(ref m));

            // Return true from these guys, otherwise win32 will mess up z-order
            case Msg.WM_NCLBUTTONUP:
                HandleNCLButtonUp(ref m);
                return(true);

            case Msg.WM_NCLBUTTONDOWN:
                HandleNCLButtonDown(ref m);
                return(true);

            case Msg.WM_NCMOUSEMOVE:
                HandleNCMouseMove(ref m);
                return(true);

            case Msg.WM_NCLBUTTONDBLCLK:
                HandleNCLButtonDblClick(ref m);
                break;

            case Msg.WM_NCMOUSELEAVE:
                HandleNCMouseLeave(ref m);
                break;

            case Msg.WM_MOUSELEAVE:
                HandleMouseLeave(ref m);
                break;

            case Msg.WM_NCCALCSIZE:
                return(HandleNCCalcSize(ref m));

            case Msg.WM_NCPAINT:
                return(HandleNCPaint(ref m));
            }

            return(false);
        }