yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
layout_helpers.h
Go to the documentation of this file.
1#ifndef YAZE_APP_GUI_LAYOUT_HELPERS_H
2#define YAZE_APP_GUI_LAYOUT_HELPERS_H
3
4#include <vector>
5
6#include "absl/strings/str_format.h"
8#include "imgui/imgui.h"
9
10namespace yaze {
11namespace gui {
12
20 public:
21 // Core sizing functions (respect theme compact_factor + multipliers)
22 static float GetStandardWidgetHeight();
23 static float GetStandardSpacing();
24 static float GetToolbarHeight();
25 static float GetPanelPadding();
26 static float GetStandardInputWidth();
27 static float GetButtonPadding();
28 static float GetTableRowHeight();
29 static float GetCanvasToolbarHeight();
30
31 // Layout utilities
32 static void BeginPaddedPanel(const char* label, float padding = -1.0f);
33 static void EndPaddedPanel();
34
35 static bool BeginTableWithTheming(const char* str_id, int columns,
36 ImGuiTableFlags flags = 0,
37 const ImVec2& outer_size = ImVec2(0, 0),
38 float inner_width = 0.0f);
39 static void EndTableWithTheming();
40 static void EndTable() { ImGui::EndTable(); }
41
42 static void BeginCanvasPanel(const char* label, ImVec2* canvas_size = nullptr);
43 static void EndCanvasPanel();
44
45 // Input field helpers
46 static bool AutoSizedInputField(const char* label, char* buf, size_t buf_size,
47 ImGuiInputTextFlags flags = 0);
48 static bool AutoSizedInputInt(const char* label, int* v, int step = 1,
49 int step_fast = 100, ImGuiInputTextFlags flags = 0);
50 static bool AutoSizedInputFloat(const char* label, float* v, float step = 0.0f,
51 float step_fast = 0.0f, const char* format = "%.3f",
52 ImGuiInputTextFlags flags = 0);
53
54 // Input preset functions for common patterns
55 static bool InputHexRow(const char* label, uint8_t* data);
56 static bool InputHexRow(const char* label, uint16_t* data);
57 static void BeginPropertyGrid(const char* label);
58 static void EndPropertyGrid();
59 static bool InputToolbarField(const char* label, char* buf, size_t buf_size);
60
61 // Toolbar helpers
62 static void BeginToolbar(const char* label);
63 static void EndToolbar();
64 static void ToolbarSeparator();
65 static bool ToolbarButton(const char* label, const ImVec2& size = ImVec2(0, 0));
66
67 // Common layout patterns
68 static void PropertyRow(const char* label, std::function<void()> widget_callback);
69 static void SectionHeader(const char* label);
70 static void HelpMarker(const char* desc);
71
72 // Get current theme
73 static const EnhancedTheme& GetTheme() {
75 }
76
77 private:
78 static float GetBaseFontSize() { return ImGui::GetFontSize(); }
79 static float ApplyCompactFactor(float base_value) {
80 return base_value * GetTheme().compact_factor;
81 }
82};
83
84} // namespace gui
85} // namespace yaze
86
87#endif // YAZE_APP_GUI_LAYOUT_HELPERS_H
Theme-aware sizing helpers for consistent UI layout.
static float GetPanelPadding()
static void BeginToolbar(const char *label)
static float GetCanvasToolbarHeight()
static void EndTableWithTheming()
static float ApplyCompactFactor(float base_value)
static void HelpMarker(const char *desc)
static float GetTableRowHeight()
static const EnhancedTheme & GetTheme()
static float GetStandardInputWidth()
static void BeginPropertyGrid(const char *label)
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 AutoSizedInputInt(const char *label, int *v, int step=1, int step_fast=100, ImGuiInputTextFlags flags=0)
static bool InputToolbarField(const char *label, char *buf, size_t buf_size)
static void BeginCanvasPanel(const char *label, ImVec2 *canvas_size=nullptr)
static void PropertyRow(const char *label, std::function< void()> widget_callback)
static float GetBaseFontSize()
static float GetButtonPadding()
static float GetToolbarHeight()
static void BeginPaddedPanel(const char *label, float padding=-1.0f)
static bool ToolbarButton(const char *label, const ImVec2 &size=ImVec2(0, 0))
static bool InputHexRow(const char *label, uint8_t *data)
static float GetStandardWidgetHeight()
static float GetStandardSpacing()
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 bool AutoSizedInputField(const char *label, char *buf, size_t buf_size, ImGuiInputTextFlags flags=0)
static ThemeManager & Get()
const EnhancedTheme & GetCurrentTheme() const
Main namespace for the application.
Definition controller.cc:20
Comprehensive theme structure for YAZE.