summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src/msgs.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-03-14 20:27:44 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-03-14 20:27:44 +0300
commit0edc6006e17f896324d4011acdf5e16162572908 (patch)
tree0894285d03393bbb891a6bac94f2fbda07ea40cc /plugins/TabSRMM/src/msgs.cpp
parentb408d9e8208c426c263c69602edfa8a4978fa3bf (diff)
tabSRMM:
- fixes #735 (crazy dark magic of Windows); - common code of window creation moved to CTabBaseDlg::OnInitDialog(); - DM_REFRESHTABINDEX replaced with the call of TContainerData::UpdateTabs();
Diffstat (limited to 'plugins/TabSRMM/src/msgs.cpp')
-rw-r--r--plugins/TabSRMM/src/msgs.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index cd5e765b0c..2df17da155 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -147,6 +147,27 @@ CTabBaseDlg::~CTabBaseDlg()
if (m_hTaskbarIcon) DestroyIcon(m_hTaskbarIcon);
}
+void CTabBaseDlg::OnInitDialog()
+{
+ SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)this);
+
+ // m_hwnd is valid, pass it to the tab control
+ TCITEM tci;
+ tci.mask = TCIF_PARAM;
+ tci.lParam = (LPARAM)m_hwnd;
+ TabCtrl_SetItem(m_hwndParent, m_iTabID, &tci);
+
+ // update another tab ids
+ m_pContainer->UpdateTabs();
+
+ // add this window to window list & proxy
+ M.AddWindow(m_hwnd, m_hContact);
+ CProxyWindow::add(this);
+
+ // set up Windows themes
+ DM_ThemeChanged();
+}
+
INT_PTR CTabBaseDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
@@ -701,7 +722,7 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact,
TCITEM item = {};
item.pszText = tabtitle;
- item.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM;
+ item.mask = TCIF_TEXT | TCIF_IMAGE;
item.iImage = 0;
item.cchTextMax = _countof(tabtitle);
int iTabId = TabCtrl_InsertItem(hwndTab, pContainer->iTabIndex, &item);
@@ -725,8 +746,6 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact,
pWindow->Create();
HWND hwndNew = pWindow->GetHwnd();
- item.lParam = (LPARAM)hwndNew;
- TabCtrl_SetItem(hwndTab, iTabId, &item);
// switchbar support
if (pContainer->dwFlags & CNT_SIDEBAR)