feat(cpp/core): primitivas UI estilo Mantine
Anade 9 primitivas reutilizables al registry C++ que replican el comportamiento de los componentes correspondientes de @fn_library / Mantine v9, todas estilizadas con tokens_cpp_core (colores Mantine dark + indigo): - button_cpp_core (component, pure) variantes primary/secondary/subtle/danger + sm/md/lg - icon_button_cpp_core (component, pure) cuadrado 28x28 con glyph centrado + tooltip - toolbar_cpp_core (component, pure) grupo horizontal de acciones con separadores - modal_dialog_cpp_core (component, pure) popup modal centrada + close con Escape - text_input_cpp_core (component, impure) InputText con label muted + placeholder - select_cpp_core (component, impure) dropdown con label + opcion '(none)' opcional - toast_cpp_core (component, impure) notificaciones efimeras + inbox con badge - tree_view_cpp_core (component, impure) jerarquia low-level con tree_node_clicked helper - process_runner_cpp_core (component, impure) tarea en std::thread + spinner inline Cada primitiva tiene su .md con frontmatter completo (params/output) y se indexa via fn index. Son la base del primitives_gallery y de cualquier app fn_ui futura.
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
---
|
||||
name: toolbar
|
||||
kind: component
|
||||
lang: cpp
|
||||
domain: core
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "void fn_ui::toolbar_begin(); void fn_ui::toolbar_separator(); void fn_ui::toolbar_end()"
|
||||
description: "Grupo horizontal de acciones (buttons/icon_buttons) con spacing coherente y separadores verticales. Patron begin/separator/end."
|
||||
tags: [imgui, ui, toolbar, layout, tokens]
|
||||
uses_functions: ["tokens_cpp_core"]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: [imgui]
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "cpp/functions/core/toolbar.cpp"
|
||||
framework: imgui
|
||||
params: []
|
||||
output: "Inicializa/cierra un grupo horizontal con spacing sm; toolbar_separator dibuja una linea vertical sutil entre grupos"
|
||||
---
|
||||
|
||||
# toolbar
|
||||
|
||||
Contenedor horizontal para agrupar acciones con spacing consistente. El caller es responsable de llamar a `ImGui::SameLine()` entre widgets consecutivos — `toolbar_separator()` ya incluye `SameLine` implicito.
|
||||
|
||||
## Patron
|
||||
|
||||
```cpp
|
||||
#include "core/toolbar.h"
|
||||
#include "core/button.h"
|
||||
#include "core/icon_button.h"
|
||||
using namespace fn_ui;
|
||||
|
||||
toolbar_begin();
|
||||
if (button("New", ButtonVariant::Primary)) { /* ... */ }
|
||||
ImGui::SameLine();
|
||||
if (button("Open")) { /* ... */ }
|
||||
toolbar_separator();
|
||||
if (icon_button("##reload", "\xe2\x86\xbb", "Reload")) { /* ... */ }
|
||||
toolbar_end();
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
- Para alinear la toolbar a la derecha del page_header usar
|
||||
`ImGui::SameLine(ImGui::GetWindowWidth() - estimated_width)` antes del begin,
|
||||
o usar un Table de 2 columnas con la derecha stretch.
|
||||
- El separador usa `colors::border` de tokens y ocupa 70% de `GetFrameHeight`.
|
||||
Reference in New Issue
Block a user