using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using PXP.Crawler.API.Model;
using PXP.Crawler.API.Utils;

namespace PXP.Crawler.API.Designers.Controls
{
    public class NodeContainerDesignerControl : NodeDesignerControl
    {
        internal Padding contPadding = new Padding(20);

        public NodeContainerDesignerControl(Node node) : base(node)
        {
            
        }


        internal NodeDesignerControlContainer desContainer;


        #region Properties

        public NodeDesignerControlContainer DesignerContainer
        {
            get
            {
                return desContainer;
            }
        }

        public virtual bool ContainerVisible
        {
            get
            {
                return desContainer.Visible;
            }
            set
            {
                desContainer.Visible = value;
            }
        }

        public virtual Padding ContainerPadding
        {
            get
            {
                return contPadding;
            }
            set
            {
                contPadding = value;
                desContainer.Location = new Point(contPadding.Left, contPadding.Top);
                desContainer.Size = new Size(ClientRectangle.Width - (contPadding.Horizontal), ClientRectangle.Height - contPadding.Vertical);
            }
        }

        #endregion


        protected override void Init()
        {
            showTitle = true;
            titleTop = true;
                        
            base.Init();


            desContainer = new NodeDesignerControlContainer(this);
            Controls.Add(desContainer);
            desContainer.Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom;
            //desContainer.Dock = DockStyle.Fill;
            desContainer.BackColor = Color.FromArgb(20, Color.DarkGreen);
            ContainerPadding = new Padding(20);
            //desContainer.Padding = ContainerPadding;
            //desContainer.Dock = DockStyle.Fill;
            //Padding = ContainerPadding;

            //container.Visible = false;
        }
    }
}
