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
2012-07-03 15:38:51 +02:00
committed by Alexandre Deckner
parent 979c4b319d
commit f41f967668
2 changed files with 16 additions and 18 deletions
+15 -14
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 void
TabManager::SelectTab(int32 tabIndex) TabManager::SelectTab(int32 tabIndex)
{ {
@@ -1333,7 +1346,7 @@ TabManager::SelectTab(int32 tabIndex)
void void
TabManager::SelectTab(const BView* containedView) TabManager::SelectTab(const BView* containedView)
{ {
int32 tabIndex = _TabIndexForContainedView(containedView); int32 tabIndex = TabForView(containedView);
if (tabIndex > 0) if (tabIndex > 0)
SelectTab(tabIndex); SelectTab(tabIndex);
} }
@@ -1401,7 +1414,7 @@ void
TabManager::SetTabIcon(const BView* containedView, const BBitmap* icon) TabManager::SetTabIcon(const BView* containedView, const BBitmap* icon)
{ {
WebTabView* tab = dynamic_cast<WebTabView*>(fTabContainerView->TabAt( WebTabView* tab = dynamic_cast<WebTabView*>(fTabContainerView->TabAt(
_TabIndexForContainedView(containedView))); TabForView(containedView)));
if (tab) if (tab)
tab->SetIcon(icon); 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;
}
+1 -4
View File
@@ -60,6 +60,7 @@ public:
BView* ContainerView() const; BView* ContainerView() const;
BView* ViewForTab(int32 tabIndex) const; BView* ViewForTab(int32 tabIndex) const;
int32 TabForView(const BView* containedView) const;
void SelectTab(int32 tabIndex); void SelectTab(int32 tabIndex);
void SelectTab(const BView* containedView); void SelectTab(const BView* containedView);
@@ -76,10 +77,6 @@ public:
const BBitmap* icon); const BBitmap* icon);
void SetCloseButtonsAvailable(bool available); void SetCloseButtonsAvailable(bool available);
private:
int32 _TabIndexForContainedView(
const BView* containedView) const;
private: private:
#if INTEGRATE_MENU_INTO_TAB_BAR #if INTEGRATE_MENU_INTO_TAB_BAR
BMenu* fMenu; BMenu* fMenu;