reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit 33aa2cf5e838b2688a3ab49e1155084a38d586a4
parent d60e9ec705d4ebc99cacbc8e19e4b86e78729eca
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Mon,  1 Feb 2016 14:15:32 -0800

fix TabBar::removeTab

Diffstat:
Msrc/about.cpp | 4+++-
Msrc/tabbar.cpp | 19++++++++++++++-----
Msrc/tabbar.hpp | 1+
3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/src/about.cpp b/src/about.cpp @@ -97,8 +97,10 @@ void About::populate() "{\\field{\\*\\fldinst{HYPERLINK \"https://msdn.microsoft.com/en-us/library/windows/desktop/bb787974%28v=vs.85%29.aspx\"}}{\\fldrslt \\f0\\fs24 \\cf0 \\'d0\\'c2\\'ca\\'c0\\'bd\\'e7\\'a4\\'e8\\'a4\\'ea}}}\n" ; - if(!m_about->setRichText(tmpRtf)) + if(!m_about->setRichText(tmpRtf)) { m_tabs->removeTab(0); + m_tabs->setCurrentIndex(0); + } m_cats->addRow({AUTO_STR("<All Categories>")}); diff --git a/src/tabbar.cpp b/src/tabbar.cpp @@ -22,7 +22,7 @@ #endif TabBar::TabBar(const Tabs &tabs, HWND handle) - : Control(handle), m_size(0), m_lastPage(0) + : Control(handle), m_size(0), m_lastPage(-1) { for(const Tab &tab : tabs) addTab(tab); @@ -54,12 +54,21 @@ int TabBar::currentIndex() const return TabCtrl_GetCurSel(handle()); } +void TabBar::setCurrentIndex(const int index) +{ + TabCtrl_SetCurSel(handle(), index); + switchPage(); +} + void TabBar::removeTab(const int index) { - if(TabCtrl_DeleteItem(handle(), index)) { - m_pages.erase(m_pages.begin() + index); - switchPage(); - } + if(!TabCtrl_DeleteItem(handle(), index)) + return; + + for(HWND control : m_pages[index]) + ShowWindow(control, SW_HIDE); + + m_pages.erase(m_pages.begin() + index); } void TabBar::onNotify(LPNMHDR info, LPARAM) diff --git a/src/tabbar.hpp b/src/tabbar.hpp @@ -33,6 +33,7 @@ public: TabBar(const Tabs &tabs, HWND handle); int addTab(const Tab &); int currentIndex() const; + void setCurrentIndex(const int); void removeTab(const int); protected: