A component with a TabbedButtonBar along one of its sides. More...
Inherits Component.
Public Types | |
| enum | ColourIds { backgroundColourId = 0x1005800, outlineColourId = 0x1005801 } |
| A set of colour IDs to use to change the colour of various aspects of the component. More... | |
Public Member Functions | |
| TabbedComponent (TabbedButtonBar::Orientation orientation) | |
| Creates a TabbedComponent, specifying where the tabs should be placed. | |
| ~TabbedComponent () | |
| Destructor. | |
| void | setOrientation (TabbedButtonBar::Orientation orientation) |
| Changes the placement of the tabs. | |
| TabbedButtonBar::Orientation | getOrientation () const noexcept |
| Returns the current tab placement. | |
| void | setTabBarDepth (int newDepth) |
| Specifies how many pixels wide or high the tab-bar should be. | |
| int | getTabBarDepth () const noexcept |
| Returns the current thickness of the tab bar. | |
| void | setOutline (int newThickness) |
| Specifies the thickness of an outline that should be drawn around the content component. | |
| void | setIndent (int indentThickness) |
| Specifies a gap to leave around the edge of the content component. | |
| void | clearTabs () |
| Removes all the tabs from the bar. | |
| void | addTab (const String &tabName, const Colour &tabBackgroundColour, Component *contentComponent, bool deleteComponentWhenNotNeeded, int insertIndex=-1) |
| Adds a tab to the tab-bar. | |
| void | setTabName (int tabIndex, const String &newName) |
| Changes the name of one of the tabs. | |
| void | removeTab (int tabIndex) |
| Gets rid of one of the tabs. | |
| int | getNumTabs () const |
| Returns the number of tabs in the bar. | |
| StringArray | getTabNames () const |
| Returns a list of all the tab names in the bar. | |
| Component * | getTabContentComponent (int tabIndex) const noexcept |
| Returns the content component that was added for the given index. | |
| Colour | getTabBackgroundColour (int tabIndex) const noexcept |
| Returns the colour of one of the tabs. | |
| void | setTabBackgroundColour (int tabIndex, const Colour &newColour) |
| Changes the background colour of one of the tabs. | |
| void | setCurrentTabIndex (int newTabIndex, bool sendChangeMessage=true) |
| Changes the currently-selected tab. | |
| int | getCurrentTabIndex () const |
| Returns the index of the currently selected tab. | |
| String | getCurrentTabName () const |
| Returns the name of the currently selected tab. | |
| Component * | getCurrentContentComponent () const noexcept |
| Returns the current component that's filling the panel. | |
| virtual void | currentTabChanged (int newCurrentTabIndex, const String &newCurrentTabName) |
| Callback method to indicate the selected tab has been changed. | |
| virtual void | popupMenuClickOnTab (int tabIndex, const String &tabName) |
| Callback method to indicate that the user has right-clicked on a tab. | |
| TabbedButtonBar & | getTabbedButtonBar () const noexcept |
| Returns the tab button bar component that is being used. | |
| void | paint (Graphics &g) |
| void | resized () |
| void | lookAndFeelChanged () |
Protected Member Functions | |
| virtual TabBarButton * | createTabButton (const String &tabName, int tabIndex) |
| This creates one of the tab buttons. | |
Protected Attributes | |
| ScopedPointer< TabbedButtonBar > | tabs |
A component with a TabbedButtonBar along one of its sides.
This makes it easy to create a set of tabbed pages, just add a bunch of tabs with addTab(), and this will take care of showing the pages for you when the user clicks on a different tab.
A set of colour IDs to use to change the colour of various aspects of the component.
These constants can be used either via the Component::setColour(), or LookAndFeel::setColour() methods.
| TabbedComponent::TabbedComponent | ( | TabbedButtonBar::Orientation | orientation | ) | [explicit] |
Creates a TabbedComponent, specifying where the tabs should be placed.
Once created, add some tabs with the addTab() method.
Destructor.
| void TabbedComponent::setOrientation | ( | TabbedButtonBar::Orientation | orientation | ) |
Changes the placement of the tabs.
This will rearrange the layout to place the tabs along the appropriate side of this component, and will shift the content component accordingly.
Returns the current tab placement.
| void TabbedComponent::setTabBarDepth | ( | int | newDepth | ) |
Specifies how many pixels wide or high the tab-bar should be.
If the tabs are placed along the top or bottom, this specified the height of the bar; if they're along the left or right edges, it'll be the width of the bar.
| int TabbedComponent::getTabBarDepth | ( | ) | const |
Returns the current thickness of the tab bar.
| void TabbedComponent::setOutline | ( | int | newThickness | ) |
Specifies the thickness of an outline that should be drawn around the content component.
If this thickness is > 0, a line will be drawn around the three sides of the content component which don't touch the tab-bar, and the content component will be inset by this amount.
To set the colour of the line, use setColour (outlineColourId, ...).
| void TabbedComponent::setIndent | ( | int | indentThickness | ) |
Specifies a gap to leave around the edge of the content component.
Each edge of the content component will be indented by the given number of pixels.
| void TabbedComponent::clearTabs | ( | ) |
Removes all the tabs from the bar.
| void TabbedComponent::addTab | ( | const String & | tabName, |
| const Colour & | tabBackgroundColour, | ||
| Component * | contentComponent, | ||
| bool | deleteComponentWhenNotNeeded, | ||
| int | insertIndex = -1 |
||
| ) |
Adds a tab to the tab-bar.
The component passed in will be shown for the tab, and if deleteComponentWhenNotNeeded is true, it will be deleted when the tab is removed or when this object is deleted.
| void TabbedComponent::setTabName | ( | int | tabIndex, |
| const String & | newName | ||
| ) |
Changes the name of one of the tabs.
| void TabbedComponent::removeTab | ( | int | tabIndex | ) |
Gets rid of one of the tabs.
| int TabbedComponent::getNumTabs | ( | ) | const |
Returns the number of tabs in the bar.
| StringArray TabbedComponent::getTabNames | ( | ) | const |
Returns a list of all the tab names in the bar.
| Component* TabbedComponent::getTabContentComponent | ( | int | tabIndex | ) | const |
Returns the content component that was added for the given index.
Be sure not to use or delete the components that are returned, as this may interfere with the TabbedComponent's use of them.
| Colour TabbedComponent::getTabBackgroundColour | ( | int | tabIndex | ) | const |
Returns the colour of one of the tabs.
| void TabbedComponent::setTabBackgroundColour | ( | int | tabIndex, |
| const Colour & | newColour | ||
| ) |
Changes the background colour of one of the tabs.
| void TabbedComponent::setCurrentTabIndex | ( | int | newTabIndex, |
| bool | sendChangeMessage = true |
||
| ) |
Changes the currently-selected tab.
To deselect all the tabs, pass -1 as the index.
| int TabbedComponent::getCurrentTabIndex | ( | ) | const |
Returns the index of the currently selected tab.
| String TabbedComponent::getCurrentTabName | ( | ) | const |
Returns the name of the currently selected tab.
Returns the current component that's filling the panel.
This will return 0 if there isn't one.
| virtual void TabbedComponent::currentTabChanged | ( | int | newCurrentTabIndex, |
| const String & | newCurrentTabName | ||
| ) | [virtual] |
Callback method to indicate the selected tab has been changed.
| virtual void TabbedComponent::popupMenuClickOnTab | ( | int | tabIndex, |
| const String & | tabName | ||
| ) | [virtual] |
Callback method to indicate that the user has right-clicked on a tab.
(Or ctrl-clicked on the Mac)
Returns the tab button bar component that is being used.
| void TabbedComponent::paint | ( | Graphics & | g | ) | [virtual] |
Reimplemented from Component.
| void TabbedComponent::resized | ( | ) | [virtual] |
Reimplemented from Component.
| void TabbedComponent::lookAndFeelChanged | ( | ) | [virtual] |
Reimplemented from Component.
| virtual TabBarButton* TabbedComponent::createTabButton | ( | const String & | tabName, |
| int | tabIndex | ||
| ) | [protected, virtual] |
This creates one of the tab buttons.
If you need to use custom tab components, you can override this method and return your own class instead of the default.
ScopedPointer<TabbedButtonBar> TabbedComponent::tabs [protected] |