Ejemplo n.º 1
0
        protected override bool ListViewController_MessageCaptured(ref Message msg)
        {
            if (msg.Msg == WM_AFTERPAINT)
            {
                RefreshCache();
            }
            else if (msg.Msg == WM_ISITEMSVIEW)
            {
                msg.Result = (IntPtr)1;
                return(true);
            }

            if (base.ListViewController_MessageCaptured(ref msg))
            {
                return(true);
            }

            switch (msg.Msg)
            {
            case LVM.SCROLL: {
                int amount = msg.WParam.ToInt32();
                SetRedraw(false);
                AutomationManager.DoQuery(factory => {
                        AutomationElement elem = factory.FromHandle(Handle);
                        amount  /= SystemInformation.MouseWheelScrollDelta;
                        bool dec = amount < 0;
                        if (dec)
                        {
                            amount = -amount;
                        }
                        int lines = SystemInformation.MouseWheelScrollLines;
                        if (lines < 0)
                        {
                            elem.ScrollHorizontal(dec
                                    ? ScrollAmount.LargeDecrement
                                    : ScrollAmount.LargeIncrement, amount);
                        }
                        else
                        {
                            elem.ScrollHorizontal(dec
                                    ? ScrollAmount.SmallDecrement
                                    : ScrollAmount.SmallIncrement, amount * lines);
                        }
                        return(0);
                    });
                SetRedraw(true);
                return(true);
            }

            case WM.MOUSEACTIVATE: {
                int  res = (int)msg.Result;
                bool ret = OnMouseActivate(ref res);
                msg.Result = (IntPtr)res;
                return(ret);
            }

            case WM.LBUTTONDOWN: {
                // The ItemsView's window class doesn't have the CS_DBLCLKS
                // class style, which means we won't be receiving the
                // WM.LBUTTONDBLCLK message.  We'll just have to make do
                // without...
                Int64 now = DateTime.Now.Ticks;
                Point pt  = QTUtility2.PointFromLPARAM(msg.LParam);
                if ((now - lastLButtonTime) / 10000 <= SystemInformation.DoubleClickTime)
                {
                    Size size = SystemInformation.DoubleClickSize;
                    if (Math.Abs(pt.X - lastLButtonPoint.X) <= size.Width)
                    {
                        if (Math.Abs(pt.Y - lastLButtonPoint.Y) <= size.Height)
                        {
                            lastLButtonTime = 0;
                            return(OnDoubleClick(pt));
                        }
                    }
                }
                lastLButtonPoint = pt;
                lastLButtonTime  = now;
                return(false);
            }

            case WM.MOUSEMOVE: {
                Point pt = QTUtility2.PointFromLPARAM(msg.LParam);
                if (pt != lastMouseMovePoint)
                {
                    lastMouseMovePoint = pt;
                    if (focusedElement != null)
                    {
                        if (hotElement == null && focusedElement.FullRect.Contains(pt))
                        {
                            PInvoke.PostMessage(Handle, WM_AFTERPAINT, IntPtr.Zero, IntPtr.Zero);
                        }
                        else if (hotElement != null && hotElement.Index == focusedElement.Index && !focusedElement.FullRect.Contains(pt))
                        {
                            PInvoke.PostMessage(Handle, WM_AFTERPAINT, IntPtr.Zero, IntPtr.Zero);
                        }
                    }
                }
                break;
            }

            case WM.MOUSELEAVE:
                if (focusedElement != null)
                {
                    if (hotElement != null && hotElement.Index == focusedElement.Index)
                    {
                        PInvoke.PostMessage(Handle, WM_AFTERPAINT, IntPtr.Zero, IntPtr.Zero);
                    }
                }
                break;

            case WM.KEYDOWN:
                return(OnKeyDown((Keys)msg.WParam));

            case WM.LBUTTONUP:
            case WM.RBUTTONUP:
            case WM.MBUTTONUP:
                RefreshCache();
                break;

            case WM.NOTIFY: {
                NMHDR nmhdr = (NMHDR)Marshal.PtrToStructure(msg.LParam, typeof(NMHDR));
                if (nmhdr.code == -530 /* TTN_NEEDTEXT */)
                {
                    NMTTDISPINFO dispinfo = (NMTTDISPINFO)Marshal.PtrToStructure(msg.LParam, typeof(NMTTDISPINFO));
                    if ((dispinfo.uFlags & 0x20 /* TTF_TRACK */) != 0)
                    {
                        return(OnGetInfoTip(ShellBrowser.GetFocusedIndex(), true));
                    }
                    else
                    {
                        int i = GetHotItem();
                        if (i != -1 && IsTrackingItemName())
                        {
                            return(OnGetInfoTip(i, false));
                        }
                    }
                }
                break;
            }
            }
            return(false);
        }
Ejemplo n.º 2
0
 public extern static int RtlMoveMemory(
     IntPtr destination, ref NMTTDISPINFO Source, int length);
Ejemplo n.º 3
0
 private extern static int RtlMoveMemory(IntPtr Destination, ref NMTTDISPINFO Source, int Length);
Ejemplo n.º 4
0
 internal extern static int RtlMoveMemory(
     ref NMTTDISPINFO destination, IntPtr source, int length);
Ejemplo n.º 5
0
 private static extern int RtlMoveMemory(ref NMTTDISPINFO Destination, IntPtr Source, int Length);
Ejemplo n.º 6
0
 public static extern int RtlMoveMemory(ref NMTTDISPINFO destination, IntPtr source, int length);
Ejemplo n.º 7
0
 public static extern int RtlMoveMemory(ref NMTTDISPINFO destination, IntPtr source, int length);