Example #1
0
            public override int SubClassProc(IntPtr hWnd, IntPtr msg, IntPtr wParam, IntPtr lParam, IntPtr uIdSubclass, IntPtr dwRefData)
            {
                switch ((uint)msg)
                {
                case (uint)WM.SIZE:
                    var args = new SubClassingWindowEventArgs(lParam);
                    if (!_closing)
                    {
                        OnCallBackEvent(args);
                    }
                    break;

                case (uint)WM.SETFOCUS:
                    if (!_closing)
                    {
                        User32.SendMessage(_vbeHwnd, WM.RUBBERDUCK_CHILD_FOCUS, Hwnd, Hwnd);
                    }
                    break;

                case (uint)WM.KILLFOCUS:
                    if (!_closing)
                    {
                        User32.SendMessage(_vbeHwnd, WM.RUBBERDUCK_CHILD_FOCUS, Hwnd, IntPtr.Zero);
                    }
                    break;
                }
                return(base.SubClassProc(hWnd, msg, wParam, lParam, uIdSubclass, dwRefData));
            }
Example #2
0
 private void OnCallBackEvent(SubClassingWindowEventArgs e)
 {
     if (CallBackEvent != null)
     {
         CallBackEvent(this, e);
     }
 }
Example #3
0
            protected override void WndProc(ref Message msg)
            {
                const int wmSize = 0x5;

                if (msg.Msg == wmSize)
                {
                    var args = new SubClassingWindowEventArgs(msg);
                    OnCallBackEvent(args);
                }

                base.WndProc(ref msg);
            }
Example #4
0
 private void OnCallBackEvent(object sender, SubClassingWindowEventArgs e)
 {
     if (!e.Closing)
     {
         var param = new LParam {
             Value = (uint)e.LParam
         };
         Size = new Size(param.LowWord, param.HighWord);
     }
     else
     {
         Debug.WriteLine("DockableWindowHost removed event handler.");
         _subClassingWindow.CallBackEvent -= OnCallBackEvent;
     }
 }
Example #5
0
        // old stuff from old _DockableWindowHost --------------------------------------- [START]

        private void OnCallBackEvent(object sender, SubClassingWindowEventArgs e)
        {
            if (e.Closing)
            {
                return;
            }
            var param = new LParam {
                Value = (uint)e.LParam
            };
            // The VBE passes a special value to the HighWord when docking into the VBE Codepane
            // instead of docking into the VBE itself.
            // that special value (0xffef) blows up inside the guts of Window management because it's
            // apparently converted to a signed short somewhere and then considered "negative"
            // that is why we drop the signbit for shorts off our values when creating the control Size.
            const ushort signBitMask = 0x8000;

            _userControl.Size = new Size(param.LowWord & ~signBitMask, param.HighWord & ~signBitMask);
        }
            protected override void WndProc(ref Message msg)
            {
                switch ((uint)msg.Msg)
                {
                case (uint)WM.SIZE:
                    var args = new SubClassingWindowEventArgs(msg);
                    OnCallBackEvent(args);
                    break;

                case (uint)WM.SETFOCUS:
                    User32.SendMessage(_vbeHwnd, WM.RUBBERDUCK_CHILD_FOCUS, Handle, Handle);
                    break;

                case (uint)WM.KILLFOCUS:
                    User32.SendMessage(_vbeHwnd, WM.RUBBERDUCK_CHILD_FOCUS, Handle, IntPtr.Zero);
                    break;
                }
                base.WndProc(ref msg);
            }
Example #7
0
 private void OnCallBackEvent(SubClassingWindowEventArgs e)
 {
     CallBackEvent?.Invoke(this, e);
 }
Example #8
0
 private void OnCallBackEvent(object sender, SubClassingWindowEventArgs e)
 {
     AdjustSize();
 }
Example #9
0
 private void OnCallBackEvent(SubClassingWindowEventArgs e)
 {
     Debug.Assert(CallBackEvent != null, "CallBackEvent != null");
     CallBackEvent(this, e);
 }
            public override int SubClassProc(IntPtr hWnd, IntPtr msg, IntPtr wParam, IntPtr lParam, IntPtr uIdSubclass, IntPtr dwRefData)
            {
                switch ((uint)msg)
                {
                case (uint)WM.WINDOWPOSCHANGED:
                    var containerHwnd = GetParent(hWnd);
                    if (containerHwnd != _containerHwnd)
                    {
                        _containerHwnd = containerHwnd;
                        _windowState   = GetWindowState(_containerHwnd);
                    }
                    break;

                case (uint)WM.CONTEXTMENU:
                    if (_windowState == ToolWindowState.Undockable)
                    {
                        DisplayUndockableContextMenu(hWnd, lParam);
                    }
                    break;

                case (uint)WM.COMMAND:
                    switch (wParam.ToInt32())
                    {
                    case (int)WM.RUBBERDUCK_UNDOCKABLE_CONTEXT_MENU:
                        ToggleDockable(_vbeHwnd);
                        break;
                    }
                    break;

                case (uint)WM.SIZE:
                    var args = new SubClassingWindowEventArgs(lParam);
                    if (!_closing)
                    {
                        OnCallBackEvent(args);
                    }
                    break;

                case (uint)WM.SETFOCUS:
                    if (!_closing)
                    {
                        User32.SendMessage(_vbeHwnd, WM.RUBBERDUCK_CHILD_FOCUS, Hwnd, Hwnd);
                    }
                    break;

                case (uint)WM.KILLFOCUS:
                    if (!_closing)
                    {
                        User32.SendMessage(_vbeHwnd, WM.RUBBERDUCK_CHILD_FOCUS, Hwnd, IntPtr.Zero);
                    }
                    break;

                case (uint)WM.DESTROY:
                    if (_menuHandle != IntPtr.Zero)
                    {
                        if (!NativeMethods.DestroyMenu(_menuHandle))
                        {
                            _logger.Fatal($"Failed to destroy the menu handle {_menuHandle}");
                        }
                    }
                    break;
                }
                return(base.SubClassProc(hWnd, msg, wParam, lParam, uIdSubclass, dwRefData));
            }