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

Tracks widget dimensions for debugging and test automation. More...

#include <widget_measurement.h>

Public Member Functions

WidgetMetrics MeasureLastItem (const std::string &widget_id, const std::string &type="unknown")
 Measure the last rendered ImGui item.
 
void BeginToolbarMeasurement (const std::string &toolbar_id)
 Begin measuring a toolbar section.
 
void EndToolbarMeasurement ()
 End measuring a toolbar section and store total width.
 
float GetToolbarWidth (const std::string &toolbar_id) const
 Get total measured width of a toolbar.
 
bool WouldToolbarOverflow (const std::string &toolbar_id, float available_width) const
 Check if toolbar would overflow given window width.
 
const std::vector< WidgetMetrics > & GetToolbarMetrics (const std::string &toolbar_id) const
 Get all measurements for a specific toolbar.
 
void ClearFrame ()
 Clear all measurements (call once per frame)
 
std::string ExportMetricsJSON () const
 Export measurements for test automation.
 
void SetEnabled (bool enabled)
 Enable/disable measurement (performance option)
 
bool IsEnabled () const
 

Static Public Member Functions

static WidgetMeasurementInstance ()
 

Private Member Functions

 WidgetMeasurement ()=default
 

Private Attributes

bool enabled_ = true
 
std::string current_toolbar_id_
 
float current_toolbar_width_ = 0.0f
 
float current_toolbar_start_x_ = 0.0f
 
std::unordered_map< std::string, std::vector< WidgetMetrics > > toolbar_metrics_
 
std::unordered_map< std::string, float > toolbar_widths_
 
std::vector< WidgetMetricsframe_metrics_
 

Detailed Description

Tracks widget dimensions for debugging and test automation.

Integrates with ImGui Test Engine to provide accurate measurements of UI elements, helping prevent layout issues and enabling automated testing of widget sizes and positions.

Definition at line 40 of file widget_measurement.h.

Constructor & Destructor Documentation

◆ WidgetMeasurement()

yaze::gui::WidgetMeasurement::WidgetMeasurement ( )
privatedefault

Member Function Documentation

◆ Instance()

static WidgetMeasurement & yaze::gui::WidgetMeasurement::Instance ( )
inlinestatic

Definition at line 42 of file widget_measurement.h.

◆ MeasureLastItem()

WidgetMetrics yaze::gui::WidgetMeasurement::MeasureLastItem ( const std::string &  widget_id,
const std::string &  type = "unknown" 
)

◆ BeginToolbarMeasurement()

void yaze::gui::WidgetMeasurement::BeginToolbarMeasurement ( const std::string &  toolbar_id)

Begin measuring a toolbar section.

Definition at line 48 of file widget_measurement.cc.

References current_toolbar_id_, current_toolbar_start_x_, current_toolbar_width_, and toolbar_metrics_.

◆ EndToolbarMeasurement()

void yaze::gui::WidgetMeasurement::EndToolbarMeasurement ( )

End measuring a toolbar section and store total width.

Definition at line 57 of file widget_measurement.cc.

References current_toolbar_id_, current_toolbar_start_x_, current_toolbar_width_, and toolbar_widths_.

◆ GetToolbarWidth()

float yaze::gui::WidgetMeasurement::GetToolbarWidth ( const std::string &  toolbar_id) const

Get total measured width of a toolbar.

Definition at line 73 of file widget_measurement.cc.

References toolbar_widths_.

Referenced by ExportMetricsJSON(), and WouldToolbarOverflow().

◆ WouldToolbarOverflow()

bool yaze::gui::WidgetMeasurement::WouldToolbarOverflow ( const std::string &  toolbar_id,
float  available_width 
) const

Check if toolbar would overflow given window width.

Definition at line 81 of file widget_measurement.cc.

References GetToolbarWidth().

Here is the call graph for this function:

◆ GetToolbarMetrics()

const std::vector< WidgetMetrics > & yaze::gui::WidgetMeasurement::GetToolbarMetrics ( const std::string &  toolbar_id) const

Get all measurements for a specific toolbar.

Definition at line 87 of file widget_measurement.cc.

References toolbar_metrics_.

◆ ClearFrame()

void yaze::gui::WidgetMeasurement::ClearFrame ( )

Clear all measurements (call once per frame)

Definition at line 97 of file widget_measurement.cc.

References frame_metrics_.

◆ ExportMetricsJSON()

std::string yaze::gui::WidgetMeasurement::ExportMetricsJSON ( ) const

Export measurements for test automation.

Definition at line 102 of file widget_measurement.cc.

References GetToolbarWidth(), and toolbar_metrics_.

Here is the call graph for this function:

◆ SetEnabled()

void yaze::gui::WidgetMeasurement::SetEnabled ( bool  enabled)
inline

Enable/disable measurement (performance option)

Definition at line 96 of file widget_measurement.h.

References enabled_.

◆ IsEnabled()

bool yaze::gui::WidgetMeasurement::IsEnabled ( ) const
inline

Definition at line 97 of file widget_measurement.h.

References enabled_.

Member Data Documentation

◆ enabled_

bool yaze::gui::WidgetMeasurement::enabled_ = true
private

Definition at line 102 of file widget_measurement.h.

Referenced by IsEnabled(), MeasureLastItem(), and SetEnabled().

◆ current_toolbar_id_

std::string yaze::gui::WidgetMeasurement::current_toolbar_id_
private

◆ current_toolbar_width_

float yaze::gui::WidgetMeasurement::current_toolbar_width_ = 0.0f
private

Definition at line 104 of file widget_measurement.h.

Referenced by BeginToolbarMeasurement(), and EndToolbarMeasurement().

◆ current_toolbar_start_x_

float yaze::gui::WidgetMeasurement::current_toolbar_start_x_ = 0.0f
private

Definition at line 105 of file widget_measurement.h.

Referenced by BeginToolbarMeasurement(), and EndToolbarMeasurement().

◆ toolbar_metrics_

std::unordered_map<std::string, std::vector<WidgetMetrics> > yaze::gui::WidgetMeasurement::toolbar_metrics_
private

◆ toolbar_widths_

std::unordered_map<std::string, float> yaze::gui::WidgetMeasurement::toolbar_widths_
private

Definition at line 109 of file widget_measurement.h.

Referenced by EndToolbarMeasurement(), and GetToolbarWidth().

◆ frame_metrics_

std::vector<WidgetMetrics> yaze::gui::WidgetMeasurement::frame_metrics_
private

Definition at line 112 of file widget_measurement.h.

Referenced by ClearFrame(), and MeasureLastItem().


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