summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-03-03 18:08:16 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-03-03 18:08:16 +0300
commit1be16f1566b862629878a2d1a46063afeae78c38 (patch)
tree3717a30de15c1f3ae5e9326f80e799840db77c29 /src
parentf4f859003e2d17ab6d457e552ccdde775899b328 (diff)
fix for the shitty idea of all pre-created button objects' manual initialization
Diffstat (limited to 'src')
-rw-r--r--src/core/stdmsg/src/chat_window.cpp3
-rw-r--r--src/mir_app/src/srmm_toolbar.cpp9
2 files changed, 9 insertions, 3 deletions
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index f2391f0d42..128daf3b36 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -907,9 +907,6 @@ void CChatRoomDlg::OnInitDialog()
// initialize toolbar icons
Srmm_CreateToolbarIcons(m_hwnd, BBBF_ISCHATBUTTON);
- m_btnBold.OnInit(); m_btnItalic.OnInit(); m_btnUnderline.OnInit();
- m_btnColor.OnInit(); m_btnBkColor.OnInit();
- m_btnFilter.OnInit(); m_btnHistory.OnInit(); m_btnChannelMgr.OnInit();
WindowList_Add(pci->hWindowList, m_hwnd, m_hContact);
diff --git a/src/mir_app/src/srmm_toolbar.cpp b/src/mir_app/src/srmm_toolbar.cpp
index 26523fbe01..b94c175ef0 100644
--- a/src/mir_app/src/srmm_toolbar.cpp
+++ b/src/mir_app/src/srmm_toolbar.cpp
@@ -320,6 +320,8 @@ MIR_APP_DLL(void) Srmm_CreateToolbarIcons(HWND hwndDlg, int flags)
{
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hwndDlg, GWLP_HINSTANCE);
+ CDlgBase *pDlg = CDlgBase::Find(hwndDlg);
+
for (int i = 0; i < arButtonsList.getCount(); i++) {
CustomButtonData *cbd = arButtonsList[i];
if (cbd->m_bSeparator)
@@ -331,6 +333,13 @@ MIR_APP_DLL(void) Srmm_CreateToolbarIcons(HWND hwndDlg, int flags)
hwndButton = CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, cbd->m_iButtonWidth, DPISCALEX_S(22), hwndDlg, (HMENU)cbd->m_dwButtonCID, hInstance, NULL);
if (hwndButton == NULL) // smth went wrong
continue;
+
+ // if there's a pre-created button control in a class, initialize it
+ if (pDlg != nullptr) {
+ CCtrlBase *pControl = (*pDlg)[cbd->m_dwButtonCID];
+ if (pControl)
+ pControl->OnInit();
+ }
}
SendMessage(hwndButton, BUTTONSETASFLATBTN, TRUE, 0);
if (cbd->m_pwszText)