using System;
using System.Windows.Forms;
using Hitsuji.Framework.DataClient.Model;

namespace PostCardHitsuji.Ui.RowPanel
{
    public partial class BaseFloatPanel : UserControl
    {
        public BaseRowPanel ParentRowPanel
        {
            get;
            set;
        }

        public IContentModel Model
        {
            get
            {
                return model_; 
            }
            set 
            { 
                model_ = value;
                notifyModelChanged();
            }
        }
        private IContentModel model_;

        public IContentModel MargedModel
        {
            get 
            {
                //オリジナルの複製を、UIの値でマージして返す
                var cloneModel = model_.DeepCopy();
                margeUiToModel(cloneModel);
                return cloneModel;
            }
        }

        public BaseFloatPanel()
        {
            InitializeComponent();
        }

        protected virtual void margeUiToModel(IContentModel refModel)
        {
            throw new NotImplementedException();
        }

        protected virtual void notifyModelChanged()
        {
            throw new NotImplementedException();
        }

        protected virtual void notifyPropertyChanged(object sender, EventArgs ev)
        {
            throw new NotImplementedException();
        }

        protected void attachAttribute_ButtonForUpdate(System.Windows.Forms.Button buttonForUpdate)
        {
            buttonForUpdate.Size = new System.Drawing.Size(50, 22);
            attachAttribute_Button(buttonForUpdate);
            buttonForUpdate.Text = "更新";
        }
        protected void attachAttribute_Button(System.Windows.Forms.Button button)
        {
            button.ForeColor = System.Drawing.Color.Gray;
            button.BackColor = System.Drawing.Color.LightYellow;
            button.FlatStyle = System.Windows.Forms.FlatStyle.System;

        }
        protected void attachAttribute_Color(System.Windows.Forms.Control ctrl)
        {
            ctrl.BackColor = System.Drawing.Color.Transparent;
            ctrl.ForeColor = System.Drawing.Color.LightYellow;
        }

    }
}
