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

    tabs.remove (tabIndex);

    setCurrentTabIndex (oldIndex);
    resized();
}
void TabbedButtonBar::addTab (const String& tabName,
                              const Colour& tabBackgroundColour,
                              int insertIndex)
{
    jassert (tabName.isNotEmpty()); // you have to give them all a name..

    if (tabName.isNotEmpty())
    {
        if (! isPositiveAndBelow (insertIndex, tabs.size()))
            insertIndex = tabs.size();

        TabInfo* newTab = new TabInfo();
        newTab->name = tabName;
        newTab->colour = tabBackgroundColour;
        newTab->component = createTabButton (tabName, insertIndex);

        jassert (newTab->component != nullptr);

        tabs.insert (insertIndex, newTab);
        addAndMakeVisible (newTab->component, insertIndex);

        resized();

        if (currentTabIndex < 0)
            setCurrentTabIndex (0);
    }
}
void TabbedButtonBar::removeTab (const int tabIndex)
{
    if (((unsigned int) tabIndex) < (unsigned int) tabs.size())
    {
        const int oldTabIndex = currentTabIndex;
        if (currentTabIndex == tabIndex)
            currentTabIndex = -1;

        tabs.remove (tabIndex);
        tabColours.remove (tabIndex);

        delete getTabButton (tabIndex);

        for (int i = tabIndex + 1; i <= tabs.size(); ++i)
        {
            TabBarButton* const tb = getTabButton (i);

            if (tb != 0)
                tb->tabIndex--;
        }

        resized();

        setCurrentTabIndex (jlimit (0, jmax (0, tabs.size() - 1), oldTabIndex));
    }
}
Exemple #4
0
void EdoTabs::reorganizeTabs(const int currentSelectedTabIndex, const bool sortTabsByIndex)
{
	for (int i=0; i<getNumTabs(); i++)
	{
		getTabContentComponent(i)->setComponentProperty (T("deleteByTabComp_"), false);
	}

	TabbedComponent::clearTabs();
	
	if (sortTabsByIndex)
	{
		edoTabs.sort (*this);
	}

	for (int i=0; i<edoTabs.size(); i++)
	{
		Component *c = edoTabs[i]->tabComponent;
		if (c)
		{
			edoTabs[i]->tabIndex = i;
			edoTabs[i]->tabComponent->setComponentProperty (T("tabIndex"), i);
			TabbedComponent::addTab (edoTabs[i]->tabName, edoTabs[i]->tabColour, edoTabs[i]->tabComponent, edoTabs[i]->deleteWhenNotNeeded, i);
		}
	}

	setCurrentTabIndex (currentSelectedTabIndex);
}
void TabbedButtonBar::addTab (const String& tabName,
                              const Colour& tabBackgroundColour,
                              int insertIndex)
{
    jassert (tabName.isNotEmpty()); // you have to give them all a name..

    if (tabName.isNotEmpty())
    {
        if (((unsigned int) insertIndex) > (unsigned int) tabs.size())
            insertIndex = tabs.size();

        for (int i = tabs.size(); --i >= insertIndex;)
        {
            TabBarButton* const tb = getTabButton (i);

            if (tb != 0)
                tb->tabIndex++;
        }

        tabs.insert (insertIndex, tabName);
        tabColours.insert (insertIndex, tabBackgroundColour);

        TabBarButton* const tb = createTabButton (tabName, insertIndex);
        jassert (tb != 0); // your createTabButton() mustn't return zero!

        addAndMakeVisible (tb, insertIndex);

        resized();

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

    TabInfo* const currentTab = tabs [currentTabIndex];
    tabs.remove (tabIndex);
    currentTabIndex = tabs.indexOf (currentTab);
    resized();
}
Exemple #7
0
//==============================================================================
XEQTabPanel::XEQTabPanel (XEQPlugin* plugin_)
    : TabbedComponent (TabbedButtonBar::TabsAtRight),
      plugin (plugin_)
{
    // sub components
    mainComponent = new XEQMain (plugin);
    aboutComponent = new XEQAbout ();

    addTab ("EQualizer", Colour (0xff575f7d), mainComponent, false);
    addTab ("About", Colour (0xff575f7d), aboutComponent, false);
    setCurrentTabIndex (0);
}
//==============================================================================
void TabbedButtonBar::clearTabs()
{
    tabs.clear();
    tabColours.clear();
    currentTabIndex = -1;

    deleteAndZero (extraTabsButton);
    removeChildComponent (behindFrontTab);
    deleteAllChildren();
    addChildComponent (behindFrontTab);

    setCurrentTabIndex (-1);
}
void TabbedButtonBar::removeTab (const int tabIndex)
{
    if (tabs [tabIndex] != nullptr)
    {
        const int oldTabIndex = currentTabIndex;
        if (currentTabIndex == tabIndex)
            currentTabIndex = -1;

        tabs.remove (tabIndex);
        resized();

        setCurrentTabIndex (jlimit (0, jmax (0, tabs.size() - 1), oldTabIndex));
    }
}
void TabbedButtonBar::showExtraItemsMenu()
{
    PopupMenu m;

    for (int i = 0; i < tabs.size(); ++i)
    {
        const TabInfo* const tab = tabs.getUnchecked(i);

        if (! tab->component->isVisible())
            m.addItem (i + 1, tab->name, true, i == currentTabIndex);
    }

    const int res = m.showAt (extraTabsButton);

    if (res != 0)
        setCurrentTabIndex (res - 1);
}
void TabbedButtonBar::buttonClicked (Button* button)
{
    if (extraTabsButton == button)
    {
        PopupMenu m;

        for (int i = 0; i < tabs.size(); ++i)
        {
            TabBarButton* const tb = getTabButton (i);

            if (tb != 0 && ! tb->isVisible())
                m.addItem (tb->tabIndex + 1, tabs[i], true, i == currentTabIndex);
        }

        const int res = m.showAt (extraTabsButton);

        if (res != 0)
            setCurrentTabIndex (res - 1);
    }
}
//==============================================================================
VstPluginWindowTabPanel::VstPluginWindowTabPanel (PluginEditorWindowHolder* owner_,
                                                  BasePlugin* plugin_,
                                                  VstPluginWindow* window_,
                                                  VstPluginWindowContent* content_,
                                                  VstPluginNativeEditor* nativeEditor_,
                                                  VstPluginExternalEditor* externalEditor_)
  : TabbedComponent (TabbedButtonBar::TabsAtBottom),
    owner (owner_),
    plugin (plugin_),
    window (window_),
    content (content_),
    nativeEditor (nativeEditor_),
    externalEditor (externalEditor_),
    viewport (0)
{
    DBG ("VstPluginWindowTabPanel::VstPluginWindowTabPanel");
    
    Colour backgroundColour = window->getBackgroundColour ();
    int lastSelectedTab = plugin->getIntValue (PROP_WINDOWPAGE, 0);

    // external GUI
    if (externalEditor)
        addTab (T("Interface"), backgroundColour, externalEditor, true);

    // native GUI
    if (nativeEditor)
    {
        viewport = new Viewport (String::empty);
        viewport->setScrollBarsShown (true, false);
        viewport->setViewedComponent (nativeEditor);
        addTab (T("Parameters"), backgroundColour, viewport, true);
    }

    // change last saved tab
    setCurrentTabIndex (jmax (0, jmin (1, lastSelectedTab)));
}
//==============================================================================
void TabbedButtonBar::clearTabs()
{
    tabs.clear();
    extraTabsButton = nullptr;
    setCurrentTabIndex (-1);
}
void DemoContentComponent::ensureDemoIsShowing()
{
    if (getCurrentTabIndex() == (getNumTabs() - 1))
        setCurrentTabIndex (0);
}
Exemple #15
0
void EdoTabs::setCurrentTab (Component *contentComponentToActivate)
{
	setCurrentTabIndex (getComponentIndex (contentComponentToActivate));
}