summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_gui.h15
-rw-r--r--src/core/stdmsg/src/tabs.cpp12
-rw-r--r--src/mir_core/src/ui_utils.cpp44
3 files changed, 38 insertions, 33 deletions
diff --git a/include/m_gui.h b/include/m_gui.h
index 98f75a2d46..67ea96ae4b 100644
--- a/include/m_gui.h
+++ b/include/m_gui.h
@@ -1225,20 +1225,7 @@ private:
HIMAGELIST m_hIml;
CDlgBase *m_pActivePage;
- struct TPageInfo : public MZeroedObject
- {
- ~TPageInfo()
- {
- if (m_hIcon)
- DestroyIcon(m_hIcon);
- }
-
- int m_pageId;
- ptrW m_ptszHeader;
- HICON m_hIcon;
- BOOL m_bChanged;
- CDlgBase *m_pDlg;
- };
+ struct TPageInfo;
void InsertPage(TPageInfo *pPage);
void ShowPage(CDlgBase *pDlg);
diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp
index 1686fa546e..11bc1d1e39 100644
--- a/src/core/stdmsg/src/tabs.cpp
+++ b/src/core/stdmsg/src/tabs.cpp
@@ -59,17 +59,9 @@ struct CTabbedWindow : public CDlgBase
virtual int Resizer(UTILRESIZECONTROL *urc)
{
- if (urc->wId == IDC_TAB) {
- if (m_tab.GetActivePage()) {
- RECT rc;
- GetClientRect(m_tab.GetHwnd(), &rc);
- TabCtrl_AdjustRect(m_tab.GetHwnd(), FALSE, &rc);
-
- for (int i = m_tab.GetCount() - 1; i >= 0; i--)
- SetWindowPos(m_tab.GetNthPage(i)->GetHwnd(), NULL, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_NOZORDER | SWP_NOACTIVATE);
- }
+ if (urc->wId == IDC_TAB)
return RD_ANCHORX_WIDTH | RD_ANCHORY_HEIGHT;
- }
+
return RD_ANCHORX_LEFT | RD_ANCHORY_TOP;
}
diff --git a/src/mir_core/src/ui_utils.cpp b/src/mir_core/src/ui_utils.cpp
index 89a5ba09e8..66078c8c66 100644
--- a/src/mir_core/src/ui_utils.cpp
+++ b/src/mir_core/src/ui_utils.cpp
@@ -2223,6 +2223,21 @@ void CCtrlTreeView::SortChildrenCB(TVSORTCB *cb, BOOL fRecurse)
/////////////////////////////////////////////////////////////////////////////////////////
// CCtrlPages
+struct CCtrlPages::TPageInfo : public MZeroedObject
+{
+ ~TPageInfo()
+ {
+ if (m_hIcon)
+ DestroyIcon(m_hIcon);
+ }
+
+ int m_pageId;
+ ptrW m_ptszHeader;
+ HICON m_hIcon;
+ bool m_bChanged, m_bScheduledResize;
+ CDlgBase *m_pDlg;
+};
+
CCtrlPages::CCtrlPages(CDlgBase *dlg, int ctrlId)
: CCtrlBase(dlg, ctrlId),
m_hIml(NULL),
@@ -2261,15 +2276,20 @@ LRESULT CCtrlPages::CustomWndProc(UINT msg, WPARAM wParam, LPARAM lParam)
switch (msg) {
case WM_SIZE:
- RECT rc;
- GetClientRect(m_hwnd, &rc);
- TabCtrl_AdjustRect(m_hwnd, FALSE, &rc);
-
- tabCount = GetCount();
- for (int i = 0; i < tabCount; i++) {
- TPageInfo *p = GetItemPage(i);
- if (p && p->m_pDlg->GetHwnd() != NULL)
- SetWindowPos(p->m_pDlg->GetHwnd(), HWND_TOP, rc.left, rc.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
+ if (TPageInfo *pCurrInfo = GetCurrPage()) {
+ tabCount = GetCount();
+ for (int i = 0; i < tabCount; i++) {
+ TPageInfo *p = GetItemPage(i);
+ if (p == nullptr)
+ continue;
+ if (p == pCurrInfo) {
+ RECT rc;
+ GetClientRect(m_hwnd, &rc);
+ TabCtrl_AdjustRect(m_hwnd, FALSE, &rc);
+ SetWindowPos(p->m_pDlg->GetHwnd(), NULL, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_NOACTIVATE | SWP_NOZORDER);
+ }
+ else p->m_bScheduledResize = true;
+ }
}
break;
@@ -2327,6 +2347,12 @@ void CCtrlPages::ActivatePage(int iPage)
ShowWindow(m_pActivePage->GetHwnd(), SW_HIDE);
m_pActivePage = info->m_pDlg;
+ if (m_pActivePage->GetHwnd() && info->m_bScheduledResize) {
+ RECT rc;
+ GetClientRect(m_hwnd, &rc);
+ TabCtrl_AdjustRect(m_hwnd, FALSE, &rc);
+ SetWindowPos(m_pActivePage->GetHwnd(), NULL, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_NOACTIVATE | SWP_NOZORDER);
+ }
ShowPage(m_pActivePage);
TabCtrl_SetCurSel(m_hwnd, info->m_pageId);