wiln / flexlib

Automatically exported from code.google.com/p/flexlib
0 stars 0 forks source link

Add a container for placing other buttons and move the tab menu list into the container #166

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I needed to add a maximize and minimize button to the SuperTabNavigator. 
Here's my changes.  I added a container and moved popupButton into the
container.  Now I can add new elements to that container.  I'm sure it
could use some more work to make it better or more extensible.

Hopefully this patch file is useful.

=== modified file 'src/flexlib/containers/SuperTabNavigator.as'
--- old/src/flexlib/containers/SuperTabNavigator.as 2008-03-24 20:00:57 +0000
+++ new/src/flexlib/containers/SuperTabNavigator.as 2008-10-23 18:55:13 +0000
@@ -165,6 +165,8 @@
        */
        protected var popupButton:PopUpButton;

+       protected var controlsContainer:Box;
+       
        /**
        * @private
        */
@@ -689,6 +691,21 @@
                menu.addEventListener(MenuEvent.ITEM_CLICK, changeTabs);
            }

+           if(!controlsContainer)
+           {
+               controlsContainer = new Box();
+               controlsContainer.direction = holder.direction;
+               
+               controlsContainer.setStyle("horizontalGap", 0);
+               controlsContainer.setStyle("borderStyle", "none");
+               controlsContainer.setStyle("paddingTop", 0);
+               controlsContainer.setStyle("paddingBottom", 0);
+               
+               controlsContainer.horizontalScrollPolicy = "off";
+               
+               holder.addChild(controlsContainer);
+           }
+           
            if(!popupButton) {
                popupButton = new PopUpButton();
                popupButton.popUp = menu;
@@ -697,7 +714,7 @@
                popupButton.styleName = getStyle("popupButtonStyleName");

                // So now holder has 2 children: canvas and popupButton
-               holder.addChild(popupButton);
+               controlsContainer.addChild(popupButton);
            }

@@ -907,8 +924,8 @@
            // tabBarSpace is used to try to figure out how much space we 
            // need for the tabs, to figure out if we need to scroll them
            var tabBarSpace:Number = w;
-           if(popupButton.includeInLayout) {
-               tabBarSpace -= popupButton.width;
+           if(controlsContainer.includeInLayout) {
+               tabBarSpace -= controlsContainer.width;
            }

            var tempWidth:Number = tabBar.getStyle("tabWidth");
@@ -926,8 +943,8 @@

                var canvasWidth:Number = unscaledWidth;

-           if(popupButton.includeInLayout) {
-               canvasWidth -= popupButton.width;
+           if(controlsContainer.includeInLayout) {
+               canvasWidth -= controlsContainer.width;
            }

            canvas.width = canvasWidth;

Original issue reported on code.google.com by craig.skinfill on 23 Oct 2008 at 7:57

GoogleCodeExporter commented 8 years ago

Original comment by dmcc...@gmail.com on 8 Jan 2009 at 6:01