diff options
author | George Hazan <ghazan@miranda.im> | 2018-11-01 18:06:04 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-11-01 18:06:04 +0300 |
commit | dfdc051334916e5c794388e74b526cd897f9fbdf (patch) | |
tree | b7ec9b62ab302a99f491cf05fad7e1b7bf21c8cd /src/mir_app | |
parent | 6cfdddff053784a0280f66dbe27b1089c3c6eda8 (diff) |
fixes #1617 (Add "Select all" and "Select none" to Sounds settings)
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/sounds.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/mir_app/src/sounds.cpp b/src/mir_app/src/sounds.cpp index e9f05c675a..a0d2c7a281 100644 --- a/src/mir_app/src/sounds.cpp +++ b/src/mir_app/src/sounds.cpp @@ -81,6 +81,13 @@ class CSoundOptionsDlg : public CDlgBase return nullptr;
}
+ void SelectAll(bool bSelect)
+ {
+ for (HTREEITEM hItem = m_tree.GetRoot(); hItem; hItem = m_tree.GetNextSibling(hItem))
+ for (HTREEITEM hItem2 = m_tree.GetChild(hItem); hItem2; hItem2 = m_tree.GetNextSibling(hItem2))
+ m_tree.SetCheckState(hItem2, bSelect);
+ }
+
void ShowHidePane(bool bShow)
{
int iCommand = (bShow) ? SW_SHOW : SW_HIDE;
@@ -113,6 +120,7 @@ public: chkSounds.OnChange = Callback(this, &CSoundOptionsDlg::onChange_Sounds);
+ m_tree.OnBuildMenu = Callback(this, &CSoundOptionsDlg::onMenu_Tree);
m_tree.OnSelChanged = Callback(this, &CSoundOptionsDlg::onChanged_Tree);
}
@@ -282,6 +290,22 @@ public: }
}
+ void onMenu_Tree(CCtrlBase*)
+ {
+ POINT pt;
+ GetCursorPos(&pt);
+
+ HMENU hMenu = CreatePopupMenu();
+ AppendMenu(hMenu, MF_STRING, 1, TranslateT("Select all"));
+ AppendMenu(hMenu, MF_STRING, 2, TranslateT("Unselect all"));
+
+ switch (TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, nullptr)) {
+ case 1: SelectAll(true); break;
+ case 2: SelectAll(false); break;
+ }
+ DestroyMenu(hMenu);
+ }
+
void RebuildTree()
{
m_tree.SelectItem(nullptr);
|