void TabbedComponent::changeCallback (const int newCurrentTabIndex, const String& newTabName) { if (panelComponent != nullptr) { panelComponent->setVisible (false); removeChildComponent (panelComponent); panelComponent = nullptr; } if (getCurrentTabIndex() >= 0) { panelComponent = getTabContentComponent (getCurrentTabIndex()); if (panelComponent != nullptr) { // do these ops as two stages instead of addAndMakeVisible() so that the // component has always got a parent when it gets the visibilityChanged() callback addChildComponent (panelComponent); panelComponent->setVisible (true); panelComponent->toFront (true); } repaint(); } resized(); currentTabChanged (newCurrentTabIndex, newTabName); }
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 TabbedComponent::setTabBackgroundColour (const int tabIndex, const Colour& newColour) { tabs->setTabBackgroundColour (tabIndex, newColour); if (getCurrentTabIndex() == tabIndex) repaint(); }
void TabBar::getCurrentTitle(TCHAR *title, int titleLen) { TCITEM tci; tci.mask = TCIF_TEXT; tci.pszText = title; tci.cchTextMax = titleLen-1; ::SendMessage(_hSelf, TCM_GETITEM, getCurrentTabIndex(), reinterpret_cast<LPARAM>(&tci)); }
void TabBar::activateAt(int index) const { if (getCurrentTabIndex() != index) ::SendMessage(_hSelf, TCM_SETCURSEL, index, 0); TBHDR nmhdr; nmhdr.hdr.hwndFrom = _hSelf; nmhdr.hdr.code = TCN_SELCHANGE; nmhdr.hdr.idFrom = reinterpret_cast<UINT_PTR>(this); nmhdr.tabOrigin = index; }
void TabBar::activateAt(int index) const { if (getCurrentTabIndex() != index) { // TCS_BUTTONS needs both set or two tabs can appear selected if (::GetWindowLongPtr(_hSelf, GWL_STYLE) & TCS_BUTTONS) { ::SendMessage(_hSelf, TCM_SETCURFOCUS, index, 0); } ::SendMessage(_hSelf, TCM_SETCURSEL, index, 0); } TBHDR nmhdr; nmhdr._hdr.hwndFrom = _hSelf; nmhdr._hdr.code = TCN_SELCHANGE; nmhdr._hdr.idFrom = reinterpret_cast<UINT_PTR>(this); nmhdr._tabOrigin = index; }
void TabbedComponent::paint (Graphics& g) { g.fillAll (findColour (backgroundColourId)); Rectangle<int> content (getLocalBounds()); BorderSize<int> outline (outlineThickness); TabbedComponentHelpers::getTabArea (content, outline, getOrientation(), tabDepth); g.reduceClipRegion (content); g.fillAll (tabs->getTabBackgroundColour (getCurrentTabIndex())); if (outlineThickness > 0) { RectangleList rl (content); rl.subtract (outline.subtractedFrom (content)); g.reduceClipRegion (rl); g.fillAll (findColour (outlineColourId)); } }
BufferID DocTabView::activeBuffer() { int index = getCurrentTabIndex(); return (BufferID)getBufferByIndex(index); }
BufferID DocTabView::activeBuffer() { int index = getCurrentTabIndex(); return static_cast<BufferID>(getBufferByIndex(index)); }
void DemoContentComponent::ensureDemoIsShowing() { if (getCurrentTabIndex() == (getNumTabs() - 1)) setCurrentTabIndex (0); }