-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce dockable context menu to toolwindows #5203
Conversation
@@ -429,14 +430,77 @@ private void AdjustSize() | |||
} | |||
} | |||
|
|||
private static void ToggleDockable(IntPtr hWndVBE) | |||
{ | |||
NativeMethods.SendMessage(hWndVBE, 0x1044, (IntPtr)0xB5, IntPtr.Zero); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: do these hex numbers have particular meaning? would constants be useful here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was more or less a copy-pasta from the original VBA solution from the linked issue, which is also documented (sort of) in the wiki:
https://github.com/rubberduck-vba/Rubberduck/wiki/VBE-Window-Messages
In particular, the 0x1044
is WM_USER + 3140
and the 0xB5
seems to be a subcode for the WM_USER + 3140
message.
My original thought was that this would be a one-trick pony and wouldn't be used anywhere, so it didn't need constants. However, if we want to wrap it in VbIdeMessage
static class, I can get one started with it just and we can add other when we actually need them.
|
||
if (_menuHandle == IntPtr.Zero) | ||
{ | ||
Debug.Print("Cannot create menu handle"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it appropriate to log this (or similar occurrances below)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will add a logger.
Closes #3214
We also now can know the toolwindow's state (whether it's docked, floating or undockable). The context menu is injected via message pump, so it is only available over unused area of the toolwindow. Right-clicking on a used area will yield the usual context menu: