Made method that returns the tab index for a contained view public.

git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@377 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
stippi 2010-04-03 12:45:22 +00:00 committed by Alexandre Deckner
parent 979c4b319d
commit f41f967668
2 changed files with 16 additions and 18 deletions

View File

@ -1318,6 +1318,19 @@ TabManager::ViewForTab(int32 tabIndex) const
}
int32
TabManager::TabForView(const BView* containedView) const
{
int32 count = fCardLayout->CountItems();
for (int32 i = 0; i < count; i++) {
BLayoutItem* item = fCardLayout->ItemAt(i);
if (item->View() == containedView)
return i;
}
return -1;
}
void
TabManager::SelectTab(int32 tabIndex)
{
@ -1333,7 +1346,7 @@ TabManager::SelectTab(int32 tabIndex)
void
TabManager::SelectTab(const BView* containedView)
{
int32 tabIndex = _TabIndexForContainedView(containedView);
int32 tabIndex = TabForView(containedView);
if (tabIndex > 0)
SelectTab(tabIndex);
}
@ -1401,7 +1414,7 @@ void
TabManager::SetTabIcon(const BView* containedView, const BBitmap* icon)
{
WebTabView* tab = dynamic_cast<WebTabView*>(fTabContainerView->TabAt(
_TabIndexForContainedView(containedView)));
TabForView(containedView)));
if (tab)
tab->SetIcon(icon);
}
@ -1417,15 +1430,3 @@ TabManager::SetCloseButtonsAvailable(bool available)
}
int32
TabManager::_TabIndexForContainedView(const BView* containedView) const
{
int32 count = fCardLayout->CountItems();
for (int32 i = 0; i < count; i++) {
BLayoutItem* item = fCardLayout->ItemAt(i);
if (item->View() == containedView)
return i;
}
return -1;
}

View File

@ -60,6 +60,7 @@ public:
BView* ContainerView() const;
BView* ViewForTab(int32 tabIndex) const;
int32 TabForView(const BView* containedView) const;
void SelectTab(int32 tabIndex);
void SelectTab(const BView* containedView);
@ -76,10 +77,6 @@ public:
const BBitmap* icon);
void SetCloseButtonsAvailable(bool available);
private:
int32 _TabIndexForContainedView(
const BView* containedView) const;
private:
#if INTEGRATE_MENU_INTO_TAB_BAR
BMenu* fMenu;