diff options
author | George Hazan <ghazan@miranda.im> | 2021-05-11 13:26:56 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-05-11 13:26:56 +0300 |
commit | 6bb048378e2b73c908f4512d9a925e736bd44fda (patch) | |
tree | 59fa9ffce6e00d82c3b6254b7e5d2cdcde3bdb89 /src | |
parent | 383409527e474e83078178f5e80975b64fb5ffcf (diff) |
CCtrlCombo::GetCurData = suitable helper for combo boxes
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stdclist/src/clistopts.cpp | 2 | ||||
-rw-r--r-- | src/core/stdfile/src/fileopts.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/MDatabaseCommonCrypt.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/addcontact.cpp | 6 | ||||
-rw-r--r-- | src/mir_app/src/lpopts.cpp | 6 | ||||
-rw-r--r-- | src/mir_app/src/options.cpp | 5 | ||||
-rw-r--r-- | src/mir_app/src/profilemanager.cpp | 9 | ||||
-rw-r--r-- | src/mir_core/src/CCtrlCombo.cpp | 5 | ||||
-rw-r--r-- | src/mir_core/src/mir_core.def | 1 | ||||
-rw-r--r-- | src/mir_core/src/mir_core64.def | 1 |
10 files changed, 20 insertions, 19 deletions
diff --git a/src/core/stdclist/src/clistopts.cpp b/src/core/stdclist/src/clistopts.cpp index fa86e449df..623f3b6700 100644 --- a/src/core/stdclist/src/clistopts.cpp +++ b/src/core/stdclist/src/clistopts.cpp @@ -96,7 +96,7 @@ public: g_plugin.setWord("IconFlashTime", blink.GetPosition());
g_plugin.setByte("DisableTrayFlash", IsDlgButtonChecked(m_hwnd, IDC_DISABLEBLINK));
- PROTOACCOUNT *pa = (PROTOACCOUNT *)status.GetItemData(status.GetCurSel());
+ PROTOACCOUNT *pa = (PROTOACCOUNT *)status.GetCurData();
if (pa == nullptr)
g_plugin.delSetting("PrimaryStatus");
else
diff --git a/src/core/stdfile/src/fileopts.cpp b/src/core/stdfile/src/fileopts.cpp index 34185f2312..006273dfd1 100644 --- a/src/core/stdfile/src/fileopts.cpp +++ b/src/core/stdfile/src/fileopts.cpp @@ -169,7 +169,7 @@ public: void onSelChanged_Combo(CCtrlCombo*)
{
- int iScanner = cmbScanCmdLine.GetItemData(cmbScanCmdLine.GetCurSel());
+ int iScanner = cmbScanCmdLine.GetCurData();
if (iScanner >= _countof(virusScanners) || iScanner < 0)
return;
diff --git a/src/mir_app/src/MDatabaseCommonCrypt.cpp b/src/mir_app/src/MDatabaseCommonCrypt.cpp index 1e0258a318..baa0ade9f5 100644 --- a/src/mir_app/src/MDatabaseCommonCrypt.cpp +++ b/src/mir_app/src/MDatabaseCommonCrypt.cpp @@ -36,7 +36,7 @@ class CSelectCryptoDialog : public CDlgBase CRYPTO_PROVIDER *getCurrent() { - return (CRYPTO_PROVIDER*)m_combo.GetItemData(m_combo.GetCurSel()); + return (CRYPTO_PROVIDER*)m_combo.GetCurData(); } bool OnInitDialog() override diff --git a/src/mir_app/src/addcontact.cpp b/src/mir_app/src/addcontact.cpp index 3146974a23..c4520d37ba 100644 --- a/src/mir_app/src/addcontact.cpp +++ b/src/mir_app/src/addcontact.cpp @@ -119,9 +119,9 @@ public: if (mir_wstrlen(szHandle))
db_set_ws(hContact, "CList", "MyHandle", szHandle);
- int item = m_group.GetCurSel();
- if (item > 0)
- Clist_ContactChangeGroup(hContact, m_group.GetItemData(item));
+ MGROUP iGroup = m_group.GetCurData();
+ if (iGroup >= 0)
+ Clist_ContactChangeGroup(hContact, iGroup);
Contact_PutOnList(hContact);
diff --git a/src/mir_app/src/lpopts.cpp b/src/mir_app/src/lpopts.cpp index 7439de1e08..a397dad825 100644 --- a/src/mir_app/src/lpopts.cpp +++ b/src/mir_app/src/lpopts.cpp @@ -197,8 +197,7 @@ void CLangpackDlg::DisplayPackInfo(const LANGPACK_INFO *pack) void CLangpackDlg::Languages_OnChange(CCtrlBase*)
{
- int idx = m_languages.GetCurSel();
- LANGPACK_INFO *pack = (LANGPACK_INFO*)m_languages.GetItemData(idx);
+ LANGPACK_INFO *pack = (LANGPACK_INFO*)m_languages.GetCurData();
DisplayPackInfo(pack);
if (!(pack->flags & LPF_ENABLED))
SendMessage(GetParent(GetHwnd()), PSM_CHANGED, 0, 0);
@@ -208,8 +207,7 @@ void CLangpackDlg::Languages_OnChange(CCtrlBase*) void CLangpackDlg::Reload_OnClick(CCtrlBase*)
{
m_reload.Enable(FALSE);
- int idx = m_languages.GetCurSel();
- LANGPACK_INFO *pack = (LANGPACK_INFO*)m_languages.GetItemData(idx);
+ LANGPACK_INFO *pack = (LANGPACK_INFO*)m_languages.GetCurData();
ReloadLangpack(pack->tszFullPath);
DisplayPackInfo(pack);
m_reload.Enable(TRUE);
diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp index 3e34f00092..be2c96b67b 100644 --- a/src/mir_app/src/options.cpp +++ b/src/mir_app/src/options.cpp @@ -527,9 +527,8 @@ class COptionsDlg : public CDlgBase wcsncpy_s(m_szFilterString, pos, _TRUNCATE);
}
else {
- int sel = m_keywordFilter.GetCurSel();
- if (sel != -1) {
- HINSTANCE hinst = (HINSTANCE)m_keywordFilter.GetItemData(sel);
+ HINSTANCE hinst = (HINSTANCE)m_keywordFilter.GetCurData();
+ if (hinst != INVALID_HANDLE_VALUE) {
wchar_t szFileName[300];
GetModuleFileName(hinst, szFileName, _countof(szFileName));
wchar_t *pos = wcsrchr(szFileName, '\\');
diff --git a/src/mir_app/src/profilemanager.cpp b/src/mir_app/src/profilemanager.cpp index 5c4453cb45..e87673aee7 100644 --- a/src/mir_app/src/profilemanager.cpp +++ b/src/mir_app/src/profilemanager.cpp @@ -648,12 +648,9 @@ public: void OnDestroy() { if (m_chkSmEnabled.GetState()) { - LRESULT curSel = m_servicePlugs.GetCurSel(); - if (curSel != -1) { - int idx = m_servicePlugs.GetItemData(curSel); - if (idx != -1) - plugin_service = servicePlugins[idx]; - } + int idx = m_servicePlugs.GetCurData(); + if (idx != -1) + plugin_service = servicePlugins[idx]; } DestroyIcon((HICON)SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, 0)); diff --git a/src/mir_core/src/CCtrlCombo.cpp b/src/mir_core/src/CCtrlCombo.cpp index a7abf1d707..4a67f14720 100644 --- a/src/mir_core/src/CCtrlCombo.cpp +++ b/src/mir_core/src/CCtrlCombo.cpp @@ -76,6 +76,11 @@ void CCtrlCombo::OnReset() SetInt(LoadInt()); } +LPARAM CCtrlCombo::GetCurData() const +{ + return GetItemData(GetCurSel()); +} + // selects line with userdata passed int CCtrlCombo::SelectData(LPARAM data) { diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index a895c2f6c6..3702d84864 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -1504,3 +1504,4 @@ TimeZone_GetSystemTime @1692 ?MoveItem@CCtrlListView@@QAEHHH@Z @1727 NONAME
?SelectData@CCtrlCombo@@QAEHJ@Z @1728 NONAME
?SetCurSel@CCtrlListView@@QAEXH@Z @1729 NONAME
+?GetCurData@CCtrlCombo@@QBEJXZ @1730 NONAME
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index 9e6cf832e4..ae7037fbdd 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -1504,3 +1504,4 @@ TimeZone_GetSystemTime @1692 ?MoveItem@CCtrlListView@@QEAAHHH@Z @1727 NONAME
?SelectData@CCtrlCombo@@QEAAH_J@Z @1728 NONAME
?SetCurSel@CCtrlListView@@QEAAXH@Z @1729 NONAME
+?GetCurData@CCtrlCombo@@QEBA_JXZ @1730 NONAME
|