Description:
Change active text color.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r638:4405bf033cbf -

@@ -65,12 +65,31
65 65
66 66 public static class NewsWindow
67 67 {
68 public static bool wire_open = true;
69 public static bool true_open = false;
70 public static bool naturalist_open = false;
71 public static bool had_focus = false;
68 72
69 public static bool had_focus = false;
73 private static bool MenuItem(string label, bool active) {
74 if (active)
75 {
76 ImGui.PushStyleColor(ImGuiCol.Text, StyleSets.white);
77 }
78
79 var result = ImGui.BeginTabItem(label);
80
81 if (active)
82 {
83 ImGui.PopStyleColor(1);
84 }
85
86 return result;
87 }
70 88
71 89 public static void Render(ImFontPtr font, Simulation sim, ImGuiWindowBridgeEngine engine)
72 90 {
73 91 bool newShow = true;
92
74 93 if (newShow)
75 94 {
76 95 ImGui.PushFont(font);
@@ -98,10 +117,11
98 117
99 118 if (ImGui.BeginTabBar("Sources", 0))
100 119 {
101
102
103 if (ImGui.BeginTabItem("Wire"))
120 if (MenuItem("Wire", wire_open))
104 121 {
122 wire_open = true;
123 naturalist_open = false;
124 true_open = false;
105 125
106 126 foreach (NewsItem story in content.Where(s => (s.source == "Wire")).Take(3))
107 127 {
@@ -113,8 +133,12
113 133 }
114 134 ImGui.EndTabItem();
115 135 }
116 if (ImGui.BeginTabItem("The Naturalist"))
136 if (MenuItem("The Naturalist", naturalist_open))
117 137 {
138 wire_open = false;
139 naturalist_open = true;
140 true_open = false;
141
118 142 foreach (NewsItem story in content.Where(s => (s.source == "Arborist")).Take(3))
119 143 {
120 144 if (ImGui.TreeNode(story.hed))
@@ -125,8 +149,12
125 149 }
126 150 ImGui.EndTabItem();
127 151 }
128 if (ImGui.BeginTabItem("All True News"))
152 if (MenuItem("All True News", true_open))
129 153 {
154 wire_open = false;
155 naturalist_open = false;
156 true_open = true;
157
130 158 foreach (NewsItem story in content.Where(s => (s.source == "True")).Take(3))
131 159 {
132 160 if (ImGui.TreeNode(story.hed))
You need to be logged in to leave comments. Login now