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 (); } }
public Views.Popup AddPopup(Texture2D popupBackgroundTexture, Constants.ViewContainerLayout childPosition) { Views.Popup newPopup = new Sunfish.Views.Popup (popupBackgroundTexture, childPosition); ChildViews.Add (newPopup); return newPopup; }
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> (); }
public Container(Texture2D backgroundTexture, Vector2 position, Constants.ViewLayer layer, Constants.ViewContainerLayout layout) : this(backgroundTexture, position, layer, layout, true) { }
public Container(int width, int height, Vector2 position, Constants.ViewContainerLayout layout) : this(width, height, position, Constants.ViewLayer.Layer1, layout) { }
public Container(int width, int height, Constants.ViewContainerLayout layout) : this(width, height, new Vector2 (0, 0), layout) { }
public Container(Texture2D backgroundTexture, Constants.ViewLayer layer, Constants.ViewContainerLayout layout) : this(backgroundTexture, new Vector2 (0, 0), layer, layout, true) { }
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); }