summaryrefslogtreecommitdiff
path: root/Assets/Plugins/AdvancedInspector/Attributes/Expandable.cs
blob: b63d5c3874af44bf01e07461306b22774e6e8fba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;

namespace AdvancedInspector
{
    /// <summary>
    /// Redefine if a field/property can be expanded or not.
    /// </summary>
    [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited = true)]
    public class ExpandableAttribute : Attribute, IListAttribute 
    {
        private bool expanded = false;

        /// <summary>
        /// Makes the item expanded by default.
        /// </summary>
        public bool Expanded
        {
            get { return expanded; }
            set { expanded = value; }
        }

        private bool expandable = true;

        /// <summary>
        /// Default true, can force a field to not be expandable. 
        /// </summary>
        public bool Expandable
        {
            get { return expandable; }
            set { expandable = value; }
        }

        public ExpandableAttribute() { }

        public ExpandableAttribute(bool expandable)
        {
            this.expandable = expandable;
        }

        public ExpandableAttribute(bool expandable, bool expanded)
        {
            this.expanded = expanded;
            this.expandable = expandable;
        }
    }
}