From f7d7c40c372287642424883fc64b95edeb4461c9 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 6 Jun 2018 20:53:00 +0300 Subject: CCtrlPages::CheckRowCount() - new function to force tab resize when the number of rows is changed --- src/core/stdmsg/res/resource.rc | 2 +- src/mir_core/src/CCtrlPages.cpp | 16 +++++++++++++++- src/mir_core/src/mir_core.def | 1 + src/mir_core/src/mir_core64.def | 1 + 4 files changed, 18 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/core/stdmsg/res/resource.rc b/src/core/stdmsg/res/resource.rc index cb7b963fa3..aebd57bef9 100644 --- a/src/core/stdmsg/res/resource.rc +++ b/src/core/stdmsg/res/resource.rc @@ -165,7 +165,7 @@ IDD_CONTAINER DIALOGEX 0, 0, 275, 200 STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - CONTROL "Tab1",IDC_TAB,"SysTabControl32",TCS_MULTILINE,0,0,275,200 + CONTROL "Tab1",IDC_TAB,"SysTabControl32",TCS_MULTILINE | TCS_FOCUSNEVER | WS_CLIPSIBLINGS,0,0,275,200 END IDD_FILTER DIALOGEX 0, 0, 83, 125 diff --git a/src/mir_core/src/CCtrlPages.cpp b/src/mir_core/src/CCtrlPages.cpp index f14d43f786..b0d07450cc 100644 --- a/src/mir_core/src/CCtrlPages.cpp +++ b/src/mir_core/src/CCtrlPages.cpp @@ -135,7 +135,7 @@ void CCtrlPages::AddPage(const wchar_t *ptszName, HICON hIcon, CDlgBase *pDlg) ShowPage(m_pActivePage); } } - else m_pages.insert(info); + m_pages.insert(info); } void CCtrlPages::ActivatePage(int iPage) @@ -160,6 +160,16 @@ void CCtrlPages::ActivatePage(int iPage) ::SendMessage(m_pActivePage->GetHwnd(), WM_MOUSEACTIVATE, 0, 0); } +void CCtrlPages::CheckRowCount() +{ + int iRowCount = TabCtrl_GetRowCount(m_hwnd); + if (m_numRows != iRowCount) { + m_numRows = iRowCount; + for (auto &p : m_pages) + p->m_bScheduledResize = true; + } +} + int CCtrlPages::GetCount() { return TabCtrl_GetItemCount(m_hwnd); @@ -226,6 +236,8 @@ void CCtrlPages::InsertPage(TPageInfo *pPage) } TabCtrl_InsertItem(m_hwnd, TabCtrl_GetItemCount(m_hwnd), &tci); + + CheckRowCount(); } void CCtrlPages::RemovePage(int iPage) @@ -236,6 +248,8 @@ void CCtrlPages::RemovePage(int iPage) TabCtrl_DeleteItem(m_hwnd, iPage); delete p; + + CheckRowCount(); } void CCtrlPages::ShowPage(CDlgBase *pDlg) diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index 4bb5b14e91..678e5453e5 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -1067,3 +1067,4 @@ CallObjectEventHook @1259 ?db_get_wsm@@YG?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@IPBD0@Z @1261 NONAME ?CreateLink@CDlgBase@@IAEXAAVCCtrlData@@PBDEK@Z @1262 NONAME ?CreateLink@CDlgBase@@IAEXAAVCCtrlData@@PBDPA_W@Z @1263 NONAME +?CheckRowCount@CCtrlPages@@AAEXXZ @1264 NONAME diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index 638caf74fb..f84202ff91 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -1067,3 +1067,4 @@ CallObjectEventHook @1259 ?db_get_wsm@@YA?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@IPEBD0@Z @1261 NONAME ?CreateLink@CDlgBase@@IEAAXAEAVCCtrlData@@PEBDEK@Z @1262 NONAME ?CreateLink@CDlgBase@@IEAAXAEAVCCtrlData@@PEBDPEA_W@Z @1263 NONAME +?CheckRowCount@CCtrlPages@@AEAAXXZ @1264 NONAME -- cgit v1.2.3