shoko/MainUI.cs

50 lines
998 B
C#
Raw Normal View History

2023-10-02 18:49:24 +00:00
using System.Reflection;
using ImGuiNET;
namespace Shoko;
static class MainUI
{
static string txtURL = "";
public static List<Tab> tabs = new List<Tab>();
public static void NewTab(string url)
{
tabs.Add(new Tab(url));
}
public static bool Render()
{
bool quit = true;
ImGui.DockSpaceOverViewport();
Gui.MainMenuBar(()=>
{
Gui.Menu("File", ()=>
{
Gui.MenuItem("Quit", null, ()=> quit = false);
});
Gui.Menu("Help", ()=>
{
Gui.MenuItem("About", null, ()=> NewTab("about:"));
});
ImGui.InputText("##url", ref txtURL, 1024);
Gui.Button("Go", ()=>{
NewTab(txtURL);
txtURL = "";
});
});
tabs = tabs.Where(x=>x.IsOpen).ToList();
foreach (var tab in tabs)
{
tab.Render();
}
return quit;
}
}