diff options
author | George Hazan <ghazan@miranda.im> | 2017-04-13 14:44:28 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-04-13 14:44:28 +0300 |
commit | 9f61e31b9ccdfe93b693998cab1baa331f87cd97 (patch) | |
tree | e48c97d10a90ef4a544bd84ccb5fd6cae6603e4a /src | |
parent | b217f24e496c98b4f7af416ca61e67571fb6b2bf (diff) |
two new functions: CDlgBase::Resize & Hide
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stdmsg/src/chat_window.cpp | 4 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 8 | ||||
-rw-r--r-- | src/mir_app/src/netlibopts.cpp | 4 | ||||
-rw-r--r-- | src/mir_app/src/options.cpp | 2 | ||||
-rw-r--r-- | src/mir_core/src/CCtrlPages.cpp | 6 | ||||
-rw-r--r-- | src/mir_core/src/CDlgBase.cpp | 28 | ||||
-rw-r--r-- | src/mir_core/src/mir_core.def | 2 | ||||
-rw-r--r-- | src/mir_core/src/mir_core64.def | 2 |
8 files changed, 38 insertions, 18 deletions
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index d9114da0ae..0d5ae4e629 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -112,7 +112,7 @@ void CChatRoomDlg::onClick_NickList(CCtrlButton *pButton) pButton->SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(m_bNicklistEnabled ? "nicklist" : "nicklist2", FALSE)); ScrollToBottom(); - SendMessage(m_hwnd, WM_SIZE, 0, 0); + Resize(); } void CChatRoomDlg::onClick_Ok(CCtrlButton *pButton) @@ -321,7 +321,7 @@ void CChatRoomDlg::UpdateOptions() m_nickList.SendMsg(LB_SETITEMHEIGHT, 0, height > font ? height : font); InvalidateRect(m_nickList.GetHwnd(), nullptr, TRUE); - SendMessage(m_hwnd, WM_SIZE, 0, 0); + Resize(); RedrawLog2(); } diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index a39c109175..c3ed9caeee 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -387,7 +387,7 @@ void CSrmmWindow::OnOptionsApplied(bool bUpdateAvatar) if (m_avatarPic == nullptr || !g_dat.bShowAvatar)
m_avatar.Hide();
SendMessage(m_hwnd, DM_UPDATETITLE, 0, 0);
- SendMessage(m_hwnd, WM_SIZE, 0, 0);
+ Resize();
if (m_hBkgBrush)
DeleteObject(m_hBkgBrush);
@@ -964,7 +964,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (rc.bottom - rc.top < m_minEditBoxSize.cy)
m_splitter.OnChange(&m_splitter);
- SendMessage(m_hwnd, WM_SIZE, 0, 0);
+ Resize();
break;
case DM_GETAVATAR:
@@ -1063,14 +1063,14 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) GetWindowText(m_hwnd, oldtitle, _countof(oldtitle));
if (mir_wstrcmp(newtitle, oldtitle)) { //swt() flickers even if the title hasn't actually changed
SetWindowText(m_pOwner->GetHwnd(), newtitle);
- SendMessage(m_hwnd, WM_SIZE, 0, 0);
+ Resize();
}
break;
case DM_NEWTIMEZONE:
m_hTimeZone = TimeZone_CreateByContact(m_hContact, 0, TZF_KNOWNONLY);
m_wMinute = 61;
- SendMessage(m_hwnd, WM_SIZE, 0, 0);
+ Resize();
break;
case DM_CASCADENEWWINDOW:
diff --git a/src/mir_app/src/netlibopts.cpp b/src/mir_app/src/netlibopts.cpp index 3a37e0b295..f079b19fd3 100644 --- a/src/mir_app/src/netlibopts.cpp +++ b/src/mir_app/src/netlibopts.cpp @@ -304,7 +304,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, CopySettingsStruct(&settings, &tempSettings[iUser]->settings);
flags = tempSettings[iUser]->flags;
}
- ShowMultipleControls(hwndDlg, outgoingConnectionsControls, _countof(outgoingConnectionsControls), flags&NUF_OUTGOING ? SW_SHOW : SW_HIDE);
+ ShowMultipleControls(hwndDlg, outgoingConnectionsControls, _countof(outgoingConnectionsControls), flags & NUF_OUTGOING ? SW_SHOW : SW_HIDE);
CheckDlgButton(hwndDlg, IDC_USEPROXY, settings.useProxy);
SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_RESETCONTENT, 0, 0);
if (settings.proxyType == 0) AddProxyTypeItem(hwndDlg, 0, settings.proxyType);
@@ -323,7 +323,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, CheckDlgButton(hwndDlg, IDC_PROXYDNS, settings.dnsThroughProxy);
CheckDlgButton(hwndDlg, IDC_VALIDATESSL, settings.validateSSL);
- ShowMultipleControls(hwndDlg, incomingConnectionsControls, _countof(incomingConnectionsControls), flags&NUF_INCOMING ? SW_SHOW : SW_HIDE);
+ ShowMultipleControls(hwndDlg, incomingConnectionsControls, _countof(incomingConnectionsControls), flags & NUF_INCOMING ? SW_SHOW : SW_HIDE);
CheckDlgButton(hwndDlg, IDC_SPECIFYPORTS, settings.specifyIncomingPorts);
SetDlgItemTextA(hwndDlg, IDC_PORTSRANGE, settings.szIncomingPorts ? settings.szIncomingPorts : "");
diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp index 1e918e3dde..3faa2c9e46 100644 --- a/src/mir_app/src/options.cpp +++ b/src/mir_app/src/options.cpp @@ -883,7 +883,7 @@ public: m_hCurrentPage = p->hTreeItem;
m_pageTree.SelectItem(m_hCurrentPage);
if (opd)
- opd->pDialog->Show(SW_HIDE);
+ opd->pDialog->Hide();
m_currentPage = i;
if (opd)
opd->pDialog->Show();
diff --git a/src/mir_core/src/CCtrlPages.cpp b/src/mir_core/src/CCtrlPages.cpp index c8ec995b7c..deb6dcd756 100644 --- a/src/mir_core/src/CCtrlPages.cpp +++ b/src/mir_core/src/CCtrlPages.cpp @@ -297,7 +297,7 @@ BOOL CCtrlPages::OnNotify(int /*idCtrl*/, NMHDR *pnmh) case TCN_SELCHANGE: if (m_pActivePage != nullptr) - ShowWindow(m_pActivePage->GetHwnd(), SW_HIDE); + m_pActivePage->Hide(); if (info = GetCurrPage()) { m_pActivePage = info->m_pDlg; @@ -357,9 +357,9 @@ void CCtrlPages::OnApply() if (GetWindowLongPtr(pshn.hdr.hwndFrom, DWLP_MSGRESULT) == PSNRET_INVALID_NOCHANGEPAGE) { TabCtrl_SetCurSel(m_hwnd, i); if (m_pActivePage != nullptr) - ShowWindow(m_pActivePage->GetHwnd(), SW_HIDE); + m_pActivePage->Hide(); m_pActivePage = p->m_pDlg; - ShowWindow(m_pActivePage->GetHwnd(), SW_SHOW); + m_pActivePage->Show(); m_parentWnd->Fail(); return; } diff --git a/src/mir_core/src/CDlgBase.cpp b/src/mir_core/src/CDlgBase.cpp index f91afa80a3..6921d47de2 100644 --- a/src/mir_core/src/CDlgBase.cpp +++ b/src/mir_core/src/CDlgBase.cpp @@ -64,16 +64,17 @@ CDlgBase::~CDlgBase() DestroyWindow(m_hwnd); } -void CDlgBase::Create() +///////////////////////////////////////////////////////////////////////////////////////// +// methods + +void CDlgBase::Close() { - CreateDialogParam(m_hInst, MAKEINTRESOURCE(m_idDialog), m_hwndParent, GlobalDlgProc, (LPARAM)this); + ::SendMessage(m_hwnd, WM_CLOSE, 0, 0); } -void CDlgBase::Show(int nCmdShow) +void CDlgBase::Create() { - if (m_hwnd == nullptr) - Create(); - ShowWindow(m_hwnd, nCmdShow); + CreateDialogParam(m_hInst, MAKEINTRESOURCE(m_idDialog), m_hwndParent, GlobalDlgProc, (LPARAM)this); } int CDlgBase::DoModal() @@ -93,12 +94,27 @@ void CDlgBase::NotifyChange(void) SendMessage(m_hwndParent, PSM_CHANGED, (WPARAM)m_hwnd, 0); } +void CDlgBase::Resize() +{ + SendMessage(m_hwnd, WM_SIZE, 0, 0); +} + void CDlgBase::SetCaption(const wchar_t *ptszCaption) { if (m_hwnd && ptszCaption) SetWindowText(m_hwnd, ptszCaption); } +void CDlgBase::Show(int nCmdShow) +{ + if (m_hwnd == nullptr) + Create(); + ShowWindow(m_hwnd, nCmdShow); +} + +///////////////////////////////////////////////////////////////////////////////////////// +// virtual methods + int CDlgBase::Resizer(UTILRESIZECONTROL*) { return RD_ANCHORX_LEFT | RD_ANCHORY_TOP; diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index cc09ff681f..ebc69f8d19 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -1048,3 +1048,5 @@ CallFunctionSync @1170 ?GetRichTextUtf@CCtrlRichEdit@@QBEPADXZ @1235 NONAME
?GetRichTextRtf@CCtrlRichEdit@@QBEPAD_N0@Z @1236 NONAME
?SetReadOnly@CCtrlRichEdit@@QAEX_N@Z @1237 NONAME
+?Hide@CDlgBase@@QAEXXZ @1238 NONAME
+?Resize@CDlgBase@@QAEXXZ @1239 NONAME
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index 6d4473cab5..2e5c83b8af 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -1048,3 +1048,5 @@ CallFunctionSync @1170 ?GetRichTextUtf@CCtrlRichEdit@@QEBAPEADXZ @1235 NONAME
?GetRichTextRtf@CCtrlRichEdit@@QEBAPEAD_N0@Z @1236 NONAME
?SetReadOnly@CCtrlRichEdit@@QEAAX_N@Z @1237 NONAME
+?Hide@CDlgBase@@QEAAXXZ @1238 NONAME
+?Resize@CDlgBase@@QEAAXXZ @1239 NONAME
|