public static bool BeginWindow(string Title, LGuiRect Rect, LGuiWindowFlags Flags = LGuiWindowFlags.None) { return(LGuiWindow.BeginWindow(Title, Rect, Flags)); }
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); }
public static bool BeginWindow(string Title, LGuiVec2 Size, LGuiWindowFlags Flags = LGuiWindowFlags.None) { return(LGuiWindow.BeginWindow(Title, Size, Flags)); }
internal static bool BeginWindow(string Title, LGuiVec2 Size, LGuiWindowFlags Flags) { return(BeginWindow(Title, new LGuiRect(LGuiLayout.GetCurrentLayoutContext().CursorPos, Size), Flags)); }