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:
@@ -555,7 +555,7 @@ void AgentChatWidget::RenderHistory() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
ImGui::PopStyleColor();
|
AgentUI::PopPanelStyle();
|
||||||
last_history_size_ = history.size();
|
last_history_size_ = history.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1342,7 +1342,7 @@ void AgentChatWidget::RenderCollaborationPanel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
ImGui::PopStyleColor();
|
AgentUI::PopPanelStyle();
|
||||||
ImGui::PopStyleVar(2);
|
ImGui::PopStyleVar(2);
|
||||||
ImGui::PopID(); // CollabPanel
|
ImGui::PopID(); // CollabPanel
|
||||||
}
|
}
|
||||||
@@ -1451,7 +1451,7 @@ void AgentChatWidget::RenderMultimodalPanel() {
|
|||||||
ImGui::EndDisabled();
|
ImGui::EndDisabled();
|
||||||
|
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
ImGui::PopStyleColor();
|
AgentUI::PopPanelStyle();
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1667,7 +1667,7 @@ void AgentChatWidget::RenderAgentConfigPanel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
ImGui::PopStyleColor();
|
AgentUI::PopPanelStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AgentChatWidget::RenderZ3EDCommandPanel() {
|
void AgentChatWidget::RenderZ3EDCommandPanel() {
|
||||||
@@ -1750,7 +1750,7 @@ void AgentChatWidget::RenderZ3EDCommandPanel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
ImGui::PopStyleColor();
|
AgentUI::PopPanelStyle();
|
||||||
|
|
||||||
ImGui::PopID(); // FIX: Pop the Z3EDCmdPanel ID
|
ImGui::PopID(); // FIX: Pop the Z3EDCmdPanel ID
|
||||||
}
|
}
|
||||||
@@ -1849,7 +1849,7 @@ void AgentChatWidget::RenderRomSyncPanel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
ImGui::PopStyleColor();
|
AgentUI::PopPanelStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AgentChatWidget::RenderSnapshotPreviewPanel() {
|
void AgentChatWidget::RenderSnapshotPreviewPanel() {
|
||||||
@@ -1899,7 +1899,7 @@ void AgentChatWidget::RenderSnapshotPreviewPanel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
ImGui::PopStyleColor();
|
AgentUI::PopPanelStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AgentChatWidget::RenderProposalManagerPanel() {
|
void AgentChatWidget::RenderProposalManagerPanel() {
|
||||||
@@ -2095,7 +2095,7 @@ void AgentChatWidget::RenderHarnessPanel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
ImGui::PopStyleColor();
|
AgentUI::PopPanelStyle();
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -147,6 +147,26 @@ void RenderProviderBadge(const char* provider) {
|
|||||||
ImGui::PopStyleColor();
|
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) {
|
void VerticalSpacing(float amount) {
|
||||||
ImGui::Dummy(ImVec2(0, amount));
|
ImGui::Dummy(ImVec2(0, amount));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,6 +81,10 @@ void RenderSectionHeader(const char* icon, const char* label, const ImVec4& colo
|
|||||||
void RenderStatusIndicator(const char* label, bool active);
|
void RenderStatusIndicator(const char* label, bool active);
|
||||||
void RenderProviderBadge(const char* provider);
|
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
|
// Spacing helpers
|
||||||
void VerticalSpacing(float amount = 8.0f);
|
void VerticalSpacing(float amount = 8.0f);
|
||||||
void HorizontalSpacing(float amount = 8.0f);
|
void HorizontalSpacing(float amount = 8.0f);
|
||||||
|
|||||||
Reference in New Issue
Block a user