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 (const TabbedButtonBar::Orientation orientation)
 Creates a TabbedComponent, specifying where the tabs should be placed.
 ~TabbedComponent ()
 Destructor.
void setOrientation (const TabbedButtonBar::Orientation orientation)
 Changes the placement of the tabs.
TabbedButtonBar::Orientation getOrientation () const throw ()
 Returns the current tab placement.
void setTabBarDepth (const int newDepth)
 Specifies how many pixels wide or high the tab-bar should be.
int getTabBarDepth () const throw ()
 Returns the current thickness of the tab bar.
void setOutline (const int newThickness)
 Specifies the thickness of an outline that should be drawn around the content component.
void setIndent (const 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 *const contentComponent, const bool deleteComponentWhenNotNeeded, const int insertIndex=-1)
 Adds a tab to the tab-bar.
void setTabName (const int tabIndex, const String &newName)
 Changes the name of one of the tabs.
void removeTab (const int tabIndex)
 Gets rid of one of the tabs.
int getNumTabs () const
 Returns the number of tabs in the bar.
const StringArray getTabNames () const
 Returns a list of all the tab names in the bar.
ComponentgetTabContentComponent (const int tabIndex) const throw ()
 Returns the content component that was added for the given index.
const Colour getTabBackgroundColour (const int tabIndex) const throw ()
 Returns the colour of one of the tabs.
void setTabBackgroundColour (const int tabIndex, const Colour &newColour)
 Changes the background colour of one of the tabs.
void setCurrentTabIndex (const int newTabIndex, const bool sendChangeMessage=true)
 Changes the currently-selected tab.
int getCurrentTabIndex () const
 Returns the index of the currently selected tab.
const StringgetCurrentTabName () const
 Returns the name of the currently selected tab.
ComponentgetCurrentContentComponent () const throw ()
 Returns the current component that's filling the panel.
virtual void currentTabChanged (const int newCurrentTabIndex, const String &newCurrentTabName)
 Callback method to indicate the selected tab has been changed.
virtual void popupMenuClickOnTab (const int tabIndex, const String &tabName)
 Callback method to indicate that the user has right-clicked on a tab.
TabbedButtonBargetTabbedButtonBar () const throw ()
 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, const int tabIndex)
 This creates one of the tab buttons.

Protected Attributes

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

TabbedComponent::TabbedComponent ( const TabbedButtonBar::Orientation  orientation  ) 

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

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

TabbedComponent::~TabbedComponent (  ) 

Destructor.


Member Function Documentation

void TabbedComponent::setOrientation ( const 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.

See also:
TabbedButtonBar::setOrientation

TabbedButtonBar::Orientation TabbedComponent::getOrientation (  )  const throw ()

Returns the current tab placement.

See also:
setOrientation, TabbedButtonBar::getOrientation

void TabbedComponent::setTabBarDepth ( const 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 throw ()

Returns the current thickness of the tab bar.

See also:
setTabBarDepth

void TabbedComponent::setOutline ( const 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 ( const 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.

See also:
TabbedButtonBar::clearTabs

void TabbedComponent::addTab ( const String tabName,
const Colour tabBackgroundColour,
Component *const   contentComponent,
const bool  deleteComponentWhenNotNeeded,
const 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 ( const int  tabIndex,
const String newName 
)

Changes the name of one of the tabs.

void TabbedComponent::removeTab ( const int  tabIndex  ) 

Gets rid of one of the tabs.

int TabbedComponent::getNumTabs (  )  const

Returns the number of tabs in the bar.

const StringArray TabbedComponent::getTabNames (  )  const

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

Component* TabbedComponent::getTabContentComponent ( const int  tabIndex  )  const throw ()

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.

const Colour TabbedComponent::getTabBackgroundColour ( const int  tabIndex  )  const throw ()

Returns the colour of one of the tabs.

void TabbedComponent::setTabBackgroundColour ( const int  tabIndex,
const Colour newColour 
)

Changes the background colour of one of the tabs.

void TabbedComponent::setCurrentTabIndex ( const int  newTabIndex,
const bool  sendChangeMessage = true 
)

Changes the currently-selected tab.

To deselect all the tabs, pass -1 as the index.

See also:
TabbedButtonBar::setCurrentTabIndex

int TabbedComponent::getCurrentTabIndex (  )  const

Returns the index of the currently selected tab.

See also:
addTab, TabbedButtonBar::getCurrentTabIndex()

const String& TabbedComponent::getCurrentTabName (  )  const

Returns the name of the currently selected tab.

See also:
addTab, TabbedButtonBar::getCurrentTabName()

Component* TabbedComponent::getCurrentContentComponent (  )  const throw ()

Returns the current component that's filling the panel.

This will return 0 if there isn't one.

virtual void TabbedComponent::currentTabChanged ( const int  newCurrentTabIndex,
const String newCurrentTabName 
) [virtual]

Callback method to indicate the selected tab has been changed.

See also:
setCurrentTabIndex

virtual void TabbedComponent::popupMenuClickOnTab ( const 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)

TabbedButtonBar& TabbedComponent::getTabbedButtonBar (  )  const throw ()

Returns the tab button bar component that is being used.

void TabbedComponent::paint ( Graphics g  )  [virtual]

For internal use only.

Reimplemented from Component.

void TabbedComponent::resized (  )  [virtual]

For internal use only.

Reimplemented from Component.

void TabbedComponent::lookAndFeelChanged (  )  [virtual]

For internal use only.

Reimplemented from Component.

virtual TabBarButton* TabbedComponent::createTabButton ( const String tabName,
const 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:

Generated on Fri Nov 20 12:00:50 2009 for JUCE by  doxygen 1.5.9