Exemple #1
0
        private void HandleContextMenuInvoked(object sender, MouseEventArgs e)
        {
            if (!IsHandleCreated || !Visible)
            {
                return;
            }

            if (_jetListView.IsColumnHeaderAt(e.X, e.Y))
            {
                if (_headerContextMenu != null)
                {
                    _headerContextMenu.Show(this, new Point(e.X, e.Y));
                }
            }
            else if (_showContextMenu)
            {
                IActionContext actionContext = _contextProvider.GetContext(ActionContextKind.ContextMenu);
                if (_jetListView.GetNodeAt(e.X, e.Y) == null)
                {
                    ActionContext context = actionContext as ActionContext;
                    if (context != null)
                    {
                        context.SetSelectedResources(Core.ResourceStore.EmptyResourceList);
                    }
                }
                Core.ActionManager.ShowResourceContextMenu(actionContext,
                                                           this, e.X, e.Y);
            }
        }
Exemple #2
0
        internal void HandleWMNotify(ref Message m)
        {
            uint  pos = Win32Declarations.GetMessagePos();
            Point pt  = new Point(Win32Declarations.LOWORD(pos), Win32Declarations.HIWORD(pos));

            pt = _ownerControl.PointToClient(pt);

            NMHDR nmhdr = (NMHDR)m.GetLParam(typeof(NMHDR));

            if (nmhdr.code == Win32Declarations.TTN_NEEDTEXTW)
            {
                NMTTDISPINFOW dispInfo = (NMTTDISPINFOW)m.GetLParam(typeof(NMTTDISPINFOW));
                _lastToolTipNode   = _ownerControl.GetNodeAt(pt);
                _lastToolTipColumn = _ownerControl.GetColumnAt(pt);
                string tooltip = null;
                if (_lastToolTipColumn != null && _lastToolTipNode != null)
                {
                    Rectangle rc = _ownerControl.GetItemBounds(_lastToolTipNode, _lastToolTipColumn);
                    _lastNeedPlace    = true;
                    tooltip           = _lastToolTipColumn.GetToolTip(_lastToolTipNode, rc, ref _lastNeedPlace);
                    _lastItemShowRect = rc;
                }
                if (tooltip == null || tooltip.Length == 0)
                {
                    dispInfo.szText   = "";
                    dispInfo.lpszText = IntPtr.Zero;
                }
                else
                {
                    dispInfo.lpszText = _toolTipPool.PinString(tooltip);
                }
                Marshal.StructureToPtr(dispInfo, m.LParam, false);
            }
            else if (nmhdr.code == Win32Declarations.TTN_SHOW && _lastNeedPlace)
            {
                Rectangle scItemShowRect = _ownerControl.RectangleToScreen(_lastItemShowRect);
                RECT      rc             = Win32Declarations.RectangleToRECT(scItemShowRect);
                Win32Declarations.SendMessage(Handle, (LVM)Win32Declarations.TTM_ADJUSTRECT,
                                              1, ref rc);

                Win32Declarations.SetWindowPos(Handle, IntPtr.Zero, rc.left, rc.top, 0, 0,
                                               Win32Declarations.SWP_NOSIZE | Win32Declarations.SWP_NOZORDER | Win32Declarations.SWP_NOACTIVATE);
                m.Result = (IntPtr)1;
            }
        }