Exemple #1
0
CopasiWidget * CQTabWidget::getTab(int index)
{
  if (index < getNumTabs())
    return mPages[index];

  return NULL;
}
void DemoContentComponent::lookAndFeelChanged()
{
    auto backgroundColour = findColour (ResizableWindow::backgroundColourId);

    for (int i = 0; i < getNumTabs(); ++i)
        setTabBackgroundColour (i, backgroundColour);
}
Exemple #3
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);
}
Exemple #4
0
void EdoTabs::buttonClicked (Button* button)
{
	int newTabIndex	= -1;
	int tabIndex	= -1;

	if (button == next)
	{
		tabIndex = getCurrentTabIndex();
		if ( tabIndex == -1 || tabIndex == (getNumTabs()-1) )
			return;
		else
			newTabIndex = tabIndex + 1;
	}
	if (button == prev)
	{
		tabIndex = getCurrentTabIndex();
		if ( tabIndex == -1 || tabIndex == 0 )
			return;
		else
			newTabIndex = tabIndex - 1;
	}

	edoTabs.move (tabIndex, newTabIndex);
	reorganizeTabs(newTabIndex);
}
void SlidingPanelComponent::resized()
{
    pageHolder.setBounds (-currentIndex * getWidth(), pageHolder.getPosition().y,
                          getNumTabs() * getWidth(), getHeight());

    Rectangle<int> content (getLocalBounds());

    Rectangle<int> dotHolder = content.removeFromBottom (20 + dotSize)
                                 .reduced ((content.getWidth() - dotSize * getNumTabs()) / 2, 10);

    for (int i = 0; i < getNumTabs(); ++i)
        pages.getUnchecked(i)->dotButton->setBounds (dotHolder.removeFromLeft (dotSize));

    for (int i = pages.size(); --i >= 0;)
        if (Component* c = pages.getUnchecked(i)->content)
            c->setBounds (content.translated (i * content.getWidth(), 0));
}
Exemple #6
0
const int EdoTabs::getComponentIndex(Component *componentToLookFor)
{
	for (int i=0; i<getNumTabs(); i++)
	{
		if (getTabContentComponent (i) == componentToLookFor)
			return (i);
	}
	
	return (-1);
}
void DemoContentComponent::ensureDemoIsShowing()
{
    if (getCurrentTabIndex() == (getNumTabs() - 1))
        setCurrentTabIndex (0);
}