yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
status_bar.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_MENU_STATUS_BAR_H_
2#define YAZE_APP_EDITOR_MENU_STATUS_BAR_H_
3
4#include <functional>
5#include <string>
6#include <unordered_map>
7#include <vector>
8
12
13namespace yaze {
14
15class Rom;
16
17namespace editor {
18
28 std::function<void()> on_click;
29 std::string tooltip;
30};
31
54class StatusBar {
55 public:
56 StatusBar() = default;
57 ~StatusBar() = default;
58
59 void Initialize(GlobalEditorContext* context);
60
61 // ============================================================================
62 // Configuration
63 // ============================================================================
64
68 void SetEnabled(bool enabled) { enabled_ = enabled; }
69 bool IsEnabled() const { return enabled_; }
70
74 void SetRom(Rom* rom) { rom_ = rom; }
75
81 void SetSessionInfo(size_t session_id, size_t total_sessions);
82
83 // ============================================================================
84 // Context Setters (called by active editor)
85 // ============================================================================
86
93 void SetCursorPosition(int x, int y, const char* label = "Pos");
94 void SetCursorPosition(int x, int y, const char* label,
96
100 void ClearCursorPosition();
101
108 void SetSelection(int count, int width = 0, int height = 0);
109
113 void ClearSelection();
114
119 void SetZoom(float level);
120 void SetZoom(float level, StatusBarSegmentOptions options);
121
125 void ClearZoom();
126
131 void SetEditorMode(const std::string& mode);
132 void SetEditorMode(const std::string& mode, StatusBarSegmentOptions options);
133
137 void ClearEditorMode();
138
144 void SetCustomSegment(const std::string& key, const std::string& value);
145 void SetCustomSegment(const std::string& key, const std::string& value,
147
151 void ClearCustomSegment(const std::string& key);
152
156 void ClearAllContext();
157
166
167 // ============================================================================
168 // Agent Status
169 // ============================================================================
170
171 void SetAgentInfo(const std::string& provider, const std::string& model,
172 bool active);
173 void ClearAgentInfo();
175 build_status_ = status;
176 }
177 void SetRunStatus(const ProjectWorkflowStatus& status) { run_status_ = status; }
182 void SetAgentToggleCallback(std::function<void()> callback) {
183 agent_toggle_callback_ = std::move(callback);
184 }
185
186 // ============================================================================
187 // Rendering
188 // ============================================================================
189
196 void Draw();
197
202 float GetHeight() const;
203
204 static constexpr float kStatusBarHeight = 24.0f;
205 static constexpr float kStatusBarTouchHeight = 44.0f;
206
207 private:
208 void HandleStatusUpdate(const StatusUpdateEvent& event);
209
210 void DrawRomSegment();
211 void DrawSessionSegment();
212 void DrawCursorSegment();
214 void DrawZoomSegment();
215 void DrawModeSegment();
216 void DrawAgentSegment();
218 const char* default_icon);
219 void DrawCustomSegments();
220 void DrawSeparator();
221
223 bool enabled_ = false;
224 Rom* rom_ = nullptr;
225
226 // Session info
227 size_t session_id_ = 0;
228 size_t total_sessions_ = 1;
229
230 // Cursor position
231 bool has_cursor_ = false;
232 int cursor_x_ = 0;
233 int cursor_y_ = 0;
234 std::string cursor_label_ = "Pos";
236
237 // Selection
238 bool has_selection_ = false;
242
243 // Zoom
244 bool has_zoom_ = false;
245 float zoom_level_ = 1.0f;
247
248 // Editor mode
249 bool has_mode_ = false;
250 std::string editor_mode_;
252
253 // Custom segments — vector preserves insertion order for stable rendering.
255 std::string key;
256 std::string value;
258 };
259 std::vector<CustomSegment> custom_segments_;
260
261 // Agent status
262 bool has_agent_ = false;
263 bool agent_active_ = false;
264 std::string agent_provider_;
265 std::string agent_model_;
266 std::function<void()> agent_toggle_callback_;
267
270};
271
272} // namespace editor
273} // namespace yaze
274
275#endif // YAZE_APP_EDITOR_MENU_STATUS_BAR_H_
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:28
Instance-based runtime context replacing ContentRegistry::Context.
A session-aware status bar displayed at the bottom of the application.
Definition status_bar.h:54
static constexpr float kStatusBarHeight
Definition status_bar.h:204
void HandleStatusUpdate(const StatusUpdateEvent &event)
bool IsEnabled() const
Definition status_bar.h:69
GlobalEditorContext * context_
Definition status_bar.h:222
float GetHeight() const
Get the height of the status bar.
Definition status_bar.cc:80
std::vector< CustomSegment > custom_segments_
Definition status_bar.h:259
void SetSessionInfo(size_t session_id, size_t total_sessions)
Set session information.
void SetBuildStatus(const ProjectWorkflowStatus &status)
Definition status_bar.h:174
StatusBarSegmentOptions cursor_options_
Definition status_bar.h:235
static constexpr float kStatusBarTouchHeight
Definition status_bar.h:205
std::string agent_provider_
Definition status_bar.h:264
void ClearCursorPosition()
Clear cursor position (no cursor in editor)
std::function< void()> agent_toggle_callback_
Definition status_bar.h:266
void SetSelection(int count, int width=0, int height=0)
Set selection information.
StatusBarSegmentOptions zoom_options_
Definition status_bar.h:246
void ClearZoom()
Clear zoom display.
void SetRunStatus(const ProjectWorkflowStatus &status)
Definition status_bar.h:177
void SetRom(Rom *rom)
Set the current ROM for dirty status and filename display.
Definition status_bar.h:74
StatusBarSegmentOptions mode_options_
Definition status_bar.h:251
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.
void DrawProjectWorkflowSegment(const ProjectWorkflowStatus &status, const char *default_icon)
void SetEnabled(bool enabled)
Enable or disable the status bar.
Definition status_bar.h:68
std::string cursor_label_
Definition status_bar.h:234
void ClearSelection()
Clear selection info.
void ClearEditorMode()
Clear editor mode display.
void Initialize(GlobalEditorContext *context)
Definition status_bar.cc:90
void ClearEditorContributions()
Clear frame-scoped editor contributions.
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.
ProjectWorkflowStatus build_status_
Definition status_bar.h:268
void Draw()
Draw the status bar.
void SetAgentToggleCallback(std::function< void()> callback)
Definition status_bar.h:182
void ClearAllContext()
Clear all context (cursor, selection, zoom, mode, custom)
void ClearCustomSegment(const std::string &key)
Remove a custom segment.
ProjectWorkflowStatus run_status_
Definition status_bar.h:269
void SetAgentInfo(const std::string &provider, const std::string &model, bool active)
Optional behavior for an interactive status bar segment.
Definition status_bar.h:27
std::function< void()> on_click
Definition status_bar.h:28
StatusBarSegmentOptions options
Definition status_bar.h:257