/// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary> /// <param name="value"> The starting cached value of the drawer. </param> /// <param name="memberInfo"> LinkedMemberInfo for the field, property or parameter that the drawer represents. Can be null. </param> /// <param name="parent"> The parent drawer of the created drawer. Can be null. </param> /// <param name="label"> The prefix label. </param> /// <param name="readOnly"> True if control should be read only. </param> /// <returns> The instance, ready to be used. </returns> public static RectOffsetDrawer Create(RectOffset value, [CanBeNull] LinkedMemberInfo memberInfo, [CanBeNull] IParentDrawer parent, GUIContent label, bool readOnly) { RectOffsetDrawer result; if (!DrawerPool.TryGet(out result)) { result = new RectOffsetDrawer(); } result.Setup(value, typeof(RectOffset), memberInfo, parent, label, readOnly); result.LateSetup(); return(result); }
protected override void DoBuildMembers() { Array.Resize(ref members, 26); var first = Value; bool readOnly = ReadOnly; //NOTE: This didn't have a LinkedMemberInfo earlier for some reason. Did it cause problems? members[0] = TextDrawer.Create(first.name, memberBuildList[0], this, GUIContentPool.Create("Name"), readOnly, false); members[1] = GUIStyleStateDrawer.Create(first.normal, memberBuildList[1], this, GUIContentPool.Create("Normal"), readOnly); members[2] = GUIStyleStateDrawer.Create(first.hover, memberBuildList[2], this, GUIContentPool.Create("Hover"), readOnly); members[3] = GUIStyleStateDrawer.Create(first.active, memberBuildList[3], this, GUIContentPool.Create("Active"), readOnly); members[4] = GUIStyleStateDrawer.Create(first.focused, memberBuildList[4], this, GUIContentPool.Create("Focused"), readOnly); members[5] = GUIStyleStateDrawer.Create(first.onNormal, memberBuildList[5], this, GUIContentPool.Create("On Normal"), readOnly); members[6] = GUIStyleStateDrawer.Create(first.onHover, memberBuildList[6], this, GUIContentPool.Create("On Hover"), readOnly); members[7] = GUIStyleStateDrawer.Create(first.onActive, memberBuildList[7], this, GUIContentPool.Create("On Active"), readOnly); members[8] = GUIStyleStateDrawer.Create(first.onFocused, memberBuildList[8], this, GUIContentPool.Create("On Focused"), readOnly); members[9] = RectOffsetDrawer.Create(first.border, memberBuildList[9], this, GUIContentPool.Create("Border"), readOnly); members[10] = RectOffsetDrawer.Create(first.margin, memberBuildList[10], this, GUIContentPool.Create("Margin"), readOnly); members[11] = RectOffsetDrawer.Create(first.padding, memberBuildList[11], this, GUIContentPool.Create("Padding"), readOnly); members[12] = RectOffsetDrawer.Create(first.overflow, memberBuildList[12], this, GUIContentPool.Create("Overflow"), readOnly); members[13] = ObjectReferenceDrawer.Create(first.font, memberBuildList[13], this, GUIContentPool.Create("Font"), true, false, readOnly); members[14] = IntDrawer.Create(first.fontSize, memberBuildList[14], this, GUIContentPool.Create("Font Size"), readOnly); members[15] = EnumDrawer.Create(first.fontStyle, memberBuildList[15], this, GUIContentPool.Create("Font Style"), readOnly); members[16] = EnumDrawer.Create(first.alignment, memberBuildList[16], this, GUIContentPool.Create("Alignment"), readOnly); members[17] = ToggleDrawer.Create(first.wordWrap, memberBuildList[17], this, GUIContentPool.Create("Word Wrap"), readOnly); members[18] = ToggleDrawer.Create(first.richText, memberBuildList[18], this, GUIContentPool.Create("Rich Text"), readOnly); members[19] = EnumDrawer.Create(first.clipping, memberBuildList[19], this, GUIContentPool.Create("Text Clipping"), readOnly); members[20] = EnumDrawer.Create(first.imagePosition, memberBuildList[20], this, GUIContentPool.Create("Image Position"), readOnly); members[21] = Vector2Drawer.Create(first.contentOffset, memberBuildList[21], this, GUIContentPool.Create("Content Offset"), readOnly); members[22] = FloatDrawer.Create(first.fixedWidth, memberBuildList[22], this, GUIContentPool.Create("Fixed Width"), readOnly); members[23] = FloatDrawer.Create(first.fixedHeight, memberBuildList[23], this, GUIContentPool.Create("Fixed Height"), readOnly); members[24] = ToggleDrawer.Create(first.stretchWidth, memberBuildList[24], this, GUIContentPool.Create("Strech Width"), readOnly); members[25] = ToggleDrawer.Create(first.stretchHeight, memberBuildList[25], this, GUIContentPool.Create("Strech Height"), readOnly); #if DEV_MODE Debug.Assert(memberBuildList.Count == members.Length); #endif }