internal static int OnProcess(string Title, int Index, int Value, LGuiRect Rect) { var ID = LGuiHash.CalculateID(Title); LGuiContext.SetPreviousControlID(ID); if (!LGuiMisc.CheckVisible(ref Rect)) { return(Value); } LGuiMisc.CheckAndSetContextID(ref Rect, ID); var BgColorIndex = LGuiContext.ActiveID == ID ? LGuiStyleColorIndex.FrameActived : LGuiContext.HoveredID == ID ? LGuiStyleColorIndex.FrameHovered : LGuiStyleColorIndex.Frame; var Radius = LGuiStyle.GetValue(LGuiStyleValueIndex.RadioButtonRadius); var RadioCenter = new LGuiVec2(Rect.X + Radius, Rect.Y + Rect.Height / 2.0f); LGuiGraphics.DrawCircle(RadioCenter, Radius, BgColorIndex, true); LGuiGraphics.DrawCircle(RadioCenter, Radius, LGuiStyleColorIndex.Border, false); if (Index == Value) { LGuiGraphics.DrawCircle(RadioCenter, Radius - 3, LGuiStyleColorIndex.CheckMask, true); } LGuiGraphics.DrawText(Title, new LGuiVec2(Rect.X + Radius * 2 + 3, Rect.Y + 1), LGuiStyleColorIndex.Text); if (LGuiMisc.CheckAndSetFocusID(ID)) { Value = Index; } return(Value); }
internal static bool OnProcess(string Title, bool Value, LGuiRect Rect) { var ID = LGuiHash.CalculateID(Title); LGuiContext.SetPreviousControlID(ID); if (!LGuiMisc.CheckVisible(ref Rect)) { return(Value); } var BoxSize = LGuiStyle.GetValue(LGuiStyleValueIndex.CheckBoxSize); var BoxRect = new LGuiRect(new LGuiVec2(Rect.X, Rect.Y + (Rect.Height - BoxSize) / 2.0f), new LGuiVec2(BoxSize, BoxSize)); LGuiMisc.CheckAndSetContextID(ref Rect, ID); var BgColorIndex = LGuiContext.ActiveID == ID ? LGuiStyleColorIndex.FrameActived : LGuiContext.HoveredID == ID ? LGuiStyleColorIndex.FrameHovered : LGuiStyleColorIndex.Frame; LGuiGraphics.DrawRect(BoxRect, BgColorIndex, true); LGuiGraphics.DrawRect(BoxRect, LGuiStyleColorIndex.Border, false); if (Value) { LGuiGraphics.DrawRect(new LGuiRect(BoxRect.X + 2, BoxRect.Y + 2, BoxRect.Width - 4, BoxRect.Height - 4), LGuiStyleColorIndex.CheckMask, true); } LGuiGraphics.DrawText(Title, new LGuiVec2(Rect.X + BoxSize + 3, Rect.Y + 1), LGuiStyleColorIndex.Text); if (LGuiMisc.CheckAndSetFocusID(ID)) { Value = !Value; } return(Value); }
internal static void OnProcess(string Title, float Value, LGuiRect Rect) { var ID = LGuiHash.CalculateID(Title); LGuiContext.SetPreviousControlID(ID); if (!LGuiMisc.CheckVisible(ref Rect)) { return; } LGuiMisc.CheckAndSetContextID(ref Rect, ID, true); Value = LGuiMisc.Clamp01(Value); var MaskRect = new LGuiRect(Rect.X + 1, Rect.Y + 1, (Rect.Width - 2) * Value, Rect.Height - 2); LGuiGraphics.DrawRect(Rect, LGuiStyleColorIndex.Frame, true, false); LGuiGraphics.DrawRect(MaskRect, LGuiStyleColorIndex.CheckMask, true, false); LGuiGraphics.DrawRect(Rect, LGuiStyleColorIndex.Border, false, false); var Text = $"{(Value * 100):00}%"; var TextSize = LGuiConvert.GetTextSize(Text, LGuiContext.Font); LGuiGraphics.DrawText(Text, new LGuiVec2(Rect.CenterX - TextSize.X / 2.0f, Rect.CenterY - TextSize.Y / 2.0f), LGuiStyleColorIndex.Text); }
internal static bool OnProcess(string Text, bool Selected, LGuiRect Rect) { var ID = LGuiHash.CalculateID(Text); LGuiContext.SetPreviousControlID(ID); if (!LGuiMisc.CheckVisible(ref Rect)) { return(false); } LGuiMisc.CheckAndSetContextID(ref Rect, ID); var BgColorIndex = LGuiContext.ActiveID == ID ? LGuiStyleColorIndex.HeaderActive : LGuiContext.HoveredID == ID ? LGuiStyleColorIndex.HeaderHovered : Selected ? LGuiStyleColorIndex.Header : LGuiStyleColorIndex.Frame; LGuiGraphics.DrawRect(Rect, BgColorIndex, true, false); LGuiGraphics.DrawText(Text, new LGuiVec2(Rect.X, Rect.Y), LGuiStyleColorIndex.Text); if (LGuiMisc.CheckAndSetFocusID(ID)) { return(true); } return(false); }
internal static bool HandleHsvSlider(string Title, ref LGuiColor Hsv, LGuiVec2 Pos, float Length) { var TitleWidth = LGuiContext.Font.FontWidth * 2.5f; var SpacingY = LGuiStyle.GetValue(LGuiStyleValueIndex.ControlSpacingY); var SliderSize = LGuiStyle.GetValue(LGuiStyleValueIndex.SliderSize); var HsvValueChanged = false; LGuiGraphics.DrawText("H:", new LGuiVec2(Pos.X, Pos.Y), LGuiStyleColorIndex.Text); if (LGuiSlider.OnProcess($"{Title}_HueSlider", ref Hsv.R, 0.0f, 1.0f, 0.005f, true, "{0:0.00}", new LGuiRect(Pos.X + TitleWidth, Pos.Y, Length - TitleWidth, SliderSize))) { HsvValueChanged = true; } LGuiGraphics.DrawText("S:", new LGuiVec2(Pos.X, Pos.Y + SliderSize + SpacingY), LGuiStyleColorIndex.Text); if (LGuiSlider.OnProcess($"{Title}_SaturationSlider", ref Hsv.G, 0.0f, 1.0f, 0.005f, true, "{0:0.00}", new LGuiRect(Pos.X + TitleWidth, Pos.Y + SliderSize + SpacingY, Length - TitleWidth, SliderSize))) { HsvValueChanged = true; } LGuiGraphics.DrawText("V:", new LGuiVec2(Pos.X, Pos.Y + (SliderSize + SpacingY) * 2.0f), LGuiStyleColorIndex.Text); if (LGuiSlider.OnProcess($"{Title}_ValueSlider", ref Hsv.B, 0.0f, 1.0f, 0.005f, true, "{0:0.00}", new LGuiRect(Pos.X + TitleWidth, Pos.Y + (SliderSize + SpacingY) * 2.0f, Length - TitleWidth, SliderSize))) { HsvValueChanged = true; } return(HsvValueChanged); }
internal static bool Begin(string Title) { var FullTitle = $"{LGuiContext.GetCurrentFrame().Title}/{Title}"; var ID = LGuiHash.CalculateID(FullTitle); LGuiContext.SetPreviousControlID(ID); var Rect = LGuiLayout.DoLayout(new LGuiVec2(LGuiStyle.GetValue(LGuiStyleValueIndex.LargeControlLength), LGuiStyle.GetValue(LGuiStyleValueIndex.HeaderSize))); if (!LGuiMisc.CheckVisible(ref Rect)) { return(false); } LGuiMisc.CheckAndSetContextID(ref Rect, ID); var BgColorIndex = LGuiContext.ActiveID == ID ? LGuiStyleColorIndex.GroupActived : LGuiContext.HoveredID == ID ? LGuiStyleColorIndex.GroupHovered : LGuiStyleColorIndex.Group; LGuiGraphics.DrawRect(Rect, BgColorIndex, true); LGuiGraphics.DrawRect(Rect, LGuiStyleColorIndex.Border, false); LGuiGraphics.DrawText(Title, new LGuiVec2(Rect.X + LGuiStyle.GetValue(LGuiStyleValueIndex.GroupChildSpacing), Rect.Y), LGuiStyleColorIndex.Text); var Expand = LGuiContextCache.GetGroupExpand(FullTitle); if (Expand) { LGuiGraphics.DrawTriangle( new LGuiVec2(Rect.X + 5, Rect.Y + 3), new LGuiVec2(Rect.X + 15, Rect.Y + 3), new LGuiVec2(Rect.X + 10, Rect.Bottom - 3), LGuiStyle.GetColor(LGuiStyleColorIndex.Text), true); } else { LGuiGraphics.DrawTriangle( new LGuiVec2(Rect.X + 5, Rect.Y + 3), new LGuiVec2(Rect.X + 15, Rect.CenterY), new LGuiVec2(Rect.X + 5, Rect.Bottom - 3), LGuiStyle.GetColor(LGuiStyleColorIndex.Text), true); } if (LGuiMisc.CheckAndSetFocusID(ID)) { Expand = !Expand; LGuiContextCache.SetGroupExpand(FullTitle, Expand); } if (Expand) { LGuiContext.BeginGroup(FullTitle, Rect.X + LGuiStyle.GetValue(LGuiStyleValueIndex.GroupChildSpacing)); } return(Expand); }
internal static void OnProcess(LGuiColor Color, string Text, LGuiRect Rect) { var ID = LGuiHash.CalculateID(Text); LGuiContext.SetPreviousControlID(ID); if (!LGuiMisc.CheckVisible(ref Rect)) { return; } LGuiMisc.CheckAndSetContextID(ref Rect, ID); LGuiGraphics.DrawText(Text, Rect.Pos, Color, LGuiContext.Font); }
internal static bool HandleRgbSlider(string Title, ref LGuiColor Color, LGuiVec2 Pos, float Length) { var A = (int)(Color.A * 255.0f); var R = (int)(Color.R * 255.0f); var G = (int)(Color.G * 255.0f); var B = (int)(Color.B * 255.0f); var TitleWidth = LGuiContext.Font.FontWidth * 2.5f; var SpacingY = LGuiStyle.GetValue(LGuiStyleValueIndex.ControlSpacingY); var SliderSize = LGuiStyle.GetValue(LGuiStyleValueIndex.SliderSize); var RgbValueChanged = false; LGuiGraphics.DrawText("R:", new LGuiVec2(Pos.X, Pos.Y), LGuiStyleColorIndex.Text); if (LGuiSlider.OnProcess($"{Title}_RedSlider", ref R, 0, 255, 1, true, "{0}", new LGuiRect(Pos.X + TitleWidth, Pos.Y, Length - TitleWidth, SliderSize))) { RgbValueChanged = true; } LGuiGraphics.DrawText("G:", new LGuiVec2(Pos.X, Pos.Y + SliderSize + SpacingY), LGuiStyleColorIndex.Text); if (LGuiSlider.OnProcess($"{Title}_GreenSlider", ref G, 0, 255, 1, true, "{0}", new LGuiRect(Pos.X + TitleWidth, Pos.Y + SliderSize + SpacingY, Length - TitleWidth, SliderSize))) { RgbValueChanged = true; } LGuiGraphics.DrawText("B:", new LGuiVec2(Pos.X, Pos.Y + (SliderSize + SpacingY) * 2.0f), LGuiStyleColorIndex.Text); if (LGuiSlider.OnProcess($"{Title}_BlueSlider", ref B, 0, 255, 1, true, "{0}", new LGuiRect(Pos.X + TitleWidth, Pos.Y + (SliderSize + SpacingY) * 2.0f, Length - TitleWidth, SliderSize))) { RgbValueChanged = true; } LGuiGraphics.DrawText("A:", new LGuiVec2(Pos.X, Pos.Y + (SliderSize + SpacingY) * 3.0f), LGuiStyleColorIndex.Text); if (LGuiSlider.OnProcess($"{Title}_AlphaSlider", ref A, 0, 255, 1, true, "{0}", new LGuiRect(Pos.X + TitleWidth, Pos.Y + (SliderSize + SpacingY) * 3.0f, Length - TitleWidth, SliderSize))) { RgbValueChanged = true; } if (RgbValueChanged) { Color = new LGuiColor(R, G, B, A); } return(RgbValueChanged); }
internal static bool OnProcess(string Title, LGuiRect Rect, LGuiButtonFlags Flags) { var ID = LGuiHash.CalculateID(Title); LGuiContext.SetPreviousControlID(ID); if (!LGuiMisc.CheckVisible(ref Rect)) { return(false); } LGuiMisc.CheckAndSetContextID(ref Rect, ID); if ((Flags & LGuiButtonFlags.Invisible) == LGuiButtonFlags.Invisible) { } else { var BgColorIndex = LGuiContext.ActiveID == ID ? LGuiStyleColorIndex.ButtonActived : LGuiContext.HoveredID == ID ? LGuiStyleColorIndex.ButtonHovered : LGuiStyleColorIndex.Button; LGuiGraphics.DrawRect(Rect, BgColorIndex, true); LGuiGraphics.DrawRect(Rect, LGuiStyleColorIndex.Border, false); LGuiGraphics.DrawText(Title, new LGuiVec2(Rect.X + 3, Rect.Y + 2), LGuiStyleColorIndex.Text); } if ((Flags & LGuiButtonFlags.Repeat) == LGuiButtonFlags.Repeat) { if (LGuiContext.ActiveID == ID) { return(true); } } else if (LGuiMisc.CheckAndSetFocusID(ID)) { return(true); } return(false); }
internal static bool OnProcess(string Title, ref int Value, int Min, int Max, int Step, bool IsHorizontal, string Format, LGuiRect Rect) { var ID = LGuiHash.CalculateID(Title); LGuiContext.SetPreviousControlID(ID); if (!LGuiMisc.CheckVisible(ref Rect)) { return(false); } var NewValue = LGuiMisc.Clamp(Min, Max, Value); Step = LGuiMisc.Min(Max - Min, Step); var GrabRect = CalculateGrabRect(ref Rect, new LGuiVec2((float)Step / (float)(Max - Min) * Rect.Width, (float)Step / (float)(Max - Min) * Rect.Height), LGuiStyle.GetGrabMinSize(), (float)(NewValue - Min) / (float)(Max - Min), IsHorizontal); LGuiMisc.CheckAndSetContextID(ref GrabRect, ID, true); var GrabColorIndex = LGuiContext.ActiveID == ID ? LGuiStyleColorIndex.SliderGrabActived : LGuiContext.HoveredID == ID ? LGuiStyleColorIndex.SliderGrabHovered : LGuiStyleColorIndex.SliderGrab; LGuiGraphics.DrawRect(Rect, LGuiStyleColorIndex.Frame, true); LGuiGraphics.DrawRect(Rect, LGuiStyleColorIndex.Border, false); LGuiGraphics.DrawRect(GrabRect, GrabColorIndex, true); if (!string.IsNullOrWhiteSpace(Format)) { var Text = string.Format(Format, NewValue); var TextSize = LGuiConvert.GetTextSize(Text, LGuiContext.Font); LGuiGraphics.DrawText(Text, new LGuiVec2(Rect.X + (Rect.Width - TextSize.X) / 2.0f, Rect.Y + (Rect.Height - TextSize.Y) / 2.0f), LGuiStyleColorIndex.Text); } LGuiMisc.CheckAndSetContextID(ref Rect, ID); if (LGuiContext.ActiveID == ID) { NewValue = CalculateCurrentValue(ref Rect, ref GrabRect, Min, Max, Step, IsHorizontal); } else if (!IsHorizontal) { NewValue = LGuiMisc.DoMouseWheelEvent(ID, Min, Max, NewValue); } if (LGuiMisc.CheckAndSetFocusID(ID)) { } var ValueChanged = false; if (NewValue != Value) { ValueChanged = true; Value = NewValue; } return(ValueChanged); }
internal static bool OnProcess(string Title, LGuiRect Rect, ref LGuiColor Color) { LGuiFrame.Begin(Title, Rect); var ID = LGuiHash.CalculateID(Title); LGuiContext.SetPreviousControlID(ID); if (!LGuiMisc.CheckVisible(ref Rect)) { return(false); } var Hsv = LGuiContextCache.GetColorPickerHsv(Title); var FrameSpacing = LGuiStyle.GetFrameChildSpacing(); var SpacingY = LGuiStyle.GetValue(LGuiStyleValueIndex.ControlSpacingY); var SliderSize = LGuiStyle.GetValue(LGuiStyleValueIndex.SliderSize); var ColorRect = new LGuiRect(Rect.Pos + FrameSpacing, new LGuiVec2(Rect.Width - FrameSpacing.X * 2.0f, Rect.Height - (SliderSize + SpacingY) * 4.0f - SpacingY * 3.0f - 20)); RenderColorRect(ColorRect, Hsv.R); RenderColorCross(ColorRect, Hsv.G, Hsv.B); var IDColor = LGuiHash.CalculateID($"{Title}_ColorSelector"); LGuiMisc.CheckAndSetContextID(ref ColorRect, IDColor); var HsvValueChanged = false; if (LGuiContext.ActiveID == IDColor) { var X = LGuiMisc.Lerp(0.0f, 1.0f, (LGuiContext.IO.MousePos.X - ColorRect.X) / ColorRect.Width); var Y = LGuiMisc.Lerp(0.0f, 1.0f, (ColorRect.Height - (LGuiContext.IO.MousePos.Y - ColorRect.Y)) / ColorRect.Height); if (X != Hsv.G || Y != Hsv.B) { HsvValueChanged = true; Hsv.G = X; Hsv.B = Y; } } var HueRect = new LGuiRect(Rect.X + FrameSpacing.X, ColorRect.Bottom + FrameSpacing.Y, ColorRect.Width, 20); RenderHueRect(HueRect); RenderHueArrow(HueRect, Hsv.R); var IDHue = LGuiHash.CalculateID($"{Title}_HueSelector"); LGuiMisc.CheckAndSetContextID(ref HueRect, IDHue); if (LGuiContext.ActiveID == IDHue) { var Hue = LGuiMisc.Lerp(0.0f, 1.0f, (LGuiContext.IO.MousePos.X - HueRect.X) / HueRect.Width); if (Hue != Hsv.R) { HsvValueChanged = true; Hsv.R = Hue; } } HsvValueChanged |= HandleHsvSlider(Title, ref Hsv, new LGuiVec2(HueRect.X, HueRect.Bottom + SpacingY), HueRect.Width / 2.0f); if (HsvValueChanged) { Color = LGuiColor.Hsv2Rgb(Hsv); LGuiContextCache.SetColorPickerHsv(Title, Hsv); } var RgbValueChanged = false; if (HandleRgbSlider(Title, ref Color, new LGuiVec2(HueRect.X + HueRect.Width / 2.0f + 2.5f, HueRect.Bottom + SpacingY), HueRect.Width / 2.0f)) { RgbValueChanged = true; LGuiContextCache.SetColorPickerHsv(Title, LGuiColor.Rgb2Hsv(Color)); } var CurrentTitleWidth = LGuiContext.Font.FontWidth * 8.5f; LGuiGraphics.DrawText("Current:", new LGuiVec2(HueRect.X, HueRect.Bottom + SpacingY + (SliderSize + SpacingY) * 3.0f), LGuiStyleColorIndex.Text); LGuiGraphics.DrawRect(new LGuiRect(HueRect.X + CurrentTitleWidth, HueRect.Bottom + SpacingY + (SliderSize + SpacingY) * 3.0f, HueRect.Width / 2.0f - CurrentTitleWidth, SliderSize), Color, true, false); LGuiFrame.End(); return(HsvValueChanged | RgbValueChanged); }
internal static bool OnProcess(string Title, ref int ItemIndex, string[] Items, LGuiRect Rect, float PopupHeight) { var ID = LGuiHash.CalculateID(Title); LGuiContext.SetPreviousControlID(ID); if (!LGuiMisc.CheckVisible(ref Rect)) { return(false); } var TitleBgColorIndex = LGuiContext.ActiveID == ID ? LGuiStyleColorIndex.FrameActived : LGuiContext.HoveredID == ID ? LGuiStyleColorIndex.FrameHovered : LGuiStyleColorIndex.Frame; LGuiMisc.CheckAndSetContextID(ref Rect, ID); LGuiGraphics.DrawRect(Rect, TitleBgColorIndex, true); LGuiGraphics.DrawText(Items[ItemIndex], Rect.Pos + new LGuiVec2(LGuiStyle.GetValue(LGuiStyleValueIndex.ControlSpacingX), 0), LGuiStyleColorIndex.Text); var GrabRect = new LGuiRect(Rect.Right - LGuiContext.Font.FontHeight, Rect.Y, LGuiContext.Font.FontHeight, LGuiContext.Font.FontHeight); var GrabBgColorIndex = LGuiContext.ActiveID == ID ? LGuiStyleColorIndex.ButtonActived : LGuiContext.HoveredID == ID ? LGuiStyleColorIndex.ButtonHovered : LGuiStyleColorIndex.Button; LGuiGraphics.DrawRect(GrabRect, GrabBgColorIndex, true); LGuiGraphics.DrawTriangle( new LGuiVec2(GrabRect.Left + 4, GrabRect.Top + 4), new LGuiVec2(GrabRect.Right - 4, GrabRect.Top + 4), new LGuiVec2(GrabRect.CenterX, GrabRect.Bottom - 4), LGuiStyle.GetColor(LGuiStyleColorIndex.Text), true); LGuiGraphics.DrawRect(Rect, LGuiStyleColorIndex.Border, false); var PopupID = $"{Title}_ItemPopup"; if (LGuiMisc.CheckAndSetFocusID(ID)) { LGuiPopup.Open(PopupID); } var NewIndex = ItemIndex; if (LGuiPopup.Begin(PopupID, new LGuiRect(Rect.X, Rect.Bottom + 1, Rect.Width, PopupHeight))) { var ItemWidth = Rect.Width - LGuiStyle.GetValue(LGuiStyleValueIndex.FrameChildSpacingX) * 2.0f - LGuiStyle.GetValue(LGuiStyleValueIndex.SliderSize); for (var Index = 0; Index < Items.Length; ++Index) { if (LGuiSelectable.OnProcess(Items[Index], ItemIndex == Index, ItemWidth)) { NewIndex = Index; LGuiPopup.Close(PopupID); } } LGuiPopup.End(); } if (ItemIndex != NewIndex) { ItemIndex = NewIndex; return(true); } return(false); }
internal static bool BeginWindow(string Title, LGuiRect InitRect, LGuiWindowFlags Flags) { if (CurrentWindow_ != 0) { return(false); } var ID = LGuiHash.Calculate(Title); if (!WindowList_.ContainsKey(ID)) { WindowList_.Add(ID, new LGuiWindowContext(Title, ID, WindowList_.Count, InitRect, (Flags & LGuiWindowFlags.NoMove) != LGuiWindowFlags.NoMove, (Flags & LGuiWindowFlags.NoFocus) != LGuiWindowFlags.NoFocus)); FocusOrder++; } var Rect = WindowList_[ID].Rect; if (!LGuiMisc.CheckVisible(ref Rect)) { return(false); } CurrentWindow_ = ID; if (FocusWindow_ == 0) { FocusWindow_ = CurrentWindow_; WindowList_[FocusWindow_].Order = FocusOrder; } LGuiGraphics.SetTargetCommandList(WindowList_[ID].DrawList); if ((Flags & LGuiWindowFlags.NoTitle) != LGuiWindowFlags.NoTitle) { var TitleRect = new LGuiRect(Rect.Pos, new LGuiVec2(Rect.Width, LGuiContext.Font.FontHeight)); var NoCollapse = ((Flags & LGuiWindowFlags.NoCollapse) == LGuiWindowFlags.NoCollapse); var Expand = LGuiContextCache.GetWindowExpand(Title); var TitleTextOffset = NoCollapse ? 5.0f : 20.0f; if (Expand) { LGuiGraphics.DrawRect(Rect, LGuiStyleColorIndex.Frame, true); } LGuiGraphics.DrawRect(TitleRect, LGuiStyleColorIndex.HeaderActive, true); LGuiGraphics.DrawText(Title, new LGuiVec2(TitleRect.X + TitleTextOffset, TitleRect.Y), LGuiStyleColorIndex.Text); if (!NoCollapse) { if (Expand) { LGuiGraphics.DrawTriangle( new LGuiVec2(TitleRect.X + 5, TitleRect.Top + 5), new LGuiVec2(TitleRect.X + 15, TitleRect.Top + 5), new LGuiVec2(TitleRect.X + 10, TitleRect.Bottom - 5), LGuiStyle.GetColor(LGuiStyleColorIndex.Text), true); } else { LGuiGraphics.DrawTriangle( new LGuiVec2(TitleRect.X + 5, TitleRect.Top + 5), new LGuiVec2(TitleRect.X + 15, TitleRect.CenterY), new LGuiVec2(TitleRect.X + 5, TitleRect.Bottom - 5), LGuiStyle.GetColor(LGuiStyleColorIndex.Text), true); } var ArrowRect = new LGuiRect(TitleRect.X, TitleRect.Y, 20.0f, 20.0f); LGuiMisc.CheckAndSetContextID(ref ArrowRect, ID); if (LGuiMisc.CheckAndSetFocusID(ID)) { Expand = !Expand; LGuiContextCache.SetWindowExpand(Title, Expand); } if (!Expand) { HandleMouseMsg(ref TitleRect); CurrentWindow_ = 0; LGuiGraphics.SetTargetCommandList(null); return(false); } } LGuiGraphics.DrawRect(TitleRect, LGuiStyleColorIndex.Border, false); var ContextRect = new LGuiRect(Rect.X, TitleRect.Bottom, Rect.Width, Rect.Height - TitleRect.Height); LGuiFrame.Begin(Title, ContextRect, false); } else { LGuiGraphics.DrawRect(Rect, LGuiStyleColorIndex.Frame, true); LGuiFrame.Begin(Title, Rect, false); } return(true); }