Skip to content
Browse files

Updated TabBar to not require close button implement IButton

  • Loading branch information...
1 parent 65fbf67 commit be3a76d3881b25c46144b087872e555febbb89af @skyboy committed Jul 21, 2011
Showing with 9 additions and 7 deletions.
  1. +7 −7 skyboy/components/TabBar.as
  2. +2 −0 skyboy/interfaces/tabbar/ITab.as
View
14 skyboy/components/TabBar.as
@@ -110,21 +110,21 @@ package skyboy.components {
}
}
} else {
- tab = items[len - 1] as ITab;
+ while (!tab && len) tab = items[--len] as ITab;
if (tab) {
+ if (tab.closeable()) {
+ if (tab.pointCloses(e.stageX, e.stageY)) {
+ removeTab(tab);
+ return;
+ }
+ }
if (tab != selectedTab) {
if (selectedTab) selectedTab.deselect();
tab.lastTab = selectedTab;
tab.select();
selectedTab = tab;
scroll(tab);
}
- } else if (len > 1 && items[len - 2] is ITab) {
- tab = items[len - 2] as ITab;
- button = items[len - 1] as IButton;
- if (button && button.enabled()) { // close button is clicked
- removeTab(tab);
- }
}
}
}
View
2 skyboy/interfaces/tabbar/ITab.as
@@ -17,5 +17,7 @@ package skyboy.interfaces.tabbar {
function deselect():void;
function close():void;
function closed():Boolean;
+ function closeable():Boolean;
+ function pointCloses(x:Number, y:Number):Boolean;
}
}

0 comments on commit be3a76d

Please sign in to comment.
Something went wrong with that request. Please try again.