5#include "absl/strings/str_format.h"
15#include "imgui/imgui.h"
122 const std::string& value) {
139 const std::string& model,
bool active) {
158 const ImGuiViewport* viewport = ImGui::GetMainViewport();
165 viewport->WorkPos.y + viewport->WorkSize.y - bar_height - bottom_safe;
167 const ImVec2 panel_padding = touch_mode ? ImVec2(14.0f, 7.0f)
168 : ImVec2(8.0f, 4.0f);
169 const ImVec2 panel_spacing = touch_mode ? ImVec2(12.0f, 0.0f)
170 : ImVec2(8.0f, 0.0f);
176 ImGuiWindowFlags extra_flags =
177 ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse |
178 ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNavFocus |
179 ImGuiWindowFlags_NoBringToFrontOnFocus;
183 ImVec2(viewport->WorkPos.x, bar_y),
184 ImVec2(viewport->WorkSize.x, bar_height),
186 .border = bar_border,
187 .padding = panel_padding,
188 .spacing = panel_spacing,
189 .border_size = 1.0f},
216 float right_section_width = 0.0f;
217 std::string agent_label;
220 if (agent_label.empty()) {
221 agent_label =
"Agent";
223 const size_t max_len = 20;
224 if (agent_label.size() > max_len) {
225 agent_label = agent_label.substr(0, max_len - 3) +
"...";
228 right_section_width +=
229 ImGui::CalcTextSize(label.c_str()).x +
230 ImGui::GetStyle().FramePadding.x * 2.0f + 10.0f;
233 right_section_width += ImGui::CalcTextSize(
"100%").x + 20.0f;
236 right_section_width += ImGui::CalcTextSize(
editor_mode_.c_str()).x + 30.0f;
239 if (right_section_width > 0.0f) {
240 float available = ImGui::GetContentRegionAvail().x;
241 if (available > right_section_width + 20.0f) {
242 ImGui::SameLine(ImGui::GetWindowWidth() - right_section_width - 16.0f);
271 const size_t max_len = 20;
272 if (label.size() > max_len) {
273 label = label.substr(0, max_len - 3) +
"...";
280 {ImGuiCol_Text, text_color},
290 if (ImGui::IsItemHovered()) {
291 ImGui::BeginTooltip();
293 ImGui::TextDisabled(
"Provider: %s",
296 ImGui::TextDisabled(
"Model: %s",
299 ImGui::TextDisabled(
"Toggle chat panel");
319 if (ImGui::IsItemHovered()) {
320 ImGui::SetTooltip(
"Unsaved changes");
334 if (ImGui::IsItemHovered()) {
357 int zoom_percent =
static_cast<int>(
zoom_level_ * 100.0f);
361 if (ImGui::IsItemHovered()) {
362 ImGui::SetTooltip(
"Zoom: %d%%", zoom_percent);
374 "%s: %s", key.c_str(), value.c_str());
HandlerId Subscribe(std::function< void(const T &)> handler)
Instance-based runtime context replacing ContentRegistry::Context.
static constexpr float kStatusBarHeight
void DrawCustomSegments()
void DrawSelectionSegment()
void HandleStatusUpdate(const StatusUpdateEvent &event)
GlobalEditorContext * context_
float GetHeight() const
Get the height of the status bar.
void SetSessionInfo(size_t session_id, size_t total_sessions)
Set session information.
static constexpr float kStatusBarTouchHeight
std::string agent_provider_
void ClearCursorPosition()
Clear cursor position (no cursor in editor)
std::function< void()> agent_toggle_callback_
void SetSelection(int count, int width=0, int height=0)
Set selection information.
void ClearZoom()
Clear zoom display.
void SetCustomSegment(const std::string &key, const std::string &value)
Set a custom segment with key-value pair.
void SetZoom(float level)
Set current zoom level.
std::string cursor_label_
std::unordered_map< std::string, std::string > custom_segments_
void ClearSelection()
Clear selection info.
void ClearEditorMode()
Clear editor mode display.
void Initialize(GlobalEditorContext *context)
void SetCursorPosition(int x, int y, const char *label="Pos")
Set cursor/mouse position in editor coordinates.
void SetEditorMode(const std::string &mode)
Set the current editor mode or tool.
void Draw()
Draw the status bar.
void ClearAllContext()
Clear all context (cursor, selection, zoom, mode, custom)
void ClearCustomSegment(const std::string &key)
Remove a custom segment.
void DrawSessionSegment()
void SetAgentInfo(const std::string &provider, const std::string &model, bool active)
RAII for fixed-position panels (activity bar, side panel, status bar).
static SafeAreaInsets GetSafeAreaInsets()
static bool IsTouchDevice()
RAII guard for ImGui style colors.
const Theme & GetCurrentTheme() const
static ThemeManager & Get()
#define ICON_MD_DESCRIPTION
#define ICON_MD_SELECT_ALL
#define ICON_MD_FIBER_MANUAL_RECORD
#define ICON_MD_SMART_TOY
ImVec4 ConvertColorToImVec4(const Color &color)
void ColoredText(const char *text, const ImVec4 &color)
ImVec4 GetSurfaceContainerHighestVec4()
bool ThemedButton(const char *label, const ImVec2 &size, const char *panel_id, const char *anim_id)
Draw a standard text button with theme colors.
ImVec4 GetTextSecondaryVec4()
void ColoredTextF(const ImVec4 &color, const char *fmt,...)
ImVec4 GetSurfaceContainerHighVec4()
ImVec4 GetSurfaceContainerVec4()
Published when selection changes in any editor.
Published when zoom level changes in any canvas/editor.