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

Theme-aware sizing helpers for consistent UI layout. More...

#include <layout_helpers.h>

Classes

struct  SafeAreaInsets
 
struct  WindowClampResult
 

Static Public Member Functions

static float GetStandardWidgetHeight ()
 
static float GetStandardSpacing ()
 
static float GetToolbarHeight ()
 
static float GetPanelPadding ()
 
static float GetStandardInputWidth ()
 
static float GetHexInputWidth ()
 
static float GetComboWidth ()
 
static float GetSliderWidth ()
 
static float GetCompactInputWidth ()
 
static float GetButtonPadding ()
 
static float GetTableRowHeight ()
 
static float GetCanvasToolbarHeight ()
 
static void BeginPaddedPanel (const char *label, float padding=-1.0f)
 
static void EndPaddedPanel ()
 
static bool BeginTableWithTheming (const char *str_id, int columns, ImGuiTableFlags flags=0, const ImVec2 &outer_size=ImVec2(0, 0), float inner_width=0.0f)
 
static void EndTableWithTheming ()
 
static void BeginCanvasPanel (const char *label, ImVec2 *canvas_size=nullptr)
 
static void EndCanvasPanel ()
 
static bool BeginContentChild (const char *id, const ImVec2 &min_size, bool border=false, ImGuiWindowFlags flags=0)
 
static void EndContentChild ()
 
static bool AutoSizedInputField (const char *label, char *buf, size_t buf_size, ImGuiInputTextFlags flags=0)
 
static bool AutoSizedInputInt (const char *label, int *v, int step=1, int step_fast=100, ImGuiInputTextFlags flags=0)
 
static bool AutoSizedInputFloat (const char *label, float *v, float step=0.0f, float step_fast=0.0f, const char *format="%.3f", ImGuiInputTextFlags flags=0)
 
static bool InputHexRow (const char *label, uint8_t *data)
 
static bool InputHexRow (const char *label, uint16_t *data)
 
static bool InputToolbarField (const char *label, char *buf, size_t buf_size)
 
static void BeginToolbar (const char *label)
 
static void EndToolbar ()
 
static void ToolbarSeparator ()
 
static bool ToolbarButton (const char *label, const ImVec2 &size=ImVec2(0, 0))
 
static void PropertyRow (const char *label, std::function< void()> widget_callback)
 
static void SectionHeader (const char *label)
 
static void HelpMarker (const char *desc)
 
static SafeAreaInsets GetSafeAreaInsets ()
 
static float GetTopInset ()
 
static bool IsTouchDevice ()
 
static float GetMinTouchTarget ()
 
static float GetTouchSafeWidgetHeight ()
 
static WindowClampResult ClampWindowToRect (const ImVec2 &pos, const ImVec2 &size, const ImVec2 &rect_pos, const ImVec2 &rect_size, float min_visible=32.0f)
 
static const Theme & GetTheme ()
 

Static Private Member Functions

static float GetBaseFontSize ()
 
static float ApplyCompactFactor (float base_value)
 

Detailed Description

Theme-aware sizing helpers for consistent UI layout.

All sizing functions respect the current theme's compact_factor and semantic multipliers, ensuring layouts are consistent but customizable.

Definition at line 21 of file layout_helpers.h.

Member Function Documentation

◆ GetStandardWidgetHeight()

float yaze::gui::LayoutHelpers::GetStandardWidgetHeight ( )
static

◆ GetStandardSpacing()

◆ GetToolbarHeight()

float yaze::gui::LayoutHelpers::GetToolbarHeight ( )
static

Definition at line 53 of file layout_helpers.cc.

References GetBaseFontSize(), and GetTheme().

Referenced by BeginToolbar().

Here is the call graph for this function:

◆ GetPanelPadding()

float yaze::gui::LayoutHelpers::GetPanelPadding ( )
static

Definition at line 59 of file layout_helpers.cc.

References GetBaseFontSize(), and GetTheme().

Referenced by BeginPaddedPanel(), and EndPaddedPanel().

Here is the call graph for this function:

◆ GetStandardInputWidth()

◆ GetHexInputWidth()

float yaze::gui::LayoutHelpers::GetHexInputWidth ( )
static

◆ GetComboWidth()

◆ GetSliderWidth()

◆ GetCompactInputWidth()

float yaze::gui::LayoutHelpers::GetCompactInputWidth ( )
static

Definition at line 85 of file layout_helpers.cc.

References yaze::gui::Theme::compact_factor, GetBaseFontSize(), and GetTheme().

Referenced by yaze::editor::PolyhedralEditorPanel::DrawFaceList().

Here is the call graph for this function:

◆ GetButtonPadding()

float yaze::gui::LayoutHelpers::GetButtonPadding ( )
static

Definition at line 89 of file layout_helpers.cc.

References GetBaseFontSize(), and GetTheme().

Referenced by BeginToolbar(), and ToolbarButton().

Here is the call graph for this function:

◆ GetTableRowHeight()

float yaze::gui::LayoutHelpers::GetTableRowHeight ( )
static

Definition at line 95 of file layout_helpers.cc.

References GetBaseFontSize(), and GetTheme().

Referenced by BeginTableWithTheming().

Here is the call graph for this function:

◆ GetCanvasToolbarHeight()

float yaze::gui::LayoutHelpers::GetCanvasToolbarHeight ( )
static

Definition at line 101 of file layout_helpers.cc.

References GetBaseFontSize(), and GetTheme().

Here is the call graph for this function:

◆ BeginPaddedPanel()

void yaze::gui::LayoutHelpers::BeginPaddedPanel ( const char * label,
float padding = -1.0f )
static

Definition at line 174 of file layout_helpers.cc.

References GetPanelPadding().

Here is the call graph for this function:

◆ EndPaddedPanel()

void yaze::gui::LayoutHelpers::EndPaddedPanel ( )
static

Definition at line 185 of file layout_helpers.cc.

References GetPanelPadding().

Here is the call graph for this function:

◆ BeginTableWithTheming()

bool yaze::gui::LayoutHelpers::BeginTableWithTheming ( const char * str_id,
int columns,
ImGuiTableFlags flags = 0,
const ImVec2 & outer_size = ImVec2(0, 0),
float inner_width = 0.0f )
static

Definition at line 193 of file layout_helpers.cc.

References yaze::gui::ConvertColorToImVec4(), GetTableRowHeight(), and GetTheme().

Referenced by yaze::editor::UICoordinator::DrawCommandPalette().

Here is the call graph for this function:

◆ EndTableWithTheming()

void yaze::gui::LayoutHelpers::EndTableWithTheming ( )
static

Definition at line 230 of file layout_helpers.cc.

Referenced by yaze::editor::UICoordinator::DrawCommandPalette().

◆ BeginCanvasPanel()

void yaze::gui::LayoutHelpers::BeginCanvasPanel ( const char * label,
ImVec2 * canvas_size = nullptr )
static

Definition at line 236 of file layout_helpers.cc.

References yaze::gui::ConvertColorToImVec4(), and GetTheme().

Here is the call graph for this function:

◆ EndCanvasPanel()

void yaze::gui::LayoutHelpers::EndCanvasPanel ( )
static

Definition at line 251 of file layout_helpers.cc.

◆ BeginContentChild()

bool yaze::gui::LayoutHelpers::BeginContentChild ( const char * id,
const ImVec2 & min_size,
bool border = false,
ImGuiWindowFlags flags = 0 )
static

◆ EndContentChild()

static void yaze::gui::LayoutHelpers::EndContentChild ( )
inlinestatic

◆ AutoSizedInputField()

bool yaze::gui::LayoutHelpers::AutoSizedInputField ( const char * label,
char * buf,
size_t buf_size,
ImGuiInputTextFlags flags = 0 )
static

Definition at line 264 of file layout_helpers.cc.

References GetStandardInputWidth().

Here is the call graph for this function:

◆ AutoSizedInputInt()

bool yaze::gui::LayoutHelpers::AutoSizedInputInt ( const char * label,
int * v,
int step = 1,
int step_fast = 100,
ImGuiInputTextFlags flags = 0 )
static

Definition at line 271 of file layout_helpers.cc.

References GetStandardInputWidth().

Here is the call graph for this function:

◆ AutoSizedInputFloat()

bool yaze::gui::LayoutHelpers::AutoSizedInputFloat ( const char * label,
float * v,
float step = 0.0f,
float step_fast = 0.0f,
const char * format = "%.3f",
ImGuiInputTextFlags flags = 0 )
static

Definition at line 278 of file layout_helpers.cc.

References GetStandardInputWidth().

Here is the call graph for this function:

◆ InputHexRow() [1/2]

bool yaze::gui::LayoutHelpers::InputHexRow ( const char * label,
uint8_t * data )
static

Definition at line 286 of file layout_helpers.cc.

References GetHexInputWidth().

Here is the call graph for this function:

◆ InputHexRow() [2/2]

bool yaze::gui::LayoutHelpers::InputHexRow ( const char * label,
uint16_t * data )
static

Definition at line 313 of file layout_helpers.cc.

References GetHexInputWidth().

Here is the call graph for this function:

◆ InputToolbarField()

bool yaze::gui::LayoutHelpers::InputToolbarField ( const char * label,
char * buf,
size_t buf_size )
static

Definition at line 340 of file layout_helpers.cc.

References yaze::gui::Theme::compact_factor, GetStandardInputWidth(), and GetTheme().

Here is the call graph for this function:

◆ BeginToolbar()

void yaze::gui::LayoutHelpers::BeginToolbar ( const char * label)
static

◆ EndToolbar()

void yaze::gui::LayoutHelpers::EndToolbar ( )
static

Definition at line 371 of file layout_helpers.cc.

Referenced by yaze::editor::MessageEditor::DrawMessageList().

◆ ToolbarSeparator()

void yaze::gui::LayoutHelpers::ToolbarSeparator ( )
static

Definition at line 391 of file layout_helpers.cc.

References GetStandardSpacing().

Here is the call graph for this function:

◆ ToolbarButton()

bool yaze::gui::LayoutHelpers::ToolbarButton ( const char * label,
const ImVec2 & size = ImVec2(0, 0) )
static

Definition at line 401 of file layout_helpers.cc.

References GetButtonPadding(), and GetMinTouchTarget().

Referenced by yaze::editor::MessageEditor::DrawMessageList().

Here is the call graph for this function:

◆ PropertyRow()

void yaze::gui::LayoutHelpers::PropertyRow ( const char * label,
std::function< void()> widget_callback )
static

◆ SectionHeader()

void yaze::gui::LayoutHelpers::SectionHeader ( const char * label)
static

Definition at line 427 of file layout_helpers.cc.

References yaze::gui::ConvertColorToImVec4(), and GetTheme().

Referenced by yaze::editor::Tile16Editor::UpdateTile16Edit().

Here is the call graph for this function:

◆ HelpMarker()

void yaze::gui::LayoutHelpers::HelpMarker ( const char * desc)
static

Definition at line 434 of file layout_helpers.cc.

◆ GetSafeAreaInsets()

◆ GetTopInset()

float yaze::gui::LayoutHelpers::GetTopInset ( )
static

◆ IsTouchDevice()

◆ GetMinTouchTarget()

float yaze::gui::LayoutHelpers::GetMinTouchTarget ( )
static

Definition at line 136 of file layout_helpers.cc.

References IsTouchDevice().

Referenced by yaze::editor::DungeonRoomSelector::DrawRoomSelectorInternal(), GetTouchSafeWidgetHeight(), and ToolbarButton().

Here is the call graph for this function:

◆ GetTouchSafeWidgetHeight()

float yaze::gui::LayoutHelpers::GetTouchSafeWidgetHeight ( )
static

Definition at line 140 of file layout_helpers.cc.

References GetMinTouchTarget(), and GetStandardWidgetHeight().

Referenced by BeginToolbar(), yaze::editor::workbench::CalcPaneSegmentHeight(), and yaze::editor::DungeonWorkbenchContent::Draw().

Here is the call graph for this function:

◆ ClampWindowToRect()

LayoutHelpers::WindowClampResult yaze::gui::LayoutHelpers::ClampWindowToRect ( const ImVec2 & pos,
const ImVec2 & size,
const ImVec2 & rect_pos,
const ImVec2 & rect_size,
float min_visible = 32.0f )
static

◆ GetTheme()

◆ GetBaseFontSize()

◆ ApplyCompactFactor()

static float yaze::gui::LayoutHelpers::ApplyCompactFactor ( float base_value)
inlinestaticprivate

Definition at line 124 of file layout_helpers.h.

References yaze::gui::Theme::compact_factor, and GetTheme().

Here is the call graph for this function:

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