flex-users / flexlib

Open Source Flex components library.
github.com/flex-users/flexlib
MIT License
204 stars 91 forks source link

[SuperTabNavigator] patch for resizable close button, optional 'close all tabs' button in tabBar #348

Open nicoulaj opened 13 years ago

nicoulaj commented 13 years ago

Originally filed by keesvand...@gmail.com on 2011-02-21T20:24:27

A patch (output of svn diff) to have two additional features:

(1) Resizable close button.

The old navigator has size hardcoded on 10 (pixels) those properties now are customizable.

It can be customized by using the patched flexlib and subclassing the SuperTabBar:

public class CustomSuperTabBar extends SuperTabBar { public function CustomSuperTabBar() { super();

    defaultTabProperties =  
        { 
        "closeButtonHeight": 17, 
        "closeButtonWidth": 17
        };
}

}

(2) Add a 'close all tabs' button in navigation bar (just left from popup button)

public class CustomSuperTabNavigator extends SuperTabNavigator { public function CustomSuperTabNavigator() { super(); // close all button is visible by default. If this is not desired, add: // closeAllButtonEnabled = false; }

override protected function createChildren():void {
    super.createChildren();
    closeAllButton.addEventListener(MouseEvent.CLICK,closeAllTabsHandler);
}

private function closeAllTabsHandler(event:MouseEvent):void {   
    // see SuperTabBar.onCloseTabClicked() how to close tabs...
    // you probably want to have a confirmation dialog before closing all.
}

}

Attached is the output of svn diff compared to trunk. Info and how it was generated: C:\flexlib>svn info Path: . URL: http://flexlib.googlecode.com/svn/trunk Repository Root: http://flexlib.googlecode.com/svn Repository UUID: d9d5f27d-7529-0410-ab0a-a9f3ddeb9b35 Revision: 244 Node Kind: directory Schedule: normal Last Changed Author: wasbridge Last Changed Rev: 244 Last Changed Date: 2011-02-08 09:35:36 +0100 (Tue, 08 Feb 2011)

svn diff > flexlib-svn-diff-close-button-dimensions-customizable-and-close-all-button.patch

Could this patch be merged into the trunk? If I get svn write access I'm willing to do this myself.

Thanks,

Kees