/// <summary> /// Make layout position /// </summary> /// <param name="cd">X=Second from First Speech / Y=Speech Device ID</param> /// <param name="target"></param> /// <returns></returns> public LayoutRect TalkPositioner(CodeRect cd, PartsBase target) { return(LayoutRect.FromLTRB( cd.LT.X * DataHot.LayoutPixelPerSecond, MakeTopByRowID(cd.LT.Y), cd.RB.X * DataHot.LayoutPixelPerSecond, MakeBottomByRowID(cd.RB.Y))); }
public Button(LayoutRect bounds, TextSpan text, bool isSimple = false) : base(bounds) { Text = new TextArea( text, Width - Enclosure.TotalWidth, justification: HJustification.CENTER); IsSimple = isSimple; }
public TextInput(LayoutRect bounds, int?charLimit, string promptText = "") : base(bounds) { TextArea = new TextArea("", Width); Prompt = new TextArea( promptText, Width, new ColorPair(Style.GetFore("Disabled"), Color.None)); CharLimit = charLimit; }
public MultilineTextInput(LayoutRect bounds, int?charLimit = null, bool canExpand = false, string promptText = "") : base(bounds, charLimit, promptText) { if (canExpand) { MinHeight = Height; TextArea.HeightChanged += TextArea_HeightChanged; } }
void OnGUI() { if (data == null) { GetTodoData(); } var rect = new LayoutRect(position.width, 4); rect.AddLineHeight(0.1f); DisplayTodos(rect); DisplayTodoCreation(rect); }
private void DisplayTodoCreation(LayoutRect rect) { GUILayout.FlexibleSpace(); rect.UpdateFromLayoutRect(GUILayoutUtility.GetLastRect()); EditorGUI.LabelField(rect.GetRectOfWidth(40f), "Title: "); dataHolder.title = EditorGUI.TextField(rect.GetRemainingWidth(true), dataHolder.title); EditorGUI.LabelField(rect.GetRectOfWidth(40f), "Todo:"); dataHolder.text = EditorGUI.TextArea(rect.GetRemainingWidth(true), dataHolder.text); if (GUI.Button(rect.GetRemainingWidth(true), "Create")) { CreateTodo(); } rect.AddLineHeight(.5f); }
public ListBox(LayoutRect bounds, TextSpan title = null, bool selectionEnabled = false, BoxDrawing lineStyle = null) : base(bounds) { LayoutContainer container = new LayoutContainer( new LayoutRect( new FlexSize(bounds.Width - 2), new FlexSize(1)), Orientation.Vertical, LayoutContainer.MainAxisJustification.FIT); SetContent(new ScrollBox( bounds.Clone(), container, text: title, lineStyle: lineStyle)); IsSelectionEnabled = selectionEnabled; }
private void DisplayTodos(LayoutRect rect) { bool useGrey = false; Color grey = new Color32(80, 80, 80, 255); Color green = new Color32(30, 118, 59, 255); for (int i = data.slots.Count - 1; i >= 0; i--) { var todoSlot = data.slots[i]; if (useGrey && !todoSlot.complete) { GUI.DrawTexture(new Rect(0, rect.y, position.width, 2 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing)), EditorGUIUtility.whiteTexture, ScaleMode.StretchToFill, false, 0, grey, 0, 0); } else if (todoSlot.complete) { GUI.DrawTexture(new Rect(0, rect.y, position.width, 2 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing)), EditorGUIUtility.whiteTexture, ScaleMode.StretchToFill, false, 0, green, 0, 0); } useGrey = !useGrey; EditorGUI.LabelField(rect.GetRectOfWidth(40f), "Todo:"); EditorGUI.LabelField(rect.GetRectUntilRemainingWidth(80f), todoSlot.title, EditorStyles.boldLabel); EditorGUI.LabelField(rect.GetRectUntilRemainingWidth(10), "Complete:"); EditorGUI.BeginChangeCheck(); todoSlot.complete = EditorGUI.Toggle(rect.GetRemainingWidth(true), todoSlot.complete); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(data); } EditorGUI.LabelField(rect.GetRectUntilRemainingWidth(20), todoSlot.text); if (GUI.Button(rect.GetRemainingWidth(true), "x")) { data.slots.RemoveAt(i); EditorUtility.SetDirty(data); } rect.AddLineHeight(.2f); } rect.Reset(); }
public override bool ViewToModel(Point position, out int offset, out Bias bias) { if (!LayoutRect.Contains(position)) { offset = -1; bias = Bias.Forward; return(false); } for (var i = 0; i < Count; i += 1) { var child = this[i]; if (child.ViewToModel(position, out offset, out bias)) { return(true); } } offset = -1; bias = Bias.Forward; return(false); }
public Toggle(LayoutRect bounds, TextSpan label, bool on = false) : base(bounds) { Checked = on; Label = label; }
public Container(LayoutRect bounds) : base(bounds) { }
public TabBox(LayoutRect bounds, BoxDrawing?lineStyle = null) : base(bounds) { Tabs = new List <Tab>(); LineStyle = lineStyle ?? BoxDrawing.Default; }
public TextBlock(LayoutRect bounds, string text) : this(bounds, TextArea.Parse(text, bounds.Width)) { }
public TextBlock(LayoutRect bounds, TextArea text) : base(bounds) { Text = text; }