internal override void DoRepaint(IStylePainter painter) { UnityEngine.Profiling.Profiler.BeginSample("DrawEdge"); // Edges do NOT call base.DoRepaint. It would create a visual artifact. DrawEdge(painter); UnityEngine.Profiling.Profiler.EndSample(); }
internal override void DoRepaint(IStylePainter painter) { base.DoRepaint(); lastWorldClip = painter.currentWorldClip; HandleIMGUIEvent(painter.repaintEvent); }
protected override void DoRepaint(IStylePainter painter) { if (m_Mesh != null) { if (m_Mat == null) { m_Mat = new Material(EditorGUIUtility.LoadRequired("Shaders/UIElements/AACurveField.shader") as Shader); m_Mat.hideFlags = HideFlags.HideAndDontSave; } float scale = worldTransform.MultiplyVector(Vector3.one).x; float realWidth = CurveField.k_EdgeWidth; if (realWidth * scale < CurveField.k_MinEdgeWidth) { realWidth = CurveField.k_MinEdgeWidth / scale; } // Send the view zoom factor so that the antialias width do not grow when zooming in. m_Mat.SetFloat("_ZoomFactor", scale * realWidth / CurveField.k_EdgeWidth * EditorGUIUtility.pixelsPerPoint); // Send the view zoom correction so that the vertex shader can scale the edge triangles when below m_MinWidth. m_Mat.SetFloat("_ZoomCorrection", realWidth / CurveField.k_EdgeWidth); m_Mat.SetColor("_Color", (QualitySettings.activeColorSpace == ColorSpace.Linear) ? curveColor.gamma : curveColor); var stylePainter = (IStylePainterInternal)painter; var meshParams = MeshStylePainterParameters.GetDefault(m_Mesh, m_Mat); stylePainter.DrawMesh(meshParams); } }
internal virtual void DoRepaint(IStylePainter painter) { if ((this.pseudoStates & PseudoStates.Invisible) != PseudoStates.Invisible) { this.DoRepaint(); } }
internal override void DoRepaint(IStylePainter painter) { lastWorldClip = elementPanel.repaintData.currentWorldClip; var stylePainter = (IStylePainterInternal)painter; stylePainter.DrawImmediate(m_DrawImmediateAction); }
internal override void DoRepaint(IStylePainter painter) { if (this.isPasswordField) { string text = "".PadRight(this.text.Length, base.maskChar); if (!base.hasFocus) { painter.DrawBackground(this); painter.DrawBorder(this); if (!string.IsNullOrEmpty(text) && base.contentRect.width > 0f && base.contentRect.height > 0f) { TextStylePainterParameters defaultTextParameters = painter.GetDefaultTextParameters(this); defaultTextParameters.text = text; painter.DrawText(defaultTextParameters); } } else { base.DrawWithTextSelectionAndCursor(painter, text); } } else { base.DoRepaint(painter); } }
internal static void DrawText(this IStylePainter painter, BaseTextElement te) { if (!string.IsNullOrEmpty(te.text) && te.contentRect.width > 0f && te.contentRect.height > 0f) { painter.DrawText(painter.GetDefaultTextParameters(te)); } }
internal override void DoRepaint(IStylePainter painter) { if (this.touchScreenTextField) { TouchScreenTextEditorEventHandler touchScreenTextEditorEventHandler = this.editorEventHandler as TouchScreenTextEditorEventHandler; if (touchScreenTextEditorEventHandler != null && this.editorEngine.keyboardOnScreen != null) { this.UpdateText(this.CullString(this.editorEngine.keyboardOnScreen.text)); if (this.editorEngine.keyboardOnScreen.status != TouchScreenKeyboard.Status.Visible) { this.editorEngine.keyboardOnScreen = null; GUI.changed = true; } } string text = this.text; if (touchScreenTextEditorEventHandler != null && !string.IsNullOrEmpty(touchScreenTextEditorEventHandler.secureText)) { text = "".PadRight(touchScreenTextEditorEventHandler.secureText.Length, this.maskChar); } base.DoRepaint(painter); this.text = text; } else if (!this.hasFocus) { base.DoRepaint(painter); } else { this.DrawWithTextSelectionAndCursor(painter, this.text); } }
protected override void DoRepaint(IStylePainter painter) { var pointCount = points.Count; if (pointCount < 1) { return; } var lineColor = (deleteModifier) ? deleteSegmentColor : segmentColor; HandleUtility.ApplyWireMaterial(); GL.Begin(GL.LINES); GL.Color(lineColor); for (int i = 1; i < pointCount; i++) { // Apply offset Vector2 start = points[i - 1] + parent.layout.position; Vector2 end = points[i] + parent.layout.position; DrawDottedLine(start, end, segmentSize); } GL.End(); }
protected override void DoRepaint(IStylePainter painter) { var stylePainter = (IStylePainterInternal)painter; if (isPasswordField) { // if we use system keyboard we will have normal text returned (hiding symbols is done inside os) // so before drawing make sure we hide them ourselves string drawText = "".PadRight(text.Length, maskChar); if (!hasFocus) { // We don't have the focus, don't draw the selection and cursor if (!string.IsNullOrEmpty(drawText) && contentRect.width > 0.0f && contentRect.height > 0.0f) { var textParams = TextStylePainterParameters.GetDefault(this, text); textParams.text = drawText; stylePainter.DrawText(textParams); } } else { DrawWithTextSelectionAndCursor(stylePainter, drawText); } } else { base.DoRepaint(painter); } }
protected override void DoRepaint(IStylePainter painter) { lastWorldClip = elementPanel.repaintData.currentWorldClip; var stylePainter = (IStylePainterInternal)painter; stylePainter.DrawImmediate(HandleIMGUIEvent); }
public override void DoRepaint() { IStylePainter stylePainter = base.elementPanel.stylePainter; stylePainter.DrawBackground(this); stylePainter.DrawBorder(this); stylePainter.DrawText(this); }
internal override void DoRepaint(IStylePainter args) { base.style.Draw(base.position, GUIContent.Temp(base.text), base.id); if (GUIUtility.hotControl == base.id) { this.isPressed = base.position.Contains(args.mousePosition); } }
internal virtual void DoRepaint(IStylePainter painter) { if ((pseudoStates & PseudoStates.Invisible) == PseudoStates.Invisible) { return; } DoRepaint(); }
internal virtual void DrawEdge(IStylePainter painter) { var stylePainter = (IStylePainterInternal)painter; if (!DrawUsingUIVertices(stylePainter)) { stylePainter.DrawImmediate(Draw); } }
public override void DoRepaint() { Texture2D backgroundTexture = GradientEditor.GetBackgroundTexture(); IStylePainter stylePainter = base.elementPanel.stylePainter; TextureStylePainterParameters defaultTextureParameters = stylePainter.GetDefaultTextureParameters(this); defaultTextureParameters.texture = backgroundTexture; stylePainter.DrawTexture(defaultTextureParameters); base.DoRepaint(); }
protected override void DoRepaint(IStylePainter painter) { for (int i = 0; i < shadow.childCount - 1; ++i) { VisualElement visualElement = shadow[i]; bool isVertical = style.flexDirection == FlexDirection.Column || style.flexDirection == FlexDirection.ColumnReverse; EditorGUIUtility.AddCursorRect(GetSplitterRect(visualElement), isVertical ? MouseCursor.ResizeVertical : MouseCursor.SplitResizeLeftRight); } }
internal override void DoRepaint(IStylePainter args) { int num; float elemWidth; float elemHeight; if (this.ComputeElemDimensions(out num, out elemWidth, out elemHeight)) { GUIStyle gUIStyle = GUIStyle.none; GUIClip.Internal_Push(base.position, Vector2.zero, Vector2.zero, false); Rect position = new Rect(0f, 0f, base.position.width, base.position.height); Rect[] array = IMButtonGrid.CalcMouseRects(position, num, this.xCount, elemWidth, elemHeight, base.style, this.firstStyle, this.midStyle, this.lastStyle, false); Vector2 mousePos = args.mousePosition - base.position.position; int buttonGridMouseSelection = this.GetButtonGridMouseSelection(array, mousePos, base.id == GUIUtility.hotControl); bool flag = position.Contains(args.mousePosition); GUIUtility.mouseUsed |= flag; for (int i = 0; i < num; i++) { GUIStyle gUIStyle2; if (i != 0) { gUIStyle2 = this.midStyle; } else { gUIStyle2 = this.firstStyle; } if (i == num - 1) { gUIStyle2 = this.lastStyle; } if (num == 1) { gUIStyle2 = base.style; } if (i != this.selected) { gUIStyle2.Draw(array[i], this.contents[i], i == buttonGridMouseSelection && (this.enabled || base.id == GUIUtility.hotControl) && (base.id == GUIUtility.hotControl || GUIUtility.hotControl == 0), base.id == GUIUtility.hotControl && this.enabled, false, false); } else { gUIStyle = gUIStyle2; } } if (this.selected < num && this.selected > -1) { gUIStyle.Draw(array[this.selected], this.contents[this.selected], this.selected == buttonGridMouseSelection && (this.enabled || base.id == GUIUtility.hotControl) && (base.id == GUIUtility.hotControl || GUIUtility.hotControl == 0), base.id == GUIUtility.hotControl, true, false); } if (buttonGridMouseSelection >= 0) { GUI.tooltip = this.contents[buttonGridMouseSelection].tooltip; } GUIClip.Internal_Pop(); } }
internal override void DoRepaint(IStylePainter args) { if (GUIUtility.keyboardControl != base.id) { base.style.Draw(base.position, GUIContent.Temp(base.text), base.id, false); } else { base.editor.DrawCursor(base.text); } }
internal override void DoRepaint(IStylePainter painter) { if (this.image == null) { Debug.LogWarning("null texture passed to GUI.DrawTexture"); } else { painter.DrawTexture(base.contentRect, this.image, GUI.color, this.scaleMode, 0f, 0f, 0, 0, 0, 0); } }
protected override void DoRepaint(IStylePainter painter) { if (renderMode == RenderMode.Mesh) { SetupMeshRepaint(); } else { SetupStandardRepaint(); } }
internal static void DrawBorder(this IStylePainter painter, VisualElement ve) { IStyle style = ve.style; if (style.borderColor != Color.clear && (style.borderLeftWidth > 0f || style.borderTopWidth > 0f || style.borderRightWidth > 0f || style.borderBottomWidth > 0f)) { RectStylePainterParameters defaultRectParameters = painter.GetDefaultRectParameters(ve); defaultRectParameters.color = style.borderColor; painter.DrawRect(defaultRectParameters); } }
internal void Repaint(IStylePainter painter) { if (visible == false) { return; } var stylePainter = (IStylePainterInternal)painter; stylePainter.DrawBackground(); DoRepaint(stylePainter); stylePainter.DrawBorder(); }
internal static RectStylePainterParameters GetDefaultRectParameters(this IStylePainter painter, VisualElement ve) { IStyle style = ve.style; RectStylePainterParameters result = new RectStylePainterParameters { rect = ve.rect, color = style.backgroundColor }; painter.SetBorderFromStyle(ref result.border, style); return(result); }
internal static RectStylePainterParameters GetDefaultRectParameters(this IStylePainter painter, VisualElement ve) { IStyle style = ve.style; var painterParams = new RectStylePainterParameters { rect = ve.alignedRect, color = style.backgroundColor, }; painter.SetBorderFromStyle(ref painterParams.border, style); return(painterParams); }
protected internal override Vector2 DoMeasure(float width, VisualElement.MeasureMode widthMode, float height, VisualElement.MeasureMode heightMode) { float num = float.NaN; float num2 = float.NaN; Font font = base.style.font; Vector2 result; if (this.text == null || font == null) { result = new Vector2(num, num2); } else { IStylePainter stylePainter = base.elementPanel.stylePainter; if (widthMode == VisualElement.MeasureMode.Exactly) { num = width; } else { TextStylePainterParameters defaultTextParameters = stylePainter.GetDefaultTextParameters(this); defaultTextParameters.text = this.text; defaultTextParameters.font = font; defaultTextParameters.wordWrapWidth = 0f; defaultTextParameters.wordWrap = false; defaultTextParameters.richText = true; num = stylePainter.ComputeTextWidth(defaultTextParameters); if (widthMode == VisualElement.MeasureMode.AtMost) { num = Mathf.Min(num, width); } } if (heightMode == VisualElement.MeasureMode.Exactly) { num2 = height; } else { TextStylePainterParameters defaultTextParameters2 = stylePainter.GetDefaultTextParameters(this); defaultTextParameters2.text = this.text; defaultTextParameters2.font = font; defaultTextParameters2.wordWrapWidth = num; defaultTextParameters2.richText = true; num2 = stylePainter.ComputeTextHeight(defaultTextParameters2); if (heightMode == VisualElement.MeasureMode.AtMost) { num2 = Mathf.Min(num2, height); } } result = new Vector2(num, num2); } return(result); }
internal override void DoRepaint(IStylePainter painter) { if (this.touchScreenTextField) { TouchScreenTextEditor touchScreenTextEditor = this.editor as TouchScreenTextEditor; if (touchScreenTextEditor != null && touchScreenTextEditor.keyboardOnScreen != null) { base.text = touchScreenTextEditor.keyboardOnScreen.text; if (this.editor.maxLength >= 0 && base.text != null && base.text.Length > this.editor.maxLength) { base.text = base.text.Substring(0, this.editor.maxLength); } if (touchScreenTextEditor.keyboardOnScreen.done) { touchScreenTextEditor.keyboardOnScreen = null; GUI.changed = true; } } string text = base.text; if (touchScreenTextEditor != null && !string.IsNullOrEmpty(touchScreenTextEditor.secureText)) { text = "".PadRight(touchScreenTextEditor.secureText.Length, this.maskChar); } base.DoRepaint(painter); base.text = text; } else if (this.isPasswordField) { string text2 = base.text; base.text = "".PadRight(base.text.Length, this.maskChar); if (!this.hasFocus) { base.DoRepaint(painter); } else { this.DrawWithTextSelectionAndCursor(painter, base.text); } base.text = text2; } else if (!this.hasFocus) { base.DoRepaint(painter); } else { this.DrawWithTextSelectionAndCursor(painter, base.text); } }
internal override void DoRepaint(IStylePainter painter) { if (this.touchScreenTextField) { TouchScreenTextEditor touchScreenTextEditor = this.editor as TouchScreenTextEditor; if (touchScreenTextEditor != null && touchScreenTextEditor.keyboardOnScreen != null) { base.text = touchScreenTextEditor.keyboardOnScreen.text; if (this.editor.maxLength >= 0 && base.text != null && base.text.Length > this.editor.maxLength) { base.text = base.text.Substring(0, this.editor.maxLength); } if (touchScreenTextEditor.keyboardOnScreen.done) { touchScreenTextEditor.keyboardOnScreen = null; GUI.changed = true; } } string t = base.text; if (touchScreenTextEditor != null && !string.IsNullOrEmpty(touchScreenTextEditor.secureText)) { t = "".PadRight(touchScreenTextEditor.secureText.Length, this.maskChar); } this.style.Draw(base.position, GUIContent.Temp(t), 0, false); } else if (this.isPasswordField) { string text = "".PadRight(base.text.Length, this.maskChar); if (!this.hasFocus) { this.style.Draw(base.position, GUIContent.Temp(text), 0, false); } else { this.DrawCursor(text); } } else if (!this.hasFocus) { this.style.Draw(base.position, GUIContent.Temp(base.text), 0, false); } else { this.DrawCursor(base.text); } }
internal static void DrawBackground(this IStylePainter painter, VisualElement ve) { IStyle style = ve.style; if (style.backgroundColor != Color.clear) { RectStylePainterParameters defaultRectParameters = painter.GetDefaultRectParameters(ve); defaultRectParameters.border.SetWidth(0f); painter.DrawRect(defaultRectParameters); } if (style.backgroundImage.value != null) { TextureStylePainterParameters defaultTextureParameters = painter.GetDefaultTextureParameters(ve); defaultTextureParameters.border.SetWidth(0f); painter.DrawTexture(defaultTextureParameters); } }
internal override void DoRepaint(IStylePainter painter) { if (this.image == null) { Debug.LogWarning("null texture passed to GUI.DrawTexture"); } else { TextureStylePainterParameters painterParams = new TextureStylePainterParameters { layout = base.contentRect, texture = this.image, color = GUI.color, scaleMode = this.scaleMode }; painter.DrawTexture(painterParams); } }