protected override void WndProc(ref Message m) {
     if((MessageParent != IntPtr.Zero) && (((m.Msg == WM.INITMENUPOPUP) || (m.Msg == WM.DRAWITEM)) || (m.Msg == WM.MEASUREITEM))) {
         PInvoke.SendMessage(MessageParent, (uint)m.Msg, m.WParam, m.LParam);
     }
     else {
         if(m.Msg == WM.MOUSELEAVE) {
             if(fCancelClosingAncestors) {
                 return;
             }
         }
         else if(m.Msg == WM.MOUSEFIRST) {
             if(fSuppressMouseMove_Scroll) {
                 m.Result = IntPtr.Zero;
                 return;
             }
             if(fSuppressMouseMove) {
                 if(MouseDragMove != null) {
                     MouseDragMove(this, new MouseEventArgs(MouseButtons, 0, QTUtility2.GET_X_LPARAM(m.LParam), QTUtility2.GET_Y_LPARAM(m.LParam), 0));
                 }
                 return;
             }
             if(fSuppressMouseMoveOnce) {
                 fSuppressMouseMoveOnce = false;
                 return;
             }
         }
         base.WndProc(ref m);
     }
 }
Beispiel #2
0
        public override void HandleF2()
        {
            IntPtr hWnd = GetEditControl();

            if (hWnd == IntPtr.Zero)
            {
                return;
            }
            string str;

            using (SafePtr lParam = new SafePtr(520)) {
                if (0 >= ((int)PInvoke.SendMessage(hWnd, 13, (IntPtr)260, lParam)))
                {
                    return;
                }
                str = Marshal.PtrToStringUni(lParam);
            }
            if (str.Length <= 2)
            {
                return;
            }
            int num = str.LastIndexOf(".");

            if (num != -1)
            {
                IntPtr ptr3   = PInvoke.SendMessage(hWnd, 0xb0, IntPtr.Zero, IntPtr.Zero);
                int    start  = QTUtility2.GET_X_LPARAM(ptr3);
                int    length = QTUtility2.GET_Y_LPARAM(ptr3);
                if ((length - start) >= 0)
                {
                    if ((start == 0) && (length == num))
                    {
                        start = length = num;
                    }
                    else if ((start == length) && (length == num))
                    {
                        start  = num + 1;
                        length = str.Length;
                    }
                    else if ((start == (num + 1)) && (length == str.Length))
                    {
                        start  = 0;
                        length = -1;
                    }
                    else if ((start == 0) && (length == str.Length))
                    {
                        start  = 0;
                        length = 0;
                    }
                    else
                    {
                        start  = 0;
                        length = num;
                    }
                    PInvoke.SendMessage(hWnd, 0xb1, (IntPtr)start, (IntPtr)length);
                }
            }
        }
Beispiel #3
0
        protected override void WndProc(ref Message m)
        {
            try {
                QMenuItem ownerItem;
                if (!this.fRespondModKeys)
                {
                    base.WndProc(ref m);
                    return;
                }
                int wParam = (int)((long)m.WParam);
                switch (m.Msg)
                {
                case WM.KEYDOWN:
                    break;

                case WM.KEYUP:
                    if (this.fOnceKeyDown && ((wParam == 0x10) || (wParam == 0x11)))
                    {
                        bool flag2 = false;
                        foreach (QMenuItem item4 in this.lstQMIResponds)
                        {
                            if (!item4.Selected)
                            {
                                continue;
                            }
                            if (item4.Enabled)
                            {
                                Keys modifierKeys = Control.ModifierKeys;
                                if (modifierKeys == Keys.Control)
                                {
                                    item4.ImageKey = "control";
                                }
                                else if (this.fEnableShiftKey && (modifierKeys == Keys.Shift))
                                {
                                    item4.ImageKey = "shift";
                                }
                                else
                                {
                                    item4.RestoreOriginalImage(this.fChangeImageSelected, false);
                                }
                                this.lastKeyImageChangedItem = item4;
                            }
                            flag2 = true;
                            break;
                        }
                        ownerItem = base.OwnerItem as QMenuItem;
                        if (ownerItem != null)
                        {
                            DropDownMenuBase owner = ownerItem.Owner as DropDownMenuBase;
                            if ((owner != null) && owner.Visible)
                            {
                                if (flag2)
                                {
                                    PInvoke.SendMessage(owner.Handle, 0x2a3, IntPtr.Zero, IntPtr.Zero);
                                }
                                else
                                {
                                    QTUtility2.SendCOPYDATASTRUCT(owner.Handle, (IntPtr)wParam, string.Empty, (IntPtr)1);
                                }
                            }
                        }
                    }
                    goto Label_07C2;

                case WM.MOUSEMOVE:
                    goto Label_0562;

                case WM.MOUSELEAVE:
                    goto Label_072E;

                case WM.PAINT:
                    if (this.fSuspendPainting)
                    {
                        PInvoke.ValidateRect(m.HWnd, IntPtr.Zero);
                    }
                    else
                    {
                        base.WndProc(ref m);
                    }
                    return;

                case WM.COPYDATA: {
                    QTTabBarLib.Interop.COPYDATASTRUCT copydatastruct = (QTTabBarLib.Interop.COPYDATASTRUCT)Marshal.PtrToStructure(m.LParam, typeof(QTTabBarLib.Interop.COPYDATASTRUCT));
                    ownerItem = base.GetItemAt(base.PointToClient(Control.MousePosition)) as QMenuItem;
                    if (!(copydatastruct.dwData == IntPtr.Zero))
                    {
                        goto Label_04B6;
                    }
                    if (ownerItem == null)
                    {
                        goto Label_0462;
                    }
                    Keys keys3 = Control.ModifierKeys;
                    if ((wParam == 0x11) && ((keys3 & Keys.Shift) != Keys.Shift))
                    {
                        ownerItem.ImageKey = "control";
                    }
                    else if ((this.fEnableShiftKey && (wParam == 0x10)) && ((keys3 & Keys.Control) != Keys.Control))
                    {
                        ownerItem.ImageKey = "shift";
                    }
                    else
                    {
                        ownerItem.RestoreOriginalImage(this.fChangeImageSelected, false);
                    }
                    this.lastKeyImageChangedItem = ownerItem;
                    goto Label_07C2;
                }

                default:
                    goto Label_07C2;
                }
                this.fOnceKeyDown = true;
                if ((((int)((long)m.LParam)) & 0x40000000) == 0)
                {
                    if ((wParam == 0x10) || (wParam == 0x11))
                    {
                        bool flag = false;
                        foreach (QMenuItem item2 in this.lstQMIResponds)
                        {
                            if (!item2.Selected)
                            {
                                continue;
                            }
                            if (item2.Enabled)
                            {
                                Keys keys = Control.ModifierKeys;
                                if ((wParam == 0x11) && ((keys & Keys.Shift) != Keys.Shift))
                                {
                                    item2.ImageKey = "control";
                                }
                                else if ((this.fEnableShiftKey && (wParam == 0x10)) && ((keys & Keys.Control) != Keys.Control))
                                {
                                    item2.ImageKey = "shift";
                                }
                                else
                                {
                                    item2.RestoreOriginalImage(this.fChangeImageSelected, false);
                                }
                                this.lastKeyImageChangedItem = item2;
                            }
                            flag = true;
                            break;
                        }
                        ownerItem = base.OwnerItem as QMenuItem;
                        if (ownerItem != null)
                        {
                            DropDownMenuBase base2 = ownerItem.Owner as DropDownMenuBase;
                            if ((base2 != null) && base2.Visible)
                            {
                                if (flag)
                                {
                                    PInvoke.SendMessage(base2.Handle, 0x2a3, IntPtr.Zero, IntPtr.Zero);
                                }
                                else
                                {
                                    QTUtility2.SendCOPYDATASTRUCT(base2.Handle, (IntPtr)wParam, string.Empty, IntPtr.Zero);
                                }
                            }
                        }
                    }
                    else if ((wParam == 13) && ((this.fEnableShiftKey && (Control.ModifierKeys == Keys.Shift)) || (Control.ModifierKeys == Keys.Control)))
                    {
                        foreach (ToolStripItem item3 in this.Items)
                        {
                            if (item3.Selected)
                            {
                                if (item3.Enabled)
                                {
                                    this.OnItemClicked(new ToolStripItemClickedEventArgs(item3));
                                }
                                break;
                            }
                        }
                    }
                }
                goto Label_07C2;
Label_0462:
                ownerItem = base.OwnerItem as QMenuItem;
                if (ownerItem != null)
                {
                    DropDownMenuBase base4 = ownerItem.Owner as DropDownMenuBase;
                    if ((base4 != null) && base4.Visible)
                    {
                        QTUtility2.SendCOPYDATASTRUCT(base4.Handle, (IntPtr)wParam, string.Empty, IntPtr.Zero);
                    }
                }
                goto Label_07C2;
Label_04B6:
                if (ownerItem != null)
                {
                    Keys keys4 = Control.ModifierKeys;
                    if (keys4 == Keys.Control)
                    {
                        ownerItem.ImageKey = "control";
                    }
                    else if (this.fEnableShiftKey && (keys4 == Keys.Shift))
                    {
                        ownerItem.ImageKey = "shift";
                    }
                    else
                    {
                        ownerItem.RestoreOriginalImage(this.fChangeImageSelected, false);
                    }
                    this.lastKeyImageChangedItem = ownerItem;
                }
                else
                {
                    ownerItem = base.OwnerItem as QMenuItem;
                    if (ownerItem != null)
                    {
                        DropDownMenuBase base5 = ownerItem.Owner as DropDownMenuBase;
                        if ((base5 != null) && base5.Visible)
                        {
                            QTUtility2.SendCOPYDATASTRUCT(base5.Handle, (IntPtr)wParam, string.Empty, (IntPtr)1);
                        }
                    }
                }
                goto Label_07C2;
Label_0562:
                if ((m.WParam == IntPtr.Zero) && (m.LParam == this.lparamPreviousMouseMove))
                {
                    m.Result = IntPtr.Zero;
                    return;
                }
                this.lparamPreviousMouseMove = m.LParam;
                if ((!this.fEnableShiftKey || ((wParam & 4) != 4)) && (((wParam & 8) != 8) && !this.fChangeImageSelected))
                {
                    goto Label_07C2;
                }
                ToolStripItem itemAt = base.GetItemAt(new Point(QTUtility2.GET_X_LPARAM(m.LParam), QTUtility2.GET_Y_LPARAM(m.LParam)));
                if (itemAt == null)
                {
                    base.WndProc(ref m);
                    return;
                }
                ownerItem = itemAt as QMenuItem;
                if (!IsQmiResponds(ownerItem))
                {
                    goto Label_06F8;
                }
                if (ownerItem == this.lastMouseActiveItem)
                {
                    goto Label_07C2;
                }
                if (this.lstQMIResponds.Count > 0x1c)
                {
                    this.fSuspendPainting = true;
                }
                base.SuspendLayout();
                if (ownerItem.Enabled)
                {
                    switch (wParam)
                    {
                    case 8:
                        ownerItem.ImageKey = "control";
                        goto Label_06AB;

                    case 4:
                        ownerItem.ImageKey = "shift";
                        goto Label_06AB;
                    }
                    if (((ownerItem.Genre == MenuGenre.Navigation) && (ownerItem.MenuItemArguments != null)) && (!ownerItem.MenuItemArguments.IsBack || (ownerItem.MenuItemArguments.Index != 0)))
                    {
                        ownerItem.ImageKey = ownerItem.MenuItemArguments.IsBack ? "back" : "forward";
                    }
                    else
                    {
                        ownerItem.RestoreOriginalImage();
                    }
                }
Label_06AB:
                if (this.lastMouseActiveItem != null)
                {
                    this.lastMouseActiveItem.RestoreOriginalImage();
                }
                if ((ownerItem != this.lastKeyImageChangedItem) && (this.lastKeyImageChangedItem != null))
                {
                    this.lastKeyImageChangedItem.RestoreOriginalImage();
                    this.lastKeyImageChangedItem = null;
                }
                this.lastMouseActiveItem = ownerItem;
                this.fSuspendPainting    = false;
                base.ResumeLayout(false);
                goto Label_07C2;
Label_06F8:
                if (this.lastMouseActiveItem != null)
                {
                    this.lastMouseActiveItem.RestoreOriginalImage();
                    this.lastMouseActiveItem = null;
                }
                if (this.lastKeyImageChangedItem != null)
                {
                    this.lastKeyImageChangedItem.RestoreOriginalImage();
                    this.lastKeyImageChangedItem = null;
                }
                goto Label_07C2;
Label_072E:
                this.ResetImageKeys();
                if (this.lastMouseActiveItem != null)
                {
                    this.lastMouseActiveItem = null;
                }
            }
            catch (Exception exception) {
                QTUtility2.MakeErrorLog(exception, "MSG:" + m.Msg.ToString("X") + ", WPARAM:" + m.WParam.ToString("X") + ", LPARAM:" + m.LParam.ToString("X"));
            }
Label_07C2:
            base.WndProc(ref m);
            this.fSuspendPainting = false;
        }
Beispiel #4
0
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
            case WM.LBUTTONUP:
                if (this.iHoveredIndex != -1)
                {
                    Point pt = new Point(QTUtility2.GET_X_LPARAM(m.LParam), QTUtility2.GET_Y_LPARAM(m.LParam));
                    Dictionary <int, Rectangle> dictionary2 = new Dictionary <int, Rectangle>(this.dicItemRcts);
                    foreach (int num2 in dictionary2.Keys)
                    {
                        if (num2 == this.iHoveredIndex)
                        {
                            Rectangle rectangle2 = this.dicItemRcts[num2];
                            if (rectangle2.Contains(pt))
                            {
                                this.HideSwitcherInner(true, true);
                            }
                            break;
                        }
                    }
                }
                goto Label_01D5;

            case WM.DWMCOMPOSITIONCHANGED:
                this.SetCompositionState();
                goto Label_01D5;

            case WM.MOUSEACTIVATE:
                if ((QTUtility2.GET_Y_LPARAM(m.LParam) == 0x201) && (this.iHoveredIndex != -1))
                {
                    Point point = base.PointToClient(Control.MousePosition);
                    Dictionary <int, Rectangle> dictionary = new Dictionary <int, Rectangle>(this.dicItemRcts);
                    foreach (int num in dictionary.Keys)
                    {
                        if (num == this.iHoveredIndex)
                        {
                            Rectangle rectangle = this.dicItemRcts[num];
                            if (rectangle.Contains(point))
                            {
                                base.Invalidate(this.dicItemRcts[num]);
                            }
                            break;
                        }
                    }
                }
                break;

            case WM.NCHITTEST:
                base.WndProc(ref m);
                switch (((int)m.Result))
                {
                case 10:
                case 11:
                case 12:
                case 13:
                case 14:
                case 15:
                case 0x10:
                case 0x11:
                    m.Result = (IntPtr)0x12;
                    return;
                }
                return;

            default:
                goto Label_01D5;
            }
            m.Result = (IntPtr)4;
            return;

Label_01D5:
            base.WndProc(ref m);
        }