29 const float top_pad = options.
compact ? 8.0f : 24.0f;
30 const float mid_pad = options.
compact ? 6.0f : 12.0f;
31 ImGui::Dummy(ImVec2(0.0f, top_pad));
33 if (options.
icon && options.
icon[0] !=
'\0') {
34 const ImVec2 icon_size = ImGui::CalcTextSize(options.
icon);
35 CenterNextItem(icon_size.x);
39 if (options.
title && options.
title[0] !=
'\0') {
41 const ImVec2 title_size = ImGui::CalcTextSize(options.
title);
42 CenterNextItem(title_size.x);
43 ImGui::PushStyleColor(
45 ImGui::TextWrapped(
"%s", options.
title);
46 ImGui::PopStyleColor();
50 ImGui::Dummy(ImVec2(0.0f, mid_pad * 0.5f));
51 const float wrap_width =
52 ImGui::GetContentRegionAvail().x * (options.
compact ? 0.95f : 0.85f);
53 const float indent = (ImGui::GetContentRegionAvail().x - wrap_width) * 0.5f;
55 ImGui::SetCursorPosX(ImGui::GetCursorPosX() + indent);
57 ImGui::PushTextWrapPos(ImGui::GetCursorPosX() + wrap_width);
58 ImGui::TextDisabled(
"%s", options.
detail);
59 ImGui::PopTextWrapPos();
64 ImGui::Dummy(ImVec2(0.0f, mid_pad));
65 const ImVec2 label_size = ImGui::CalcTextSize(options.
action_label);
66 const float button_width =
67 std::min(label_size.x + ImGui::GetStyle().FramePadding.x * 4.0f,
68 std::max(1.0f, ImGui::GetContentRegionAvail().x));
69 CenterNextItem(button_width);
78 ImGui::Dummy(ImVec2(0.0f, top_pad * 0.5f));
bool PrimaryButton(const char *label, const ImVec2 &size, const char *panel_id, const char *anim_id)
Draw a primary action button (accented color).