Tip: use ImGui::PushID()/PopID() to push indices or pointers in the ID stack. Then you can keep 'str_id' empty or the same for all your buttons (instead of creating a string based on a non-string id)
| 744 | // Tip: use ImGui::PushID()/PopID() to push indices or pointers in the ID stack. |
| 745 | // Then you can keep 'str_id' empty or the same for all your buttons (instead of creating a string based on a non-string id) |
| 746 | bool ImGui::InvisibleButton(const char* str_id, const ImVec2& size_arg, ImGuiButtonFlags flags) |
| 747 | { |
| 748 | ImGuiContext& g = *GImGui; |
| 749 | ImGuiWindow* window = GetCurrentWindow(); |
| 750 | if (window->SkipItems) |
| 751 | return false; |
| 752 | |
| 753 | // Cannot use zero-size for InvisibleButton(). Unlike Button() there is not way to fallback using the label size. |
| 754 | IM_ASSERT(size_arg.x != 0.0f && size_arg.y != 0.0f); |
| 755 | |
| 756 | const ImGuiID id = window->GetID(str_id); |
| 757 | ImVec2 size = CalcItemSize(size_arg, 0.0f, 0.0f); |
| 758 | const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size); |
| 759 | ItemSize(size); |
| 760 | if (!ItemAdd(bb, id)) |
| 761 | return false; |
| 762 | |
| 763 | bool hovered, held; |
| 764 | bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags); |
| 765 | |
| 766 | IMGUI_TEST_ENGINE_ITEM_INFO(id, str_id, g.LastItemData.StatusFlags); |
| 767 | return pressed; |
| 768 | } |
| 769 | |
| 770 | bool ImGui::ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size, ImGuiButtonFlags flags) |
| 771 | { |
nothing calls this directly
no test coverage detected