summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-06-06 20:53:00 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-06-06 20:53:00 +0300
commitf7d7c40c372287642424883fc64b95edeb4461c9 (patch)
treed71b7b7e5e1e0f2bbe10892dcccc59a7691faa33
parent0ebf6eee52c36fe139edb77730a835479cf0de21 (diff)
CCtrlPages::CheckRowCount() - new function to force tab resize when the number of rows is changed
-rw-r--r--include/m_gui.h29
-rw-r--r--src/core/stdmsg/res/resource.rc2
-rw-r--r--src/mir_core/src/CCtrlPages.cpp16
-rw-r--r--src/mir_core/src/mir_core.def1
-rw-r--r--src/mir_core/src/mir_core64.def1
5 files changed, 33 insertions, 16 deletions
diff --git a/include/m_gui.h b/include/m_gui.h
index d6ed08a7c6..bdabf4d323 100644
--- a/include/m_gui.h
+++ b/include/m_gui.h
@@ -1319,6 +1319,19 @@ class MIR_CORE_EXPORT CCtrlPages : public CCtrlBase
{
typedef CCtrlBase CSuper;
+ HIMAGELIST m_hIml;
+ CDlgBase *m_pActivePage;
+ int m_numRows = 1;
+
+ struct TPageInfo;
+ void InsertPage(TPageInfo *pPage);
+ void ShowPage(CDlgBase *pDlg);
+
+ void CheckRowCount();
+ TPageInfo* GetCurrPage();
+ TPageInfo* GetItemPage(int iPage);
+ LIST<TPageInfo> m_pages;
+
public:
CCtrlPages(CDlgBase *dlg, int ctrlId);
@@ -1326,10 +1339,11 @@ public:
void ActivatePage(int iPage);
int GetCount(void);
int GetDlgIndex(CDlgBase*);
- CDlgBase* GetNthPage(int iPage);
void RemovePage(int iPage);
void SwapPages(int idx1, int idx2);
+ CDlgBase* GetNthPage(int iPage);
+
__forceinline CDlgBase* GetActivePage() const
{ return m_pActivePage;
}
@@ -1344,19 +1358,6 @@ protected:
void OnReset() override;
LRESULT CustomWndProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
-
-private:
- HIMAGELIST m_hIml;
- CDlgBase *m_pActivePage;
-
- struct TPageInfo;
-
- void InsertPage(TPageInfo *pPage);
- void ShowPage(CDlgBase *pDlg);
-
- TPageInfo* GetCurrPage();
- TPageInfo* GetItemPage(int iPage);
- LIST<TPageInfo> m_pages;
};
/////////////////////////////////////////////////////////////////////////////////////////
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