summaryrefslogtreecommitdiff
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
parentcaf290fb9b71267941a5d19a63dde6e8e93fab9e (diff)
CCtrlPages::SwapPages - a new method to swap two pages in a tab cobtrol
-rw-r--r--include/m_gui.h1
-rw-r--r--libs/win32/mir_core.libbin320876 -> 321158 bytes
-rw-r--r--libs/win64/mir_core.libbin322144 -> 322430 bytes
-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
6 files changed, 25 insertions, 0 deletions
diff --git a/include/m_gui.h b/include/m_gui.h
index 698ee81ba6..00a89a34c3 100644
--- a/include/m_gui.h
+++ b/include/m_gui.h
@@ -1232,6 +1232,7 @@ public:
int GetDlgIndex(CDlgBase*);
CDlgBase* GetNthPage(int iPage);
void RemovePage(int iPage);
+ void SwapPages(int idx1, int idx2);
__forceinline CDlgBase* GetActivePage() const
{ return m_pActivePage;
diff --git a/libs/win32/mir_core.lib b/libs/win32/mir_core.lib
index 441c6f52ff..0707ad6297 100644
--- a/libs/win32/mir_core.lib
+++ b/libs/win32/mir_core.lib
Binary files differ
diff --git a/libs/win64/mir_core.lib b/libs/win64/mir_core.lib
index 3dc43e18c4..98d783c151 100644
--- a/libs/win64/mir_core.lib
+++ b/libs/win64/mir_core.lib
Binary files differ
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;