summaryrefslogtreecommitdiff
path: root/src/mir_core
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-04-28 16:42:53 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-04-28 16:42:53 +0300
commita8ef07a8ac3cd25fae13f6b9174828310497d9b6 (patch)
tree6feaa1d847c95bacb165417114261cacc27bfc63 /src/mir_core
parent0999f2e0525dffdd53c25dcd7cea47f5e5c9b7d9 (diff)
CCtrlPages: owned dialogs to be created from the very beginning
Diffstat (limited to 'src/mir_core')
-rw-r--r--src/mir_core/src/Windows/CCtrlPages.cpp44
-rw-r--r--src/mir_core/src/mir_core.def1
-rw-r--r--src/mir_core/src/mir_core64.def1
3 files changed, 28 insertions, 18 deletions
diff --git a/src/mir_core/src/Windows/CCtrlPages.cpp b/src/mir_core/src/Windows/CCtrlPages.cpp
index 7060c9b751..b5b70907eb 100644
--- a/src/mir_core/src/Windows/CCtrlPages.cpp
+++ b/src/mir_core/src/Windows/CCtrlPages.cpp
@@ -59,8 +59,11 @@ void CCtrlPages::OnInit()
CSuper::OnInit();
Subclass();
- for (auto &it : m_pages)
+ for (auto &it : m_pages) {
InsertPage(it);
+ if (m_bOwnPages)
+ CreatePage(it->m_pDlg);
+ }
m_pages.destroy();
::SetWindowLongPtr(m_hwnd, GWL_EXSTYLE, ::GetWindowLongPtr(m_hwnd, GWL_EXSTYLE) | WS_EX_CONTROLPARENT);
@@ -180,6 +183,26 @@ void CCtrlPages::CheckRowCount()
}
}
+void CCtrlPages::CreatePage(CDlgBase *pDlg)
+{
+ pDlg->SetParent(m_bOwnPages ? m_hwnd : GetParent()->GetHwnd());
+ pDlg->Create();
+
+ RECT rc;
+ GetClientRect(m_hwnd, &rc);
+ TabCtrl_AdjustRect(m_hwnd, FALSE, &rc);
+ SetWindowPos(pDlg->GetHwnd(), HWND_TOP, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_NOACTIVATE);
+
+ EnableThemeDialogTexture(pDlg->GetHwnd(), ETDT_ENABLETAB);
+
+ PSHNOTIFY pshn;
+ pshn.hdr.code = PSN_INFOCHANGED;
+ pshn.hdr.hwndFrom = pDlg->GetHwnd();
+ pshn.hdr.idFrom = 0;
+ pshn.lParam = 0;
+ SendMessage(pshn.hdr.hwndFrom, WM_NOTIFY, 0, (LPARAM)&pshn);
+}
+
int CCtrlPages::GetCount()
{
return TabCtrl_GetItemCount(m_hwnd);
@@ -265,24 +288,9 @@ void CCtrlPages::RemovePage(int iPage)
void CCtrlPages::ShowPage(CDlgBase *pDlg)
{
- if (pDlg->GetHwnd() == nullptr) {
- pDlg->SetParent(m_bOwnPages ? m_hwnd : GetParent()->GetHwnd());
- pDlg->Create();
-
- RECT rc;
- GetClientRect(m_hwnd, &rc);
- TabCtrl_AdjustRect(m_hwnd, FALSE, &rc);
- SetWindowPos(pDlg->GetHwnd(), HWND_TOP, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_NOACTIVATE);
-
- EnableThemeDialogTexture(pDlg->GetHwnd(), ETDT_ENABLETAB);
+ if (pDlg->GetHwnd() == nullptr)
+ CreatePage(pDlg);
- PSHNOTIFY pshn;
- pshn.hdr.code = PSN_INFOCHANGED;
- pshn.hdr.hwndFrom = pDlg->GetHwnd();
- pshn.hdr.idFrom = 0;
- pshn.lParam = 0;
- SendMessage(pshn.hdr.hwndFrom, WM_NOTIFY, 0, (LPARAM)&pshn);
- }
ShowWindow(pDlg->GetHwnd(), SW_SHOW);
}
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def
index 64c5ef15f4..c0a444d6ec 100644
--- a/src/mir_core/src/mir_core.def
+++ b/src/mir_core/src/mir_core.def
@@ -1552,3 +1552,4 @@ db_event_updateId @1772
?db_get_usm@@YG?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@IPBD00@Z @1773 NONAME
?SetPageOwner@CCtrlPages@@QAEXXZ @1774 NONAME
?db_event_setJson@@YGHIPBDPAUDBVARIANT@@@Z @1775 NONAME
+?CreatePage@CCtrlPages@@AAEXPAVCDlgBase@@@Z @1776 NONAME
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def
index 023b1b23b8..b68c98f66d 100644
--- a/src/mir_core/src/mir_core64.def
+++ b/src/mir_core/src/mir_core64.def
@@ -1552,3 +1552,4 @@ db_event_updateId @1772
?db_get_usm@@YA?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@IPEBD00@Z @1773 NONAME
?SetPageOwner@CCtrlPages@@QEAAXXZ @1774 NONAME
?db_event_setJson@@YAHIPEBDPEAUDBVARIANT@@@Z @1775 NONAME
+?CreatePage@CCtrlPages@@AEAAXPEAVCDlgBase@@@Z @1776 NONAME