private void SetHeightDeterminant(TextFieldHeightDeterminant setValue) { HeightDeterminant = setValue; forceAlwaysTextArea = false; alwaysSingleLineHeight = /*!forceAlwaysTextArea && */ setValue == TextFieldHeightDeterminant.Constant; InspectorUtility.ActiveManager.OnNextLayout(UpdateDynamicHeight); }
/// <inheritdoc cref="IDrawer.Dispose" /> public override void Dispose() { PrefixResizeUtility.OnPrefixResizingFinished -= OnPrefixResizingFinished; InspectorUtility.ActiveInspector.State.OnWidthChanged -= UpdateDynamicHeight; editField = false; textArea = false; forceAlwaysTextArea = false; height = DrawGUI.SingleLineHeight; alwaysSingleLineHeight = false; textFieldDrawPosition.width = 0f; textAreaDrawPosition.width = 0f; textFieldHeight = default(TextFieldHeightDeterminant); parentDrawnInSingleRow = false; delayed = false; base.Dispose(); }
protected virtual void Setup(string setValue, LinkedMemberInfo setMemberInfo, IParentDrawer setParent, GUIContent setLabel, bool setReadOnly, bool setTextArea, bool setDelayed) { #if DEV_MODE if (setValue == null) { Debug.LogWarning(ToString(setLabel, setMemberInfo) + ".Setup called with null value"); } #endif base.Setup(setValue, typeof(string), setMemberInfo, setParent, setLabel, setReadOnly); delayed = setDelayed; PrefixResizeUtility.OnPrefixResizingFinished += OnPrefixResizingFinished; var inspector = InspectorUtility.ActiveInspector; inspector.State.OnWidthChanged += UpdateDynamicHeight; parentDrawnInSingleRow = setParent != null && setParent.DrawInSingleRow; #if DEV_MODE && PI_ASSERTATIONS inspector.OnNextLayout(() => Debug.Assert(parentDrawnInSingleRow == (setParent != null && setParent.DrawInSingleRow), ToString() + ".parentDrawnInSingleRow was " + parentDrawnInSingleRow + " but now is " + (setParent == null ? "null" : setParent.DrawInSingleRow.ToString()))); #endif if (parentDrawnInSingleRow) { textArea = false; forceAlwaysTextArea = false; textFieldHeight = TextFieldHeightDeterminant.Constant; } else { // if parent is a collection and has the TextArea attribute, then set this as text area var parentCollection = setParent as ICollectionDrawer; if (parentCollection != null) { var parentMemberInfo = parent.MemberInfo; if (parentMemberInfo != null) { var parentTextAreaAttribute = parentMemberInfo.GetAttribute <TextAreaAttribute>(); if (parentTextAreaAttribute != null) { setTextArea = true; } } } forceAlwaysTextArea = setTextArea; textArea = setTextArea; textFieldHeight = inspector.Preferences.textFieldHeight; } if (textFieldHeight == TextFieldHeightDeterminant.Constant) { alwaysSingleLineHeight = !textArea; height = MinHeight; } else { alwaysSingleLineHeight = false; if (textFieldHeight == TextFieldHeightDeterminant.WordWrapping) { height = MinHeight; } UpdateDynamicHeightWhenReady(); } }