refactor: Replace PopStyleColor with PopPanelStyle in AgentChatWidget

- Updated multiple rendering functions in AgentChatWidget to replace ImGui::PopStyleColor() with AgentUI::PopPanelStyle(), enhancing consistency in style management.
- Introduced a new StatusBadge function in agent_ui_theme.cc for improved badge rendering with customizable colors, promoting better UI theming.
- Added ButtonColor enum in agent_ui_theme.h to support various badge states, improving code clarity and maintainability.
This commit is contained in:
scawful
2025-10-05 15:43:39 -04:00
parent 8d6453df5e
commit c8d7eb3597
3 changed files with 32 additions and 8 deletions

View File

@@ -555,7 +555,7 @@ void AgentChatWidget::RenderHistory() {
}
}
ImGui::EndChild();
ImGui::PopStyleColor();
AgentUI::PopPanelStyle();
last_history_size_ = history.size();
}
@@ -1342,7 +1342,7 @@ void AgentChatWidget::RenderCollaborationPanel() {
}
ImGui::EndChild();
ImGui::PopStyleColor();
AgentUI::PopPanelStyle();
ImGui::PopStyleVar(2);
ImGui::PopID(); // CollabPanel
}
@@ -1451,7 +1451,7 @@ void AgentChatWidget::RenderMultimodalPanel() {
ImGui::EndDisabled();
ImGui::EndChild();
ImGui::PopStyleColor();
AgentUI::PopPanelStyle();
ImGui::PopID();
}
@@ -1667,7 +1667,7 @@ void AgentChatWidget::RenderAgentConfigPanel() {
}
ImGui::EndChild();
ImGui::PopStyleColor();
AgentUI::PopPanelStyle();
}
void AgentChatWidget::RenderZ3EDCommandPanel() {
@@ -1750,7 +1750,7 @@ void AgentChatWidget::RenderZ3EDCommandPanel() {
}
ImGui::EndChild();
ImGui::PopStyleColor();
AgentUI::PopPanelStyle();
ImGui::PopID(); // FIX: Pop the Z3EDCmdPanel ID
}
@@ -1849,7 +1849,7 @@ void AgentChatWidget::RenderRomSyncPanel() {
}
ImGui::EndChild();
ImGui::PopStyleColor();
AgentUI::PopPanelStyle();
}
void AgentChatWidget::RenderSnapshotPreviewPanel() {
@@ -1899,7 +1899,7 @@ void AgentChatWidget::RenderSnapshotPreviewPanel() {
}
ImGui::EndChild();
ImGui::PopStyleColor();
AgentUI::PopPanelStyle();
}
void AgentChatWidget::RenderProposalManagerPanel() {
@@ -2095,7 +2095,7 @@ void AgentChatWidget::RenderHarnessPanel() {
}
ImGui::EndChild();
ImGui::PopStyleColor();
AgentUI::PopPanelStyle();
ImGui::PopID();
}

View File

@@ -147,6 +147,26 @@ void RenderProviderBadge(const char* provider) {
ImGui::PopStyleColor();
}
void StatusBadge(const char* text, ButtonColor color) {
const auto& theme = GetTheme();
ImVec4 badge_color;
switch (color) {
case ButtonColor::Success: badge_color = theme.status_success; break;
case ButtonColor::Warning: badge_color = theme.status_warning; break;
case ButtonColor::Error: badge_color = theme.status_error; break;
case ButtonColor::Info: badge_color = theme.accent_color; break;
default: badge_color = theme.status_inactive; break;
}
ImGui::PushStyleColor(ImGuiCol_Button, badge_color);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 10.0f);
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(6, 2));
ImGui::SmallButton(text);
ImGui::PopStyleVar(2);
ImGui::PopStyleColor();
}
void VerticalSpacing(float amount) {
ImGui::Dummy(ImVec2(0, amount));
}

View File

@@ -81,6 +81,10 @@ void RenderSectionHeader(const char* icon, const char* label, const ImVec4& colo
void RenderStatusIndicator(const char* label, bool active);
void RenderProviderBadge(const char* provider);
// Status badge for tests/processes
enum class ButtonColor { Success, Warning, Error, Info, Default };
void StatusBadge(const char* text, ButtonColor color);
// Spacing helpers
void VerticalSpacing(float amount = 8.0f);
void HorizontalSpacing(float amount = 8.0f);