Exemple #1
0
 public Container(Texture2D backgroundTexture, Vector2 position, Constants.ViewLayer layer, Constants.ViewContainerLayout layout, bool visible)
     : base(position, backgroundTexture.Width, backgroundTexture.Height, layer, visible)
 {
     Layout = layout;
     ChildViews = new List<View> ();
     if (backgroundTexture != null) {
         BackgroundSprite = new Sprite (backgroundTexture, new Vector2 (0, 0), layer);
         AddBackgroundSpriteAsChild ();
     }
 }
Exemple #2
0
 public Views.Popup AddPopup(Texture2D popupBackgroundTexture, Constants.ViewContainerLayout childPosition)
 {
     Views.Popup newPopup = new Sunfish.Views.Popup (popupBackgroundTexture, childPosition);
     ChildViews.Add (newPopup);
     return newPopup;
 }
Exemple #3
0
 public Container(int width, int height, Vector2 position, Constants.ViewLayer layer, Constants.ViewContainerLayout layout)
     : base(position, width, height, layer, true)
 {
     Layout = layout;
     ChildViews = new List<View> ();
 }
Exemple #4
0
 public Container(Texture2D backgroundTexture, Vector2 position, Constants.ViewLayer layer, Constants.ViewContainerLayout layout)
     : this(backgroundTexture, position, layer, layout, true)
 {
 }
Exemple #5
0
 public Container(int width, int height, Vector2 position, Constants.ViewContainerLayout layout)
     : this(width, height, position, Constants.ViewLayer.Layer1, layout)
 {
 }
Exemple #6
0
 public Container(int width, int height, Constants.ViewContainerLayout layout)
     : this(width, height, new Vector2 (0, 0), layout)
 {
 }
Exemple #7
0
 public Container(Texture2D backgroundTexture, Constants.ViewLayer layer, Constants.ViewContainerLayout layout)
     : this(backgroundTexture, new Vector2 (0, 0), layer, layout, true)
 {
 }
Exemple #8
0
        protected void AddChild(View view, Constants.ViewContainerLayout layout, int marginX, int marginY)
        {
            if (layout == Constants.ViewContainerLayout.Absolute) {
                view.Position = GetChildAbsolutePosition (view, marginX, marginY);
            } else if (layout == Constants.ViewContainerLayout.FloatLeft) {
                view.Position = GetChildFloatLeftPosition (view, marginX, marginY);
            } else if (layout == Constants.ViewContainerLayout.Stack) {
                view.Position = GetChildStackPosition (view, marginX, marginY);
                NextChildYOffset = view.Position.Y + view.Height;
            } else if (layout == Constants.ViewContainerLayout.StackCentered) {
                view.Position = GetChildStackCenterHorizontalPosition (view, marginY);
                NextChildYOffset = view.Position.Y + view.Height;
            }

            view.SetParent (this); // this will offset the child by this container's position
            ChildViews.Add (view);
            SunfishGame.ActiveScreen.AddChildView (view);

            ExpandHeightIfNecessary (view);
        }