summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-03-17 20:06:53 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-03-17 20:06:53 +0300
commita3e6a1d65e4cac0bea2c4c075437b4dece8986ef (patch)
treecabe887f3d72bac5defe34f43a8dc7b7d72eac22 /src
parentcaf290fb9b71267941a5d19a63dde6e8e93fab9e (diff)
CCtrlPages::SwapPages - a new method to swap two pages in a tab cobtrol
Diffstat (limited to 'src')
-rw-r--r--src/mir_core/src/mir_core.def1
-rw-r--r--src/mir_core/src/mir_core64.def1
-rw-r--r--src/mir_core/src/ui_utils.cpp22
3 files changed, 24 insertions, 0 deletions
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def
index 7456920715..7c3fe59af1 100644
--- a/src/mir_core/src/mir_core.def
+++ b/src/mir_core/src/mir_core.def
@@ -1064,3 +1064,4 @@ CallFunctionSync @1170
?CustomWndProc@CSplitter@@MAEJIIJ@Z @1221 NONAME
?GetPos@CSplitter@@QBEHXZ @1222 NONAME
?OnInit@CSplitter@@MAEXXZ @1223 NONAME
+?SwapPages@CCtrlPages@@QAEXHH@Z @1224 NONAME
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def
index ef5d3f229a..baacfbe55c 100644
--- a/src/mir_core/src/mir_core64.def
+++ b/src/mir_core/src/mir_core64.def
@@ -1064,3 +1064,4 @@ CallFunctionSync @1170
?CustomWndProc@CSplitter@@MEAA_JI_K_J@Z @1221 NONAME
?GetPos@CSplitter@@QEBAHXZ @1222 NONAME
?OnInit@CSplitter@@MEAAXXZ @1223 NONAME
+?SwapPages@CCtrlPages@@QEAAXHH@Z @1224 NONAME
diff --git a/src/mir_core/src/ui_utils.cpp b/src/mir_core/src/ui_utils.cpp
index 2c05d41c8a..247d4cb66f 100644
--- a/src/mir_core/src/ui_utils.cpp
+++ b/src/mir_core/src/ui_utils.cpp
@@ -2463,6 +2463,28 @@ void CCtrlPages::ShowPage(CDlgBase *pDlg)
ShowWindow(pDlg->GetHwnd(), SW_SHOW);
}
+void CCtrlPages::SwapPages(int idx1, int idx2)
+{
+ TPageInfo *p1 = GetItemPage(idx1), *p2 = GetItemPage(idx2);
+ if (p1 == nullptr || p2 == nullptr)
+ return;
+
+ TabCtrl_DeleteItem(m_hwnd, idx1);
+
+ TCITEM tci = { 0 };
+ tci.mask = TCIF_PARAM | TCIF_TEXT;
+ tci.lParam = (LPARAM)p1;
+ tci.pszText = TranslateW(p1->m_ptszHeader);
+ TabCtrl_InsertItem(m_hwnd, idx2, &tci);
+
+ int tabCount = GetCount();
+ for (int i = 0; i < tabCount; i++) {
+ TPageInfo *pInfo = GetItemPage(i);
+ if (pInfo)
+ pInfo->m_pageId = i;
+ }
+}
+
BOOL CCtrlPages::OnNotify(int /*idCtrl*/, NMHDR *pnmh)
{
TPageInfo *info;