Example #1
0
            override public void placeContained()
            {
                int AvailableSpace = 0;
                int slice          = 0;

                float deltaHeader = 0.0f;

                if (this.isCollapsable)
                {
                    deltaHeader = this.HEADER_HEIGHT;
                    this.comp.targetScreenBoundary.height = deltaHeader;
                }
                AvailableSpace = (int)this.ScreenPosition.height - (int)deltaHeader;


                if (this.WidgetList.Count == 0)
                {
                    slice = AvailableSpace;
                }
                else
                {
                    slice = (int)System.Math.Round((float)AvailableSpace / this.WidgetList.Count);
                }

                //foreach(CG_GUI3D.Widgets.Widget currentWidget in this.WidgetList)


                for (int i = 0; i < this.WidgetList.Count; i++)
                {
                    Rect newPosition = this.ScreenPosition;
                    newPosition.height = slice;
                    newPosition.x      = this.ScreenPosition.x;
                    newPosition.y      = this.ScreenPosition.y + deltaHeader + (i * slice);
                    //currentWidget.resize(slice, (int)this.ScreenPosition.height);
                    this.WidgetList[i].resize(newPosition);


                    //if widget is layout, call placeContained() method also:
                    //if( typeof(this.WidgetList[i]).IsSubclassOf(CG_GUI3D.Containers.WidgetContainer))
                    //if (this.WidgetList[i] is GenericClass<CG_GUI3D.Containers.WidgetContainer>);

                    //Debug.Log (this.WidgetList[i].GetType().ToString());

                    //if( this.WidgetList[i].GetType().ToString()=="CG_GUI3D.Containers.HLayout" ) TO CLEAN
                    //if( this.WidgetList[i].GetType().IsAssignableFrom(CG_GUI3D.Containers.WidgetContainer) )
                    if (typeof(CG_GUI3D.Containers.WidgetContainer).IsAssignableFrom(this.WidgetList[i].GetType()))
                    {
                        CG_GUI3D.Containers.WidgetContainer cur = this.WidgetList[i] as CG_GUI3D.Containers.WidgetContainer;
                        cur.placeContained();
                        //this.WidgetList[i].placeContained();
                    }
                }
            }
Example #2
0
            override public void placeContained()
            {
                int AvailableSpace = 0;
                int slice          = 0;

                float delta = 0.0f;

                if (this.isCollapsable)
                {
                    delta = this.HEADER_HEIGHT;
                    this.comp.targetScreenBoundary.height = delta;
                }

                AvailableSpace = (int)this.ScreenPosition.width - (int)delta;


                if (this.WidgetList.Count == 0)
                {
                    slice = AvailableSpace;
                }
                else
                {
                    slice = (int)System.Math.Round((float)AvailableSpace / this.WidgetList.Count);
                }

                //foreach(CG_GUI3D.Widgets.Widget currentWidget in this.WidgetList)
                for (int i = 0; i < this.WidgetList.Count; i++)
                {
                    Rect newPosition = this.ScreenPosition;
                    newPosition.width = slice;
                    newPosition.x     = this.ScreenPosition.x + delta + (i * slice);
                    newPosition.y     = this.ScreenPosition.y;
                    this.WidgetList[i].resize(newPosition);


                    if (typeof(CG_GUI3D.Containers.WidgetContainer).IsAssignableFrom(this.WidgetList[i].GetType()))
                    {                           // current widget is a container-heir, so we call its own placement logic:
                        CG_GUI3D.Containers.WidgetContainer cur = this.WidgetList[i] as CG_GUI3D.Containers.WidgetContainer;
                        cur.placeContained();
                    }
                }
            }