protected TextInputBaseField(string label, int maxLength, char maskChar, TextInputBase textInputBase) : base(label, textInputBase) { tabIndex = 0; delegatesFocus = false; AddToClassList(ussClassName); labelElement.AddToClassList(labelUssClassName); visualInput.AddToClassList(inputUssClassName); m_TextInputBase = textInputBase; m_TextInputBase.maxLength = maxLength; m_TextInputBase.maskChar = maskChar; }
private static void SyncGUIStyle(TextInputBase textInput, GUIStyle style) { var computedStyle = textInput.computedStyle; style.alignment = computedStyle.unityTextAlign.GetSpecifiedValueOrDefault(style.alignment); style.wordWrap = computedStyle.whiteSpace.specificity != StyleValueExtensions.UndefinedSpecificity ? computedStyle.whiteSpace.value == WhiteSpace.Normal : style.wordWrap; bool overflowVisible = computedStyle.overflow.specificity != StyleValueExtensions.UndefinedSpecificity ? computedStyle.overflow.value == Overflow.Visible : style.clipping == TextClipping.Overflow; style.clipping = overflowVisible ? TextClipping.Overflow : TextClipping.Clip; if (computedStyle.unityFont.value != null) { style.font = computedStyle.unityFont.value; } style.fontSize = (int)computedStyle.fontSize.GetSpecifiedValueOrDefault((float)style.fontSize); style.fontStyle = computedStyle.unityFontStyleAndWeight.GetSpecifiedValueOrDefault(style.fontStyle); int left = computedStyle.unitySliceLeft.value; int top = computedStyle.unitySliceTop.value; int right = computedStyle.unitySliceRight.value; int bottom = computedStyle.unitySliceBottom.value; AssignRect(style.border, left, top, right, bottom); if (IsLayoutUsingPercent(textInput)) { textInput.DeferGUIStyleRectSync(); } else { left = (int)computedStyle.marginLeft.value.value; top = (int)computedStyle.marginTop.value.value; right = (int)computedStyle.marginRight.value.value; bottom = (int)computedStyle.marginBottom.value.value; AssignRect(style.margin, left, top, right, bottom); left = (int)computedStyle.paddingLeft.value.value; top = (int)computedStyle.paddingTop.value.value; right = (int)computedStyle.paddingRight.value.value; bottom = (int)computedStyle.paddingBottom.value.value; AssignRect(style.padding, left, top, right, bottom); } }
private static void SyncGUIStyle(TextInputBase textInput, GUIStyle style) { var computedStyle = textInput.computedStyle; style.alignment = computedStyle.unityTextAlign; style.wordWrap = computedStyle.whiteSpace == WhiteSpace.Normal; bool overflowVisible = computedStyle.overflow == OverflowInternal.Visible; style.clipping = overflowVisible ? TextClipping.Overflow : TextClipping.Clip; if (computedStyle.unityFont != null) { style.font = computedStyle.unityFont; } style.fontSize = (int)computedStyle.fontSize.value; style.fontStyle = computedStyle.unityFontStyleAndWeight; int left = computedStyle.unitySliceLeft; int top = computedStyle.unitySliceTop; int right = computedStyle.unitySliceRight; int bottom = computedStyle.unitySliceBottom; AssignRect(style.border, left, top, right, bottom); if (IsLayoutUsingPercent(textInput)) { textInput.DeferGUIStyleRectSync(); } else { left = (int)computedStyle.marginLeft.value; top = (int)computedStyle.marginTop.value; right = (int)computedStyle.marginRight.value; bottom = (int)computedStyle.marginBottom.value; AssignRect(style.margin, left, top, right, bottom); left = (int)computedStyle.paddingLeft.value; top = (int)computedStyle.paddingTop.value; right = (int)computedStyle.paddingRight.value; bottom = (int)computedStyle.paddingBottom.value; AssignRect(style.padding, left, top, right, bottom); } }
protected TextInputBaseField(string label, int maxLength, char maskChar, TextInputBase textInputBase) : base(label, textInputBase) { tabIndex = 0; delegatesFocus = true; labelElement.tabIndex = -1; // To delegate directly to text-input field AddToClassList(ussClassName); labelElement.AddToClassList(labelUssClassName); visualInput.AddToClassList(inputUssClassName); visualInput.AddToClassList(singleLineInputUssClassName); m_TextInputBase = textInputBase; m_TextInputBase.maxLength = maxLength; m_TextInputBase.maskChar = maskChar; RegisterCallback <AttachToPanelEvent>(OnAttachToPanel); RegisterCallback <CustomStyleResolvedEvent>(OnFieldCustomStyleResolved); }
protected TextInputBaseField(int maxLength, char maskChar, TextInputBase textInputBase) : this(null, maxLength, maskChar, textInputBase) { }