diff options
author | George Hazan <ghazan@miranda.im> | 2022-06-20 14:58:04 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-06-20 14:58:04 +0300 |
commit | b52aae1e9c6355d1725e000dcf8824fc2fe40383 (patch) | |
tree | bbc1ef23af3de05a59038145e1b36db6ca8cf2b4 /src/core | |
parent | 5fb505e97bca59badf137b524c54629fa51a8d65 (diff) |
time to get rid of some DlgProc defined just to handle WM_SIZE issues
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/stdmsg/src/stdafx.h | 1 | ||||
-rw-r--r-- | src/core/stdmsg/src/tabs.cpp | 27 | ||||
-rw-r--r-- | src/core/stduserinfo/src/contactinfo.cpp | 35 |
3 files changed, 36 insertions, 27 deletions
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h index ef484f4f68..6dd1a92181 100644 --- a/src/core/stdmsg/src/stdafx.h +++ b/src/core/stdmsg/src/stdafx.h @@ -117,6 +117,7 @@ public: INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
int Resizer(UTILRESIZECONTROL *urc) override;
+ void OnResize() override;
};
extern CTabbedWindow *g_pTabDialog;
diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp index ad11e2afa9..61c2426641 100644 --- a/src/core/stdmsg/src/tabs.cpp +++ b/src/core/stdmsg/src/tabs.cpp @@ -188,6 +188,21 @@ void CTabbedWindow::OnDestroy() g_pTabDialog = nullptr; } +void CTabbedWindow::OnResize() +{ + CDlgBase::OnResize(); + + SendMessage(m_hwndStatus, WM_SIZE, 0, 0); + + if (m_pEmbed) { + RECT rc; + GetClientRect(m_tab.GetHwnd(), &rc); + MoveWindow(m_pEmbed->GetHwnd(), 0, 0, rc.right - rc.left, rc.bottom - rc.top, FALSE); + } + + SaveWindowPosition(false); +} + int CTabbedWindow::Resizer(UTILRESIZECONTROL *urc) { if (urc->wId == IDC_TAB) { @@ -639,17 +654,7 @@ INT_PTR CTabbedWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) break; } - LRESULT res = CDlgBase::DlgProc(msg, wParam, lParam); - if (msg == WM_SIZE) { - SendMessage(m_hwndStatus, WM_SIZE, 0, 0); - if (m_pEmbed) { - GetClientRect(m_tab.GetHwnd(), &rc); - MoveWindow(m_pEmbed->GetHwnd(), 0, 0, rc.right - rc.left, rc.bottom - rc.top, FALSE); - } - SaveWindowPosition(false); - } - - return res; + return CDlgBase::DlgProc(msg, wParam, lParam); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/stduserinfo/src/contactinfo.cpp b/src/core/stduserinfo/src/contactinfo.cpp index 475c0d3de0..a66401ea6d 100644 --- a/src/core/stduserinfo/src/contactinfo.cpp +++ b/src/core/stduserinfo/src/contactinfo.cpp @@ -216,11 +216,13 @@ static int IsOverEmail(HWND hwndDlg, wchar_t *szEmail, int cchEmail) class CContactPage : public CUserInfoPageDlg
{
+ typedef CUserInfoPageDlg CSuper;
+
CCtrlListView m_emails, m_phones;
public:
CContactPage() :
- CUserInfoPageDlg(g_plugin, IDD_INFO_CONTACT),
+ CSuper(g_plugin, IDD_INFO_CONTACT),
m_emails(this, IDC_EMAILS),
m_phones(this, IDC_PHONES)
{
@@ -259,6 +261,21 @@ public: return true;
}
+ void OnResize() override
+ {
+ CSuper::OnResize();
+
+ RECT rc;
+ GetClientRect(m_emails.GetHwnd(), &rc);
+ rc.right -= GetSystemMetrics(SM_CXVSCROLL);
+
+ m_emails.SetColumnWidth(0, rc.right / 4);
+ m_emails.SetColumnWidth(1, rc.right - rc.right / 4 - 40);
+
+ m_phones.SetColumnWidth(0, rc.right / 4);
+ m_phones.SetColumnWidth(1, rc.right - rc.right / 4 - 90);
+ }
+
int Resizer(UTILRESIZECONTROL *urc) override
{
switch (urc->wId) {
@@ -528,21 +545,7 @@ public: }
}
- INT_PTR res = CDlgBase::DlgProc(msg, wParam, lParam);
-
- if (msg == WM_SIZE) {
- RECT rc;
- GetClientRect(m_emails.GetHwnd(), &rc);
- rc.right -= GetSystemMetrics(SM_CXVSCROLL);
-
- m_emails.SetColumnWidth(0, rc.right / 4);
- m_emails.SetColumnWidth(1, rc.right - rc.right / 4 - 40);
-
- m_phones.SetColumnWidth(0, rc.right / 4);
- m_phones.SetColumnWidth(1, rc.right - rc.right / 4 - 90);
- }
-
- return res;
+ return CDlgBase::DlgProc(msg, wParam, lParam);
}
};
|