summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-03-22 20:28:56 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-03-22 20:28:56 +0300
commit6e97fc04aa23723077c138b7cb028a5a8793ddf6 (patch)
tree95a62c2f2c1f8314e389560cec5a504c2d08f5c3 /src/core
parent0ff53148fe18ad476e47eae46e7ed6f3a8b56886 (diff)
common nick list drawing code removed from DlgProc()
Diffstat (limited to 'src/core')
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp80
-rw-r--r--src/core/stdmsg/src/msgs.h1
2 files changed, 41 insertions, 40 deletions
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index 691afe4cc6..ff1cb96e1e 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -623,46 +623,6 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
CallService(MS_AV_DRAWAVATAR, 0, (LPARAM)&adr);
return TRUE;
}
-
- if (dis->CtlID == IDC_SRMM_NICKLIST) {
- int index = dis->itemID;
- USERINFO *ui = g_chatApi.SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, index);
- if (ui) {
- int x_offset = 2;
-
- int height = dis->rcItem.bottom - dis->rcItem.top;
- if (height & 1)
- height++;
-
- int offset = (height == 10) ? 0 : height / 2 - 4;
- HFONT hFont = (ui->iStatusEx == 0) ? g_Settings.UserListFont : g_Settings.UserListHeadingsFont;
- HFONT hOldFont = (HFONT)SelectObject(dis->hDC, hFont);
- SetBkMode(dis->hDC, TRANSPARENT);
-
- if (dis->itemAction == ODA_FOCUS && dis->itemState & ODS_SELECTED)
- FillRect(dis->hDC, &dis->rcItem, g_chatApi.hListSelectedBkgBrush);
- else //if (dis->itemState & ODS_INACTIVE)
- FillRect(dis->hDC, &dis->rcItem, g_chatApi.hListBkgBrush);
-
- if (g_Settings.bShowContactStatus && g_Settings.bContactStatusFirst && ui->ContactStatus) {
- HICON hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus);
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, nullptr, DI_NORMAL);
- x_offset += 18;
- }
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset, g_chatApi.SM_GetStatusIcon(m_si, ui), 10, 10, 0, nullptr, DI_NORMAL);
- x_offset += 12;
- if (g_Settings.bShowContactStatus && !g_Settings.bContactStatusFirst && ui->ContactStatus) {
- HICON hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus);
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, nullptr, DI_NORMAL);
- x_offset += 18;
- }
-
- SetTextColor(dis->hDC, ui->iStatusEx == 0 ? g_Settings.crUserListColor : g_Settings.crUserListHeadingsColor);
- TextOut(dis->hDC, dis->rcItem.left + x_offset, dis->rcItem.top, ui->pszNick, (int)mir_wstrlen(ui->pszNick));
- SelectObject(dis->hDC, hOldFont);
- }
- return TRUE;
- }
}
break;
@@ -1251,6 +1211,46 @@ void CMsgDialog::CloseTab()
else SendMessage(m_hwndParent, WM_CLOSE, 0, 0);
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+void CMsgDialog::DrawNickList(USERINFO *ui, DRAWITEMSTRUCT *dis)
+{
+ int x_offset = 2;
+
+ int height = dis->rcItem.bottom - dis->rcItem.top;
+ if (height & 1)
+ height++;
+
+ int offset = (height == 10) ? 0 : height / 2 - 4;
+ HFONT hFont = (ui->iStatusEx == 0) ? g_Settings.UserListFont : g_Settings.UserListHeadingsFont;
+ HFONT hOldFont = (HFONT)SelectObject(dis->hDC, hFont);
+ SetBkMode(dis->hDC, TRANSPARENT);
+
+ if (dis->itemAction == ODA_FOCUS && dis->itemState & ODS_SELECTED)
+ FillRect(dis->hDC, &dis->rcItem, g_chatApi.hListSelectedBkgBrush);
+ else //if (dis->itemState & ODS_INACTIVE)
+ FillRect(dis->hDC, &dis->rcItem, g_chatApi.hListBkgBrush);
+
+ if (g_Settings.bShowContactStatus && g_Settings.bContactStatusFirst && ui->ContactStatus) {
+ HICON hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus);
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, nullptr, DI_NORMAL);
+ x_offset += 18;
+ }
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset, g_chatApi.SM_GetStatusIcon(m_si, ui), 10, 10, 0, nullptr, DI_NORMAL);
+ x_offset += 12;
+ if (g_Settings.bShowContactStatus && !g_Settings.bContactStatusFirst && ui->ContactStatus) {
+ HICON hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus);
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, nullptr, DI_NORMAL);
+ x_offset += 18;
+ }
+
+ SetTextColor(dis->hDC, ui->iStatusEx == 0 ? g_Settings.crUserListColor : g_Settings.crUserListHeadingsColor);
+ TextOut(dis->hDC, dis->rcItem.left + x_offset, dis->rcItem.top, ui->pszNick, (int)mir_wstrlen(ui->pszNick));
+ SelectObject(dis->hDC, hOldFont);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
void CMsgDialog::EventAdded(MEVENT hDbEvent, const DBEVENTINFO &dbei)
{
if (m_hDbEventFirst == 0)
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h
index 7a3656500a..080a335328 100644
--- a/src/core/stdmsg/src/msgs.h
+++ b/src/core/stdmsg/src/msgs.h
@@ -152,6 +152,7 @@ public:
}
void CloseTab() override;
+ void DrawNickList(USERINFO *ui, DRAWITEMSTRUCT *dis) override;
void EventAdded(MEVENT, const DBEVENTINFO &dbei) override;
bool GetFirstEvent() override;
bool IsActive() const override;