JUCE
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
TabbedComponent Class Reference

A component with a TabbedButtonBar along one of its sides. More...

Inherits Component.

List of all members.

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.
ComponentgetTabContentComponent (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.
ComponentgetCurrentContentComponent () 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.
TabbedButtonBargetTabbedButtonBar () const noexcept
 Returns the tab button bar component that is being used.
void paint (Graphics &g)
void resized ()
void lookAndFeelChanged ()

Protected Member Functions

virtual TabBarButtoncreateTabButton (const String &tabName, int tabIndex)
 This creates one of the tab buttons.

Protected Attributes

ScopedPointer< TabbedButtonBartabs

Detailed Description

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.

See also:
TabbedButtonBar

Member Enumeration Documentation

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.

See also:
Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
Enumerator:
backgroundColourId 

The colour to fill the background behind the tabs.

outlineColourId 

The colour to use to draw an outline around the content.

(See setOutline)


Constructor & Destructor Documentation

Creates a TabbedComponent, specifying where the tabs should be placed.

Once created, add some tabs with the addTab() method.

Destructor.


Member Function Documentation

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.

See also:
TabbedButtonBar::setOrientation

Returns the current tab placement.

See also:
setOrientation, TabbedButtonBar::getOrientation
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.

Returns the current thickness of the tab bar.

See also:
setTabBarDepth
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.

Removes all the tabs from the bar.

See also:
TabbedButtonBar::clearTabs
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.

See also:
TabbedButtonBar::addTab
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.

Returns the number of tabs in the bar.

Returns a list of all the tab names in the bar.

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.

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.

See also:
TabbedButtonBar::setCurrentTabIndex

Returns the index of the currently selected tab.

See also:
addTab, TabbedButtonBar::getCurrentTabIndex()

Returns the name of the currently selected tab.

See also:
addTab, TabbedButtonBar::getCurrentTabName()

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.

See also:
setCurrentTabIndex
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.

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.


Member Data Documentation


The documentation for this class was generated from the following file: