MCPcopy Create free account
hub / github.com/RenderKit/embree / ArrowButtonEx

Method ArrowButtonEx

tutorials/common/imgui/imgui_widgets.cpp:770–799  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

768}
769
770bool ImGui::ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size, ImGuiButtonFlags flags)
771{
772 ImGuiContext& g = *GImGui;
773 ImGuiWindow* window = GetCurrentWindow();
774 if (window->SkipItems)
775 return false;
776
777 const ImGuiID id = window->GetID(str_id);
778 const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
779 const float default_size = GetFrameHeight();
780 ItemSize(size, (size.y >= default_size) ? g.Style.FramePadding.y : -1.0f);
781 if (!ItemAdd(bb, id))
782 return false;
783
784 if (g.LastItemData.InFlags & ImGuiItemFlags_ButtonRepeat)
785 flags |= ImGuiButtonFlags_Repeat;
786
787 bool hovered, held;
788 bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);
789
790 // Render
791 const ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
792 const ImU32 text_col = GetColorU32(ImGuiCol_Text);
793 RenderNavHighlight(bb, id);
794 RenderFrame(bb.Min, bb.Max, bg_col, true, g.Style.FrameRounding);
795 RenderArrow(window->DrawList, bb.Min + ImVec2(ImMax(0.0f, (size.x - g.FontSize) * 0.5f), ImMax(0.0f, (size.y - g.FontSize) * 0.5f)), text_col, dir);
796
797 IMGUI_TEST_ENGINE_ITEM_INFO(id, str_id, g.LastItemData.StatusFlags);
798 return pressed;
799}
800
801bool ImGui::ArrowButton(const char* str_id, ImGuiDir dir)
802{

Callers

nothing calls this directly

Calls 5

GetCurrentWindowFunction · 0.85
ItemSizeFunction · 0.85
ImVec2Function · 0.85
ImMaxFunction · 0.85
GetIDMethod · 0.80

Tested by

no test coverage detected