MCPcopy Create free account
hub / github.com/Aegel5/SimpleSwitcher / ArrowButtonEx

Method ArrowButtonEx

imgui_tiny_app/imgui/imgui_widgets.cpp:865–891  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

863}
864
865bool ImGui::ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size, ImGuiButtonFlags flags)
866{
867 ImGuiContext& g = *GImGui;
868 ImGuiWindow* window = GetCurrentWindow();
869 if (window->SkipItems)
870 return false;
871
872 const ImGuiID id = window->GetID(str_id);
873 const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
874 const float default_size = GetFrameHeight();
875 ItemSize(size, (size.y >= default_size) ? g.Style.FramePadding.y : -1.0f);
876 if (!ItemAdd(bb, id))
877 return false;
878
879 bool hovered, held;
880 bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);
881
882 // Render
883 const ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
884 const ImU32 text_col = GetColorU32(ImGuiCol_Text);
885 RenderNavCursor(bb, id);
886 RenderFrame(bb.Min, bb.Max, bg_col, true, g.Style.FrameRounding);
887 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);
888
889 IMGUI_TEST_ENGINE_ITEM_INFO(id, str_id, g.LastItemData.StatusFlags);
890 return pressed;
891}
892
893bool ImGui::ArrowButton(const char* str_id, ImGuiDir dir)
894{

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