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

Method InvisibleButton

imgui_tiny_app/imgui/imgui_widgets.cpp:841–863  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

839// Tip: use ImGui::PushID()/PopID() to push indices or pointers in the ID stack.
840// 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)
841bool ImGui::InvisibleButton(const char* str_id, const ImVec2& size_arg, ImGuiButtonFlags flags)
842{
843 ImGuiContext& g = *GImGui;
844 ImGuiWindow* window = GetCurrentWindow();
845 if (window->SkipItems)
846 return false;
847
848 // Ensure zero-size fits to contents
849 ImVec2 size = CalcItemSize(ImVec2(size_arg.x != 0.0f ? size_arg.x : -FLT_MIN, size_arg.y != 0.0f ? size_arg.y : -FLT_MIN), 0.0f, 0.0f);
850
851 const ImGuiID id = window->GetID(str_id);
852 const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
853 ItemSize(size);
854 if (!ItemAdd(bb, id, NULL, (flags & ImGuiButtonFlags_EnableNav) ? ImGuiItemFlags_None : ImGuiItemFlags_NoNav))
855 return false;
856
857 bool hovered, held;
858 bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);
859 RenderNavCursor(bb, id);
860
861 IMGUI_TEST_ENGINE_ITEM_INFO(id, str_id, g.LastItemData.StatusFlags);
862 return pressed;
863}
864
865bool ImGui::ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size, ImGuiButtonFlags flags)
866{

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected