summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-13 23:32:44 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-13 23:32:44 +0300
commita69f4df1d2cc47e1a73f4552e1b63eb688cf48f2 (patch)
tree96a1606b9bd09cbbb4f1e7a04c4b531d6b324ff6 /src
parent1552103b2abf3d048e7e0955a48bf63e8f34917d (diff)
StdMsg: fix for setting SRMM window's icons
Diffstat (limited to 'src')
-rw-r--r--src/core/stdmsg/src/msgs.h12
-rw-r--r--src/core/stdmsg/src/stdafx.h20
-rw-r--r--src/core/stdmsg/src/tabs.cpp33
3 files changed, 40 insertions, 25 deletions
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h
index 5f04157bab..a1853a08a2 100644
--- a/src/core/stdmsg/src/msgs.h
+++ b/src/core/stdmsg/src/msgs.h
@@ -54,6 +54,10 @@ protected:
CMsgDialog(int idDialog, SESSION_INFO *si = nullptr);
virtual int GetImageId() const PURE;
+
+ virtual const char* GetProto() const PURE;
+ virtual int GetStatus() const PURE;
+
virtual void OnActivate() PURE;
INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
@@ -125,7 +129,10 @@ public:
INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
int Resizer(UTILRESIZECONTROL *urc) override;
-
+
+ virtual const char* GetProto() const { return m_szProto; }
+ virtual int GetStatus() const { return m_wStatus; }
+
int GetImageId() const override;
void LoadSettings() override {}
void ScrollToBottom() override;
@@ -181,6 +188,9 @@ public:
INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
int Resizer(UTILRESIZECONTROL *urc) override;
+ virtual const char* GetProto() const { return m_si->pszModule; }
+ virtual int GetStatus() const { return m_si->wStatus; }
+
int GetImageId() const override;
void LoadSettings() override;
void RedrawLog() override;
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h
index 713dbaf132..7d19e3b7a9 100644
--- a/src/core/stdmsg/src/stdafx.h
+++ b/src/core/stdmsg/src/stdafx.h
@@ -70,6 +70,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <m_popup.h>
#include <m_srmm_int.h>
+/////////////////////////////////////////////////////////////////////////////////////////
+
+struct MODULEINFO : public GCModuleInfoBase
+{
+ HICON hOnlineIcon, hOfflineIcon;
+ int OnlineIconIndex, OfflineIconIndex;
+};
+
+struct SESSION_INFO : public GCSessionInfoBase {};
+struct LOGSTREAMDATA : public GCLogStreamDataBase {};
+
#include "cmdlist.h"
#include "msgs.h"
#include "globals.h"
@@ -86,15 +97,6 @@ extern HINSTANCE g_hInst;
/////////////////////////////////////////////////////////////////////////////////////////
-struct MODULEINFO : public GCModuleInfoBase
-{
- HICON hOnlineIcon, hOfflineIcon;
- int OnlineIconIndex, OfflineIconIndex;
-};
-
-struct SESSION_INFO : public GCSessionInfoBase {};
-struct LOGSTREAMDATA : public GCLogStreamDataBase {};
-
struct GlobalLogSettings : public GlobalLogSettingsBase
{
int iX, iY;
diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp
index 65dffff4b5..f185a1de1f 100644
--- a/src/core/stdmsg/src/tabs.cpp
+++ b/src/core/stdmsg/src/tabs.cpp
@@ -285,25 +285,28 @@ void CTabbedWindow::FixTabIcons(CMsgDialog *pDlg)
return;
int image = pDlg->GetImageId();
- if (pDlg == m_pEmbed) {
- SendMessage(m_hwnd, WM_SETICON, 0, (LPARAM)ImageList_GetIcon(Clist_GetImageList(), image, 0));
- return;
- }
- int idx = m_tab.GetDlgIndex(pDlg);
- if (idx == -1)
- return;
+ // if tabs are turned off, simply change the window's icon, otherwise set the tab's icon first
+ if (pDlg != m_pEmbed) {
+ int idx = m_tab.GetDlgIndex(pDlg);
+ if (idx == -1)
+ return;
- TCITEM tci = {};
- tci.mask = TCIF_IMAGE;
- TabCtrl_GetItem(m_tab.GetHwnd(), idx, &tci);
- if (tci.iImage != image) {
- tci.iImage = image;
- TabCtrl_SetItem(m_tab.GetHwnd(), idx, &tci);
+ TCITEM tci = {};
+ tci.mask = TCIF_IMAGE;
+ TabCtrl_GetItem(m_tab.GetHwnd(), idx, &tci);
+ if (tci.iImage != image) {
+ tci.iImage = image;
+ TabCtrl_SetItem(m_tab.GetHwnd(), idx, &tci);
+ }
+
+ // set the container's icon only if we're processing the current page
+ if (pDlg != m_tab.GetActivePage())
+ return;
}
- if (pDlg == m_tab.GetActivePage())
- SendMessage(m_hwnd, WM_SETICON, 0, (LPARAM)ImageList_GetIcon(Clist_GetImageList(), image, 0));
+ Window_FreeIcon_IcoLib(m_hwnd);
+ Window_SetProtoIcon_IcoLib(m_hwnd, pDlg->GetProto(), pDlg->GetStatus());
}
void CTabbedWindow::SaveWindowPosition(bool bUpdateSession)