summaryrefslogtreecommitdiff
path: root/Assets/Plugins/AdvancedInspector/Attributes/Style.cs
blob: 5ffa27ac13912e4bd1e880727daac4f3749dc143 (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
using System;

namespace AdvancedInspector
{
    /// <summary>
    /// Allow to change the style of an field item.
    /// </summary>
    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Method)]
    public class StyleAttribute : Attribute
    {
        private string style = "";

        /// <summary>
        /// Name of the style to use.
        /// Must be findable by GUI.skin.Find()
        /// </summary>
        public string Style
        {
            get { return style; }
            set { style = value; }
        }

        private bool label = true;

        /// <summary>
        /// Force or prevent the field's label from being displayed.
        /// </summary>
        public bool Label
        {
            get { return label; }
            set { label = value; }
        }

        public StyleAttribute(string style)
            : this(style, true) { }

        public StyleAttribute(string style, bool label)
        {
            this.style = style;
            this.label = label;
        }
    }
}