yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::StatusBar Class Reference

A session-aware status bar displayed at the bottom of the application. More...

#include <status_bar.h>

Collaboration diagram for yaze::editor::StatusBar:

Public Member Functions

 StatusBar ()=default
 
 ~StatusBar ()=default
 
void Initialize (GlobalEditorContext *context)
 
void SetEnabled (bool enabled)
 Enable or disable the status bar.
 
bool IsEnabled () const
 
void SetRom (Rom *rom)
 Set the current ROM for dirty status and filename display.
 
void SetSessionInfo (size_t session_id, size_t total_sessions)
 Set session information.
 
void SetCursorPosition (int x, int y, const char *label="Pos")
 Set cursor/mouse position in editor coordinates.
 
void ClearCursorPosition ()
 Clear cursor position (no cursor in editor)
 
void SetSelection (int count, int width=0, int height=0)
 Set selection information.
 
void ClearSelection ()
 Clear selection info.
 
void SetZoom (float level)
 Set current zoom level.
 
void ClearZoom ()
 Clear zoom display.
 
void SetEditorMode (const std::string &mode)
 Set the current editor mode or tool.
 
void ClearEditorMode ()
 Clear editor mode display.
 
void SetCustomSegment (const std::string &key, const std::string &value)
 Set a custom segment with key-value pair.
 
void ClearCustomSegment (const std::string &key)
 Remove a custom segment.
 
void ClearAllContext ()
 Clear all context (cursor, selection, zoom, mode, custom)
 
void SetAgentInfo (const std::string &provider, const std::string &model, bool active)
 
void ClearAgentInfo ()
 
void SetAgentToggleCallback (std::function< void()> callback)
 
void Draw ()
 Draw the status bar.
 
float GetHeight () const
 Get the height of the status bar.
 

Static Public Attributes

static constexpr float kStatusBarHeight = 24.0f
 
static constexpr float kStatusBarTouchHeight = 44.0f
 

Private Member Functions

void HandleStatusUpdate (const StatusUpdateEvent &event)
 
void DrawRomSegment ()
 
void DrawSessionSegment ()
 
void DrawCursorSegment ()
 
void DrawSelectionSegment ()
 
void DrawZoomSegment ()
 
void DrawModeSegment ()
 
void DrawAgentSegment ()
 
void DrawCustomSegments ()
 
void DrawSeparator ()
 

Private Attributes

GlobalEditorContextcontext_ = nullptr
 
bool enabled_ = false
 
Romrom_ = nullptr
 
size_t session_id_ = 0
 
size_t total_sessions_ = 1
 
bool has_cursor_ = false
 
int cursor_x_ = 0
 
int cursor_y_ = 0
 
std::string cursor_label_ = "Pos"
 
bool has_selection_ = false
 
int selection_count_ = 0
 
int selection_width_ = 0
 
int selection_height_ = 0
 
bool has_zoom_ = false
 
float zoom_level_ = 1.0f
 
bool has_mode_ = false
 
std::string editor_mode_
 
std::unordered_map< std::string, std::string > custom_segments_
 
bool has_agent_ = false
 
bool agent_active_ = false
 
std::string agent_provider_
 
std::string agent_model_
 
std::function< void()> agent_toggle_callback_
 

Detailed Description

A session-aware status bar displayed at the bottom of the application.

The StatusBar sits outside the ImGui dockspace (like the sidebars) and displays:

  • ROM filename and dirty status indicator
  • Session number (when multiple ROMs open)
  • Cursor position (context-aware based on active editor)
  • Selection info (count, dimensions)
  • Zoom level
  • Current editor mode/tool

Each editor can update its relevant segments by calling the Set* methods or publishing StatusUpdateEvents to the event bus.

Usage:

status_bar_.Initialize(&editor_context);
// ...
editor_context.GetEventBus().Publish(StatusUpdateEvent::Cursor(x, y));

Definition at line 39 of file status_bar.h.

Constructor & Destructor Documentation

◆ StatusBar()

yaze::editor::StatusBar::StatusBar ( )
default

◆ ~StatusBar()

yaze::editor::StatusBar::~StatusBar ( )
default

Member Function Documentation

◆ Initialize()

◆ SetEnabled()

void yaze::editor::StatusBar::SetEnabled ( bool enabled)
inline

◆ IsEnabled()

bool yaze::editor::StatusBar::IsEnabled ( ) const
inline

Definition at line 54 of file status_bar.h.

References enabled_.

◆ SetRom()

void yaze::editor::StatusBar::SetRom ( Rom * rom)
inline

Set the current ROM for dirty status and filename display.

Definition at line 59 of file status_bar.h.

References rom_.

Referenced by yaze::editor::EditorManager::DrawInterface().

◆ SetSessionInfo()

void yaze::editor::StatusBar::SetSessionInfo ( size_t session_id,
size_t total_sessions )

Set session information.

Parameters
session_idCurrent session index (0-based)
total_sessionsTotal number of open sessions

Definition at line 75 of file status_bar.cc.

References session_id_, and total_sessions_.

Referenced by yaze::editor::EditorManager::DrawInterface().

◆ SetCursorPosition()

void yaze::editor::StatusBar::SetCursorPosition ( int x,
int y,
const char * label = "Pos" )

Set cursor/mouse position in editor coordinates.

Parameters
xX coordinate (tile, pixel, or editor-specific)
yY coordinate (tile, pixel, or editor-specific)
labelOptional label (e.g., "Tile", "Pos", "Map")

Definition at line 80 of file status_bar.cc.

References cursor_label_, cursor_x_, cursor_y_, and has_cursor_.

Referenced by HandleStatusUpdate().

◆ ClearCursorPosition()

void yaze::editor::StatusBar::ClearCursorPosition ( )

Clear cursor position (no cursor in editor)

Definition at line 87 of file status_bar.cc.

References has_cursor_.

Referenced by ClearAllContext().

◆ SetSelection()

void yaze::editor::StatusBar::SetSelection ( int count,
int width = 0,
int height = 0 )

Set selection information.

Parameters
countNumber of selected items
widthWidth of selection (optional, 0 to hide)
heightHeight of selection (optional, 0 to hide)

Definition at line 91 of file status_bar.cc.

References has_selection_, selection_count_, selection_height_, and selection_width_.

Referenced by HandleStatusUpdate(), and Initialize().

◆ ClearSelection()

void yaze::editor::StatusBar::ClearSelection ( )

Clear selection info.

Definition at line 98 of file status_bar.cc.

References has_selection_.

Referenced by ClearAllContext(), and Initialize().

◆ SetZoom()

void yaze::editor::StatusBar::SetZoom ( float level)

Set current zoom level.

Parameters
levelZoom multiplier (e.g., 1.0, 2.0, 0.5)

Definition at line 102 of file status_bar.cc.

References has_zoom_, and zoom_level_.

Referenced by HandleStatusUpdate(), and Initialize().

◆ ClearZoom()

void yaze::editor::StatusBar::ClearZoom ( )

Clear zoom display.

Definition at line 107 of file status_bar.cc.

References has_zoom_.

Referenced by ClearAllContext().

◆ SetEditorMode()

void yaze::editor::StatusBar::SetEditorMode ( const std::string & mode)

Set the current editor mode or tool.

Parameters
modeMode string (e.g., "Draw", "Select", "Entity")

Definition at line 111 of file status_bar.cc.

References editor_mode_, and has_mode_.

Referenced by HandleStatusUpdate().

◆ ClearEditorMode()

void yaze::editor::StatusBar::ClearEditorMode ( )

Clear editor mode display.

Definition at line 116 of file status_bar.cc.

References editor_mode_, and has_mode_.

Referenced by ClearAllContext().

◆ SetCustomSegment()

void yaze::editor::StatusBar::SetCustomSegment ( const std::string & key,
const std::string & value )

Set a custom segment with key-value pair.

Parameters
keySegment identifier
valueValue to display

Definition at line 121 of file status_bar.cc.

References custom_segments_.

◆ ClearCustomSegment()

void yaze::editor::StatusBar::ClearCustomSegment ( const std::string & key)

Remove a custom segment.

Definition at line 126 of file status_bar.cc.

References custom_segments_.

◆ ClearAllContext()

void yaze::editor::StatusBar::ClearAllContext ( )

Clear all context (cursor, selection, zoom, mode, custom)

Definition at line 130 of file status_bar.cc.

References ClearCursorPosition(), ClearEditorMode(), ClearSelection(), ClearZoom(), and custom_segments_.

Referenced by HandleStatusUpdate().

Here is the call graph for this function:

◆ SetAgentInfo()

void yaze::editor::StatusBar::SetAgentInfo ( const std::string & provider,
const std::string & model,
bool active )

◆ ClearAgentInfo()

void yaze::editor::StatusBar::ClearAgentInfo ( )

◆ SetAgentToggleCallback()

void yaze::editor::StatusBar::SetAgentToggleCallback ( std::function< void()> callback)
inline

Definition at line 144 of file status_bar.h.

References agent_toggle_callback_.

Referenced by yaze::editor::EditorManager::InitializeSubsystems().

◆ Draw()

◆ GetHeight()

float yaze::editor::StatusBar::GetHeight ( ) const

Get the height of the status bar.

Returns
Height in pixels (0 if disabled)

Definition at line 20 of file status_bar.cc.

References enabled_, yaze::gui::LayoutHelpers::IsTouchDevice(), kStatusBarHeight, and kStatusBarTouchHeight.

Referenced by Draw(), and yaze::editor::LayoutCoordinator::GetBottomLayoutOffset().

Here is the call graph for this function:

◆ HandleStatusUpdate()

◆ DrawRomSegment()

◆ DrawSessionSegment()

void yaze::editor::StatusBar::DrawSessionSegment ( )
private

Definition at line 329 of file status_bar.cc.

References yaze::gui::ColoredTextF(), yaze::gui::GetTextSecondaryVec4(), ICON_MD_LAYERS, session_id_, and total_sessions_.

Referenced by Draw().

Here is the call graph for this function:

◆ DrawCursorSegment()

void yaze::editor::StatusBar::DrawCursorSegment ( )
private

Definition at line 339 of file status_bar.cc.

References yaze::gui::ColoredTextF(), cursor_label_, cursor_x_, cursor_y_, and yaze::gui::GetTextSecondaryVec4().

Referenced by Draw().

Here is the call graph for this function:

◆ DrawSelectionSegment()

void yaze::editor::StatusBar::DrawSelectionSegment ( )
private

Definition at line 344 of file status_bar.cc.

References yaze::gui::GetTextSecondaryVec4(), ICON_MD_SELECT_ALL, selection_count_, selection_height_, and selection_width_.

Referenced by Draw().

Here is the call graph for this function:

◆ DrawZoomSegment()

void yaze::editor::StatusBar::DrawZoomSegment ( )
private

Definition at line 356 of file status_bar.cc.

References yaze::gui::ColoredTextF(), yaze::gui::GetTextSecondaryVec4(), ICON_MD_ZOOM_IN, and zoom_level_.

Referenced by Draw().

Here is the call graph for this function:

◆ DrawModeSegment()

void yaze::editor::StatusBar::DrawModeSegment ( )
private

Definition at line 366 of file status_bar.cc.

References yaze::gui::ColoredTextF(), editor_mode_, and yaze::gui::GetTextSecondaryVec4().

Referenced by Draw().

Here is the call graph for this function:

◆ DrawAgentSegment()

◆ DrawCustomSegments()

void yaze::editor::StatusBar::DrawCustomSegments ( )
private

Definition at line 370 of file status_bar.cc.

References yaze::gui::ColoredTextF(), custom_segments_, DrawSeparator(), and yaze::gui::GetTextSecondaryVec4().

Referenced by Draw().

Here is the call graph for this function:

◆ DrawSeparator()

void yaze::editor::StatusBar::DrawSeparator ( )
private

Definition at line 378 of file status_bar.cc.

References yaze::gui::ColoredText(), and yaze::gui::GetOutlineVec4().

Referenced by Draw(), and DrawCustomSegments().

Here is the call graph for this function:

Member Data Documentation

◆ kStatusBarHeight

constexpr float yaze::editor::StatusBar::kStatusBarHeight = 24.0f
staticconstexpr

Definition at line 166 of file status_bar.h.

Referenced by GetHeight().

◆ kStatusBarTouchHeight

constexpr float yaze::editor::StatusBar::kStatusBarTouchHeight = 44.0f
staticconstexpr

Definition at line 167 of file status_bar.h.

Referenced by GetHeight().

◆ context_

GlobalEditorContext* yaze::editor::StatusBar::context_ = nullptr
private

Definition at line 182 of file status_bar.h.

Referenced by Initialize().

◆ enabled_

bool yaze::editor::StatusBar::enabled_ = false
private

Definition at line 183 of file status_bar.h.

Referenced by Draw(), GetHeight(), IsEnabled(), and SetEnabled().

◆ rom_

Rom* yaze::editor::StatusBar::rom_ = nullptr
private

Definition at line 184 of file status_bar.h.

Referenced by DrawRomSegment(), and SetRom().

◆ session_id_

size_t yaze::editor::StatusBar::session_id_ = 0
private

Definition at line 187 of file status_bar.h.

Referenced by DrawSessionSegment(), and SetSessionInfo().

◆ total_sessions_

size_t yaze::editor::StatusBar::total_sessions_ = 1
private

Definition at line 188 of file status_bar.h.

Referenced by Draw(), DrawSessionSegment(), and SetSessionInfo().

◆ has_cursor_

bool yaze::editor::StatusBar::has_cursor_ = false
private

Definition at line 191 of file status_bar.h.

Referenced by ClearCursorPosition(), Draw(), and SetCursorPosition().

◆ cursor_x_

int yaze::editor::StatusBar::cursor_x_ = 0
private

Definition at line 192 of file status_bar.h.

Referenced by DrawCursorSegment(), and SetCursorPosition().

◆ cursor_y_

int yaze::editor::StatusBar::cursor_y_ = 0
private

Definition at line 193 of file status_bar.h.

Referenced by DrawCursorSegment(), and SetCursorPosition().

◆ cursor_label_

std::string yaze::editor::StatusBar::cursor_label_ = "Pos"
private

Definition at line 194 of file status_bar.h.

Referenced by DrawCursorSegment(), and SetCursorPosition().

◆ has_selection_

bool yaze::editor::StatusBar::has_selection_ = false
private

Definition at line 197 of file status_bar.h.

Referenced by ClearSelection(), Draw(), and SetSelection().

◆ selection_count_

int yaze::editor::StatusBar::selection_count_ = 0
private

Definition at line 198 of file status_bar.h.

Referenced by DrawSelectionSegment(), and SetSelection().

◆ selection_width_

int yaze::editor::StatusBar::selection_width_ = 0
private

Definition at line 199 of file status_bar.h.

Referenced by DrawSelectionSegment(), and SetSelection().

◆ selection_height_

int yaze::editor::StatusBar::selection_height_ = 0
private

Definition at line 200 of file status_bar.h.

Referenced by DrawSelectionSegment(), and SetSelection().

◆ has_zoom_

bool yaze::editor::StatusBar::has_zoom_ = false
private

Definition at line 203 of file status_bar.h.

Referenced by ClearZoom(), Draw(), and SetZoom().

◆ zoom_level_

float yaze::editor::StatusBar::zoom_level_ = 1.0f
private

Definition at line 204 of file status_bar.h.

Referenced by DrawZoomSegment(), and SetZoom().

◆ has_mode_

bool yaze::editor::StatusBar::has_mode_ = false
private

Definition at line 207 of file status_bar.h.

Referenced by ClearEditorMode(), Draw(), and SetEditorMode().

◆ editor_mode_

std::string yaze::editor::StatusBar::editor_mode_
private

Definition at line 208 of file status_bar.h.

Referenced by ClearEditorMode(), Draw(), DrawModeSegment(), and SetEditorMode().

◆ custom_segments_

std::unordered_map<std::string, std::string> yaze::editor::StatusBar::custom_segments_
private

◆ has_agent_

bool yaze::editor::StatusBar::has_agent_ = false
private

Definition at line 214 of file status_bar.h.

Referenced by ClearAgentInfo(), Draw(), and SetAgentInfo().

◆ agent_active_

bool yaze::editor::StatusBar::agent_active_ = false
private

Definition at line 215 of file status_bar.h.

Referenced by ClearAgentInfo(), DrawAgentSegment(), and SetAgentInfo().

◆ agent_provider_

std::string yaze::editor::StatusBar::agent_provider_
private

Definition at line 216 of file status_bar.h.

Referenced by ClearAgentInfo(), Draw(), DrawAgentSegment(), and SetAgentInfo().

◆ agent_model_

std::string yaze::editor::StatusBar::agent_model_
private

Definition at line 217 of file status_bar.h.

Referenced by ClearAgentInfo(), Draw(), DrawAgentSegment(), and SetAgentInfo().

◆ agent_toggle_callback_

std::function<void()> yaze::editor::StatusBar::agent_toggle_callback_
private

Definition at line 218 of file status_bar.h.

Referenced by DrawAgentSegment(), and SetAgentToggleCallback().


The documentation for this class was generated from the following files: