Added MoveTab() method.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39489 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -206,6 +206,29 @@ SmartTabView::RemoveTab(int32 index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
SmartTabView::MoveTab(int32 index, int32 newIndex)
|
||||||
|
{
|
||||||
|
// check the indexes
|
||||||
|
int32 count = CountTabs();
|
||||||
|
if (index == newIndex || index < 0 || newIndex < 0 || index >= count
|
||||||
|
|| newIndex >= count) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove the tab from its position and add it to the end. Then cycle the
|
||||||
|
// tabs starting after the new position (save the tab already moved) to the
|
||||||
|
// end.
|
||||||
|
BTab* tab = BTabView::RemoveTab(index);
|
||||||
|
BTabView::AddTab(tab->View(), tab);
|
||||||
|
|
||||||
|
for (int32 i = newIndex; i < count - 1; i++) {
|
||||||
|
tab = BTabView::RemoveTab(newIndex);
|
||||||
|
BTabView::AddTab(tab->View(), tab);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BRect
|
BRect
|
||||||
SmartTabView::DrawTabs()
|
SmartTabView::DrawTabs()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ public:
|
|||||||
|
|
||||||
virtual void AddTab(BView* target, BTab* tab = NULL);
|
virtual void AddTab(BView* target, BTab* tab = NULL);
|
||||||
virtual BTab* RemoveTab(int32 index);
|
virtual BTab* RemoveTab(int32 index);
|
||||||
|
void MoveTab(int32 index, int32 newIndex);
|
||||||
|
|
||||||
virtual BRect DrawTabs();
|
virtual BRect DrawTabs();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user