MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / ArrowButtonEx

Method ArrowButtonEx

KBotExt/imgui/imgui_widgets.cpp:763–789  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

761}
762
763bool ImGui::ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size, ImGuiButtonFlags flags)
764{
765 ImGuiContext& g = *GImGui;
766 ImGuiWindow* window = GetCurrentWindow();
767 if (window->SkipItems)
768 return false;
769
770 const ImGuiID id = window->GetID(str_id);
771 const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
772 const float default_size = GetFrameHeight();
773 ItemSize(size, (size.y >= default_size) ? g.Style.FramePadding.y : -1.0f);
774 if (!ItemAdd(bb, id))
775 return false;
776
777 bool hovered, held;
778 bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);
779
780 // Render
781 const ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
782 const ImU32 text_col = GetColorU32(ImGuiCol_Text);
783 RenderNavHighlight(bb, id);
784 RenderFrame(bb.Min, bb.Max, bg_col, true, g.Style.FrameRounding);
785 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);
786
787 IMGUI_TEST_ENGINE_ITEM_INFO(id, str_id, g.LastItemData.StatusFlags);
788 return pressed;
789}
790
791bool ImGui::ArrowButton(const char* str_id, ImGuiDir dir)
792{

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