70 label =
"##icon_browser";
73 static thread_local std::string s_query;
76 ImGui::SetNextItemWidth(-FLT_MIN);
77 ImGui::InputTextWithHint(
"##search",
"Search icons...", &s_query);
79 const char* selected_glyph =
nullptr;
81 const float avail_x = ImGui::GetContentRegionAvail().x;
82 const float cell_size =
83 ImGui::GetFontSize() * 2.0f + ImGui::GetStyle().FramePadding.y * 2.0f;
84 const float spacing = ImGui::GetStyle().ItemSpacing.x;
85 const int columns = std::max(
86 1,
static_cast<int>((avail_x + spacing) / (cell_size + spacing)));
97 if (ImGui::Button(icon.
glyph, ImVec2(cell_size, cell_size))) {
98 selected_glyph = icon.
glyph;
100 if (ImGui::IsItemHovered()) {
105 column = (column + 1) % columns;
109 return selected_glyph;