private void DrawSearchBar() { ImGui.PushFont(Fonts.Regular32); // Update input buffer based on the query context if (_queryBox.Text != _queryContext.Text) { _queryBox.Text = _queryContext.Text; } _queryBox.Draw(); if (_queryContext.Focus) { _queryBox.Focus(); _queryContext.Focus = false; } // Update the query context if the input buffer was changed if (_queryBox.IsChanged) { _queryContext.Text = _queryBox.Text; QueryExecutorManager.TryHandle(_queryContext); } _queryBox.ResetChanged(); ImGui.PopFont(); }
public override void Draw() { if (Input.IsKeyPressed(Keys.Escape)) { Minimize(); } if (_bg != null) { _uic.SpriteBatch.Draw(_bg, new Microsoft.Xna.Framework.Rectangle(0, 0, Width, Height), Microsoft.Xna.Framework.Color.White); } ImGui.PushStyleVar(ImGuiStyleVar.WindowBorderSize, 0); ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 0); ImGui.SetNextWindowPos(Vector2.Zero, ImGuiCond.Always); ImGui.SetNextWindowSize(new Vector2(_uic.Window.ClientBounds.Width, _uic.Window.ClientBounds.Height), ImGuiCond.Always); ImGui.Begin(string.Empty, ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoTitleBar); { // Search bar ImGui.PushFont(Fonts.Regular24); DrawSearchBar(); ImGui.Spacing(); // Query executor ImGui.BeginChild("query-executor", new Vector2(ImGui.GetWindowContentRegionWidth(), ImGui.GetContentRegionAvail().Y - 20), false, ImGuiWindowFlags.None); { QueryExecutorManager.Draw(); } ImGui.EndChild(); // Footer Footers?.OrderBy(f => f.Priority).FirstOrDefault()?.Draw(); ImGui.PopFont(); } ImGui.End(); }
public override async Task Update() { // Execute when ENTER was pressed if (Input.IsKeyPressed(Keys.Enter)) { _log.Info($"ENTER"); if (await QueryExecutorManager.TryExecuteAsync(_queryContext)) { if (_queryContext.HideUI) { Minimize(); } if (_queryContext.ResetText) { _queryContext.Reset(); } } _queryBox.Focus(); } }