# HG changeset patch # User Alys Brooks # Date 2022-10-02 02:32:15 # Node ID 4405bf033cbfe081e45d81e2f37c3d0519178635 # Parent bcf1cb2809c64203e5a4fd77a05de3e6e2c802df Change active text color. diff --git a/isometric-park-fna/UI/NewsWindow.cs b/isometric-park-fna/UI/NewsWindow.cs --- a/isometric-park-fna/UI/NewsWindow.cs +++ b/isometric-park-fna/UI/NewsWindow.cs @@ -65,12 +65,31 @@ public static class NewsWindow { + public static bool wire_open = true; + public static bool true_open = false; + public static bool naturalist_open = false; + public static bool had_focus = false; - public static bool had_focus = false; + private static bool MenuItem(string label, bool active) { + if (active) + { + ImGui.PushStyleColor(ImGuiCol.Text, StyleSets.white); + } + + var result = ImGui.BeginTabItem(label); + + if (active) + { + ImGui.PopStyleColor(1); + } + + return result; + } public static void Render(ImFontPtr font, Simulation sim, ImGuiWindowBridgeEngine engine) { bool newShow = true; + if (newShow) { ImGui.PushFont(font); @@ -98,10 +117,11 @@ if (ImGui.BeginTabBar("Sources", 0)) { - - - if (ImGui.BeginTabItem("Wire")) + if (MenuItem("Wire", wire_open)) { + wire_open = true; + naturalist_open = false; + true_open = false; foreach (NewsItem story in content.Where(s => (s.source == "Wire")).Take(3)) { @@ -113,8 +133,12 @@ } ImGui.EndTabItem(); } - if (ImGui.BeginTabItem("The Naturalist")) + if (MenuItem("The Naturalist", naturalist_open)) { + wire_open = false; + naturalist_open = true; + true_open = false; + foreach (NewsItem story in content.Where(s => (s.source == "Arborist")).Take(3)) { if (ImGui.TreeNode(story.hed)) @@ -125,8 +149,12 @@ } ImGui.EndTabItem(); } - if (ImGui.BeginTabItem("All True News")) + if (MenuItem("All True News", true_open)) { + wire_open = false; + naturalist_open = false; + true_open = true; + foreach (NewsItem story in content.Where(s => (s.source == "True")).Take(3)) { if (ImGui.TreeNode(story.hed))