using System.Collections.Generic;
using System.ComponentModel;
using Kingo.Plugin.EngineEditor.Enum;
namespace Kingo.Plugin.EngineEditor.Model
{
    public class PropertyGridDataStruct : INotifyPropertyChanged
    {
        public string HeaderToolTip { get; set; }
        /// 
        /// 属性名(键)
        /// 
        public string Key { get; set; }
        public string Text { get; set; }
        private string _SelectText;
        public string SelectText
        {
            get
            {
                return _SelectText;
            }
            set
            {
                _SelectText = value;
                //if (PropertyChanged != null)
                //    PropertyChanged(this, new PropertyChangedEventArgs("SelectText"));
            }
        }
        /// 
        /// 显示字体颜色
        /// 
        public string FontColor { get; set; }
        private string _Value;
        /// 
        /// 属性值
        /// 
        public string Value
        {
            get
            {
                return _Value;
            }
            set
            {
                _Value = value;
                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs("Value"));
            }
        }
        public int KeyIndex { get; set; }
        public int ValueIndex { get; set; }
        /// 
        /// 属性类型
        /// 
        public enumPropertyType PropertyType { get; set; }
        /// 
        /// 字典Code;当PropertyType=ComboBox时必填
        /// 
        public string DicCode { get; set; }
        private List _DicData;
        public List DicData
        {
            get
            {
                return _DicData;
            }
            set
            {
                _DicData = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("DicData"));
                }
            }
        }
        private string _DisplayPath;
        /// 
        /// 显示字段(初始化字典绑定)
        /// 
        public string DisplayMemberPath
        {
            get
            {
                if (string.IsNullOrWhiteSpace(_DisplayPath))
                    return "NAME";
                return _DisplayPath;
            }
            set
            {
                _DisplayPath = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("DisplayMemberPath"));
                }
            }
        }
        private string _ValuePath;
        /// 
        /// 值字段(初始化字典绑定)
        /// 
        public string ValuePath
        {
            get
            {
                if (string.IsNullOrWhiteSpace(_ValuePath))
                    return "CODE";
                return _ValuePath;
            }
            set
            {
                _ValuePath = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("ValuePath"));
                }
            }
        }
        private bool _IsReadOnly;
        /// 
        /// 是否只读
        /// 
        public bool IsReadOnly
        {
            get
            {
                return _IsReadOnly;
            }
            set
            {
                _IsReadOnly = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("IsReadOnly"));
                }
            }
        }
        /// 
        /// 允许空值
        /// 
        public bool AllowNull { get; set; }
        /// 
        /// 表示下拉框是否需要分组(树形)显示
        /// 
        public bool IsGroup { get; set; }
        public bool CheckBoxValue { get; set; }
        public event PropertyChangedEventHandler PropertyChanged;// = delegate { };
    }
}