da6a8b5e59
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.
33 lines
836 B
C++
33 lines
836 B
C++
#include "core/toolbar.h"
|
|
#include "core/tokens.h"
|
|
#include <imgui.h>
|
|
|
|
namespace fn_ui {
|
|
|
|
void toolbar_begin() {
|
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing,
|
|
ImVec2(fn_tokens::spacing::sm, 0.0f));
|
|
ImGui::BeginGroup();
|
|
}
|
|
|
|
void toolbar_separator() {
|
|
ImGui::SameLine();
|
|
const float fh = ImGui::GetFrameHeight();
|
|
const float h = fh * 0.7f;
|
|
const ImVec2 p = ImGui::GetCursorScreenPos();
|
|
const ImU32 col = ImGui::ColorConvertFloat4ToU32(fn_tokens::colors::border);
|
|
ImGui::GetWindowDrawList()->AddLine(
|
|
ImVec2(p.x, p.y + (fh - h) * 0.5f),
|
|
ImVec2(p.x, p.y + (fh + h) * 0.5f),
|
|
col, 1.0f);
|
|
ImGui::Dummy(ImVec2(fn_tokens::spacing::xs, fh));
|
|
ImGui::SameLine();
|
|
}
|
|
|
|
void toolbar_end() {
|
|
ImGui::EndGroup();
|
|
ImGui::PopStyleVar();
|
|
}
|
|
|
|
} // namespace fn_ui
|