[ChangeRequest] Animated Tabs Remove


#1

Why i can animate moveTab and not removeTab

 

I found that part of code :

void TabbedButtonBar::removeTab (const int tabIndex)
{
    const int oldIndex = currentTabIndex;
    if (tabIndex == currentTabIndex)
        setCurrentTabIndex (-1);

    tabs.remove (tabIndex);

    setCurrentTabIndex (oldIndex);
    resized();
}

and somwhere near there is nice other method:

void TabbedButtonBar::moveTab (const int currentIndex, const int newIndex, const bool animate)
{
    TabInfo* const currentTab = tabs [currentTabIndex];
    tabs.move (currentIndex, newIndex);
    currentTabIndex = tabs.indexOf (currentTab);
    updateTabPositions (animate);
}

 

For me it looks easy fix, and will take no many work, just replace in removeTabe replace signature and resized, to updateTabPositions

or maybe i can do it by my self (but i dont wona create some changes in lib, on my side)


#2

so suggestion is update:
 

void TabbedButtonBar::removeTab (const int tabIndex)
{
    const int oldIndex = currentTabIndex;
    if (tabIndex == currentTabIndex)
        setCurrentTabIndex (-1);

    tabs.remove (tabIndex);

    setCurrentTabIndex (oldIndex);
    resized();
}

 

and change it to:

void TabbedButtonBar::removeTab (const int tabIndex, const bool animate = false)
{
    const int oldIndex = currentTabIndex;
    if (tabIndex == currentTabIndex)
        setCurrentTabIndex (-1);

    tabs.remove (tabIndex);

    setCurrentTabIndex (oldIndex);
    updateTabPositions(animate);
}

in this case it will not brake anything, but will be possible to add nice effect..


#3

Good request, thanks!