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,51 @@
|
||||
---
|
||||
name: select
|
||||
kind: component
|
||||
lang: cpp
|
||||
domain: core
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "bool fn_ui::select(const char* label, int* selected_idx, const char* const* options, int count, bool allow_none = false)"
|
||||
description: "Select/dropdown ImGui con label muted, estilo surface+border y opcion '(none)' opcional"
|
||||
tags: [imgui, select, dropdown, form, ui, 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/select.cpp"
|
||||
framework: imgui
|
||||
params:
|
||||
- name: label
|
||||
desc: "Label mostrado arriba, tambien usado como id (prefijado con ##)"
|
||||
- name: selected_idx
|
||||
desc: "Puntero a int con el indice seleccionado. -1 = ninguno (solo si allow_none)"
|
||||
- name: options
|
||||
desc: "Array de C-strings con las opciones visibles"
|
||||
- name: count
|
||||
desc: "Numero de opciones"
|
||||
- name: allow_none
|
||||
desc: "Si true, aparece '(none)' como opcion inicial con indice -1"
|
||||
output: "true el frame en que la seleccion cambio"
|
||||
---
|
||||
|
||||
# select
|
||||
|
||||
Label muted + combo estilizado con tokens. Apto para campos de formulario (lang, domain, project parent).
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```cpp
|
||||
static int lang_idx = 0;
|
||||
const char* langs[] = {"go", "py", "ts", "sh", "cpp"};
|
||||
fn_ui::select("Language", &lang_idx, langs, 5);
|
||||
|
||||
// Con opcion "ninguno"
|
||||
static int project_idx = -1;
|
||||
fn_ui::select("Project", &project_idx, project_names.data(),
|
||||
(int)project_names.size(), true);
|
||||
```
|
||||
Reference in New Issue
Block a user