mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-09-28 23:31:25 +12:00
parent
01b8fbe4dc
commit
2b9822c24b
9 changed files with 63 additions and 17 deletions
|
@ -842,7 +842,9 @@ namespace SystemTrayMenu.Controls
|
||||||
private void TabPanelDetails_SelectedIndexChanged(object sender, EventArgs e)
|
private void TabPanelDetails_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (TabPanelDetails.SelectedTab == TabPageAssemblyDetails)
|
if (TabPanelDetails.SelectedTab == TabPageAssemblyDetails)
|
||||||
|
{
|
||||||
AssemblyNamesComboBox.Focus();
|
AssemblyNamesComboBox.Focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace SystemTrayMenu
|
||||||
|
|
||||||
public int Level = 0;
|
public int Level = 0;
|
||||||
FadeForm FadeForm = null;
|
FadeForm FadeForm = null;
|
||||||
bool autoResizeRowsDone = false;
|
bool autoResizeRowsDone = false;
|
||||||
|
|
||||||
public enum MenuType { Default, DisposedFake };
|
public enum MenuType { Default, DisposedFake };
|
||||||
|
|
||||||
|
@ -355,7 +355,11 @@ namespace SystemTrayMenu
|
||||||
get { return _text; }
|
get { return _text; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == null) value = "";
|
if (value == null)
|
||||||
|
{
|
||||||
|
value = "";
|
||||||
|
}
|
||||||
|
|
||||||
if (_text != value)
|
if (_text != value)
|
||||||
{
|
{
|
||||||
_text = value;
|
_text = value;
|
||||||
|
|
|
@ -397,7 +397,7 @@ namespace SystemTrayMenu.Controls
|
||||||
{
|
{
|
||||||
IsLoading = false;
|
IsLoading = false;
|
||||||
OpenMenu?.Invoke(this, null);
|
OpenMenu?.Invoke(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace SystemTrayMenu.Handler
|
||||||
KeySearchString = string.Empty;
|
KeySearchString = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
hook.Dispose();
|
hook.Dispose();
|
||||||
|
@ -168,7 +168,9 @@ namespace SystemTrayMenu.Handler
|
||||||
{
|
{
|
||||||
// Is current selection is still valid for this search then skip selecting different item
|
// Is current selection is still valid for this search then skip selecting different item
|
||||||
if (textselected.ToLower().StartsWith(keyInput.ToLower()))
|
if (textselected.ToLower().StartsWith(keyInput.ToLower()))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dgvBefore = dgv;
|
dgvBefore = dgv;
|
||||||
|
|
|
@ -98,7 +98,10 @@ namespace SystemTrayMenu.Helper
|
||||||
//MH: Removed, otherwise wrong icon
|
//MH: Removed, otherwise wrong icon
|
||||||
// | Shell32.SHGFI_USEFILEATTRIBUTES ;
|
// | Shell32.SHGFI_USEFILEATTRIBUTES ;
|
||||||
|
|
||||||
if (true == linkOverlay) flags += Shell32.SHGFI_LINKOVERLAY;
|
if (true == linkOverlay)
|
||||||
|
{
|
||||||
|
flags += Shell32.SHGFI_LINKOVERLAY;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check the size specified for return. */
|
/* Check the size specified for return. */
|
||||||
if (IconSize.Small == size)
|
if (IconSize.Small == size)
|
||||||
|
@ -139,7 +142,11 @@ namespace SystemTrayMenu.Helper
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
if (!linkOverlay) User32.DestroyIcon(hIcon);
|
if (!linkOverlay)
|
||||||
|
{
|
||||||
|
User32.DestroyIcon(hIcon);
|
||||||
|
}
|
||||||
|
|
||||||
User32.DestroyIcon(shfi.hIcon);
|
User32.DestroyIcon(shfi.hIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +165,10 @@ namespace SystemTrayMenu.Helper
|
||||||
//MH: Removed SHGFI_USEFILEATTRIBUTES, otherwise was wrong folder icon
|
//MH: Removed SHGFI_USEFILEATTRIBUTES, otherwise was wrong folder icon
|
||||||
uint flags = Shell32.SHGFI_ICON; // | Shell32.SHGFI_USEFILEATTRIBUTES;
|
uint flags = Shell32.SHGFI_ICON; // | Shell32.SHGFI_USEFILEATTRIBUTES;
|
||||||
|
|
||||||
if (true == linkOverlay) flags += Shell32.SHGFI_LINKOVERLAY;
|
if (true == linkOverlay)
|
||||||
|
{
|
||||||
|
flags += Shell32.SHGFI_LINKOVERLAY;
|
||||||
|
}
|
||||||
|
|
||||||
if (FolderType.Open == folderType)
|
if (FolderType.Open == folderType)
|
||||||
{
|
{
|
||||||
|
@ -306,7 +316,7 @@ namespace SystemTrayMenu.Helper
|
||||||
public const int ILD_TRANSPARENT = 0x00000001;
|
public const int ILD_TRANSPARENT = 0x00000001;
|
||||||
|
|
||||||
[DllImport("Shell32.dll", CharSet = CharSet.Unicode)]
|
[DllImport("Shell32.dll", CharSet = CharSet.Unicode)]
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Interoperability",
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Interoperability",
|
||||||
"CA1401:P/Invokes should not be visible", Justification = "<Pending>")]
|
"CA1401:P/Invokes should not be visible", Justification = "<Pending>")]
|
||||||
public static extern IntPtr SHGetFileInfo(
|
public static extern IntPtr SHGetFileInfo(
|
||||||
string pszPath,
|
string pszPath,
|
||||||
|
@ -335,7 +345,7 @@ namespace SystemTrayMenu.Helper
|
||||||
/// <param name="hIcon">Pointer to icon handle.</param>
|
/// <param name="hIcon">Pointer to icon handle.</param>
|
||||||
/// <returns>N/A</returns>
|
/// <returns>N/A</returns>
|
||||||
[DllImport("User32.dll")]
|
[DllImport("User32.dll")]
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Interoperability",
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Interoperability",
|
||||||
"CA1401:P/Invokes should not be visible", Justification = "<Pending>")]
|
"CA1401:P/Invokes should not be visible", Justification = "<Pending>")]
|
||||||
public static extern int DestroyIcon(IntPtr hIcon);
|
public static extern int DestroyIcon(IntPtr hIcon);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,9 @@ namespace SystemTrayMenu.Helper
|
||||||
|
|
||||||
// invoke the event to notify the parent.
|
// invoke the event to notify the parent.
|
||||||
if (KeyPressed != null)
|
if (KeyPressed != null)
|
||||||
|
{
|
||||||
KeyPressed(this, new KeyPressedEventArgs(modifier, key));
|
KeyPressed(this, new KeyPressedEventArgs(modifier, key));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +70,9 @@ namespace SystemTrayMenu.Helper
|
||||||
_window.KeyPressed += delegate (object sender, KeyPressedEventArgs args)
|
_window.KeyPressed += delegate (object sender, KeyPressedEventArgs args)
|
||||||
{
|
{
|
||||||
if (KeyPressed != null)
|
if (KeyPressed != null)
|
||||||
|
{
|
||||||
KeyPressed(this, args);
|
KeyPressed(this, args);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +88,9 @@ namespace SystemTrayMenu.Helper
|
||||||
|
|
||||||
// register the hot key.
|
// register the hot key.
|
||||||
if (!RegisterHotKey(_window.Handle, _currentId, (uint)modifier, (uint)key))
|
if (!RegisterHotKey(_window.Handle, _currentId, (uint)modifier, (uint)key))
|
||||||
|
{
|
||||||
throw new InvalidOperationException("Couldn’t register the hot key.");
|
throw new InvalidOperationException("Couldn’t register the hot key.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -111,7 +111,9 @@ namespace SystemTrayMenu.Helper
|
||||||
string info = string.Empty;
|
string info = string.Empty;
|
||||||
|
|
||||||
if (ShellHelper.LoWord(m.WParam) == (int)CMD_CUSTOM.ExpandCollapse)
|
if (ShellHelper.LoWord(m.WParam) == (int)CMD_CUSTOM.ExpandCollapse)
|
||||||
|
{
|
||||||
info = "Expands or collapses the current selected item";
|
info = "Expands or collapses the current selected item";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
info = "";/* ContextMenuHelper.GetCommandString(
|
info = "";/* ContextMenuHelper.GetCommandString(
|
||||||
|
@ -134,7 +136,9 @@ namespace SystemTrayMenu.Helper
|
||||||
{
|
{
|
||||||
if (_oContextMenu2.HandleMenuMsg(
|
if (_oContextMenu2.HandleMenuMsg(
|
||||||
(uint)m.Msg, m.WParam, m.LParam) == S_OK)
|
(uint)m.Msg, m.WParam, m.LParam) == S_OK)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -146,7 +150,9 @@ namespace SystemTrayMenu.Helper
|
||||||
{
|
{
|
||||||
if (_oContextMenu3.HandleMenuMsg2(
|
if (_oContextMenu3.HandleMenuMsg2(
|
||||||
(uint)m.Msg, m.WParam, m.LParam, IntPtr.Zero) == S_OK)
|
(uint)m.Msg, m.WParam, m.LParam, IntPtr.Zero) == S_OK)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -555,13 +561,19 @@ namespace SystemTrayMenu.Helper
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iContextMenuPtr != IntPtr.Zero)
|
if (iContextMenuPtr != IntPtr.Zero)
|
||||||
|
{
|
||||||
Marshal.Release(iContextMenuPtr);
|
Marshal.Release(iContextMenuPtr);
|
||||||
|
}
|
||||||
|
|
||||||
if (iContextMenuPtr2 != IntPtr.Zero)
|
if (iContextMenuPtr2 != IntPtr.Zero)
|
||||||
|
{
|
||||||
Marshal.Release(iContextMenuPtr2);
|
Marshal.Release(iContextMenuPtr2);
|
||||||
|
}
|
||||||
|
|
||||||
if (iContextMenuPtr3 != IntPtr.Zero)
|
if (iContextMenuPtr3 != IntPtr.Zero)
|
||||||
|
{
|
||||||
Marshal.Release(iContextMenuPtr3);
|
Marshal.Release(iContextMenuPtr3);
|
||||||
|
}
|
||||||
|
|
||||||
ReleaseAll();
|
ReleaseAll();
|
||||||
}
|
}
|
||||||
|
@ -1516,7 +1528,9 @@ namespace SystemTrayMenu.Helper
|
||||||
protected void OnHookInvoked(HookEventArgs e)
|
protected void OnHookInvoked(HookEventArgs e)
|
||||||
{
|
{
|
||||||
if (HookInvoked != null)
|
if (HookInvoked != null)
|
||||||
|
{
|
||||||
HookInvoked(this, e);
|
HookInvoked(this, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// ************************************************************************
|
// ************************************************************************
|
||||||
|
|
||||||
|
@ -1539,7 +1553,9 @@ namespace SystemTrayMenu.Helper
|
||||||
protected int CoreHookProc(int code, IntPtr wParam, IntPtr lParam)
|
protected int CoreHookProc(int code, IntPtr wParam, IntPtr lParam)
|
||||||
{
|
{
|
||||||
if (code < 0)
|
if (code < 0)
|
||||||
|
{
|
||||||
return CallNextHookEx(m_hhook, code, wParam, lParam);
|
return CallNextHookEx(m_hhook, code, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
// Let clients determine what to do
|
// Let clients determine what to do
|
||||||
HookEventArgs e = new HookEventArgs();
|
HookEventArgs e = new HookEventArgs();
|
||||||
|
@ -1617,9 +1633,13 @@ namespace SystemTrayMenu.Helper
|
||||||
{
|
{
|
||||||
uint param32 = (uint)(ptr.ToInt64() | 0xffffffffL);
|
uint param32 = (uint)(ptr.ToInt64() | 0xffffffffL);
|
||||||
if ((param32 & 0x80000000) == 0x80000000)
|
if ((param32 & 0x80000000) == 0x80000000)
|
||||||
|
{
|
||||||
return (param32 >> 16);
|
return (param32 >> 16);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return (param32 >> 16) & 0xffff;
|
return (param32 >> 16) & 0xffff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace SystemTrayMenu
|
||||||
{
|
{
|
||||||
Log.Close();
|
Log.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AskUserSendError(Exception ex)
|
void AskUserSendError(Exception ex)
|
||||||
{
|
{
|
||||||
Log.Error("Application Crashed", ex);
|
Log.Error("Application Crashed", ex);
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace SystemTrayMenu
|
||||||
keyboardInput.Cleared += FadeHalfOrOutIfNeeded;
|
keyboardInput.Cleared += FadeHalfOrOutIfNeeded;
|
||||||
|
|
||||||
menuNotifyIcon = new MenuNotifyIcon();
|
menuNotifyIcon = new MenuNotifyIcon();
|
||||||
menuNotifyIcon.Exit += Application.Exit;
|
menuNotifyIcon.Exit += Application.Exit;
|
||||||
menuNotifyIcon.Restart += AppRestart.ByMenuNotifyIcon;
|
menuNotifyIcon.Restart += AppRestart.ByMenuNotifyIcon;
|
||||||
menuNotifyIcon.HandleClick += SwitchOpenClose;
|
menuNotifyIcon.HandleClick += SwitchOpenClose;
|
||||||
void SwitchOpenClose()
|
void SwitchOpenClose()
|
||||||
|
@ -158,7 +158,7 @@ namespace SystemTrayMenu
|
||||||
keyboardInput.InUse = false;
|
keyboardInput.InUse = false;
|
||||||
if (dgvFromLastMouseEvent != null)
|
if (dgvFromLastMouseEvent != null)
|
||||||
{
|
{
|
||||||
Dgv_MouseEnter(dgvFromLastMouseEvent,
|
Dgv_MouseEnter(dgvFromLastMouseEvent,
|
||||||
cellEventArgsFromLastMouseEvent);
|
cellEventArgsFromLastMouseEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ namespace SystemTrayMenu
|
||||||
if (menus[0].Visible &&
|
if (menus[0].Visible &&
|
||||||
isMouseOnAnyMenu)
|
isMouseOnAnyMenu)
|
||||||
{
|
{
|
||||||
if (isAnyMenuActive &&
|
if (isAnyMenuActive &&
|
||||||
!(openCloseState == OpenCloseState.Closing))
|
!(openCloseState == OpenCloseState.Closing))
|
||||||
{
|
{
|
||||||
if (!keyboardInput.InUse)
|
if (!keyboardInput.InUse)
|
||||||
|
@ -252,13 +252,13 @@ namespace SystemTrayMenu
|
||||||
int widthPredecessors = -1; // -1 padding
|
int widthPredecessors = -1; // -1 padding
|
||||||
bool directionToRight = false;
|
bool directionToRight = false;
|
||||||
|
|
||||||
foreach (Menu menu in Menus().Where(m=>m.Level > 0))
|
foreach (Menu menu in Menus().Where(m => m.Level > 0))
|
||||||
{
|
{
|
||||||
int newWith = (menu.Width -
|
int newWith = (menu.Width -
|
||||||
menu.Padding.Horizontal + menuPredecessor.Width);
|
menu.Padding.Horizontal + menuPredecessor.Width);
|
||||||
if (directionToRight)
|
if (directionToRight)
|
||||||
{
|
{
|
||||||
if (widthPredecessors - menu.Width <=
|
if (widthPredecessors - menu.Width <=
|
||||||
-menu.Padding.Horizontal)
|
-menu.Padding.Horizontal)
|
||||||
{
|
{
|
||||||
directionToRight = false;
|
directionToRight = false;
|
||||||
|
@ -430,7 +430,9 @@ namespace SystemTrayMenu
|
||||||
if (!worker.CancellationPending)
|
if (!worker.CancellationPending)
|
||||||
{
|
{
|
||||||
if (menuData.Validity == MenuDataValidity.Invalid)
|
if (menuData.Validity == MenuDataValidity.Invalid)
|
||||||
|
{
|
||||||
menuData.Validity = MenuDataValidity.Valid;
|
menuData.Validity = MenuDataValidity.Valid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return menuData;
|
return menuData;
|
||||||
|
@ -667,7 +669,7 @@ namespace SystemTrayMenu
|
||||||
dgv.SelectionChanged += Dgv_SelectionChanged;
|
dgv.SelectionChanged += Dgv_SelectionChanged;
|
||||||
menu.KeyPress += keyboardInput.KeyPress;
|
menu.KeyPress += keyboardInput.KeyPress;
|
||||||
menu.CmdKeyProcessed += keyboardInput.CmdKeyProcessed;
|
menu.CmdKeyProcessed += keyboardInput.CmdKeyProcessed;
|
||||||
menu.Activated += Activated;
|
menu.Activated += Activated;
|
||||||
void Activated(object sender, EventArgs e)
|
void Activated(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
menus[0].SetTitleColorActive();
|
menus[0].SetTitleColorActive();
|
||||||
|
|
Loading…
Reference in a new issue