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

Method CollapseButton

tutorials/common/imgui/imgui_widgets.cpp:846–868  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

844}
845
846bool ImGui::CollapseButton(ImGuiID id, const ImVec2& pos)
847{
848 ImGuiContext& g = *GImGui;
849 ImGuiWindow* window = g.CurrentWindow;
850
851 ImRect bb(pos, pos + ImVec2(g.FontSize, g.FontSize) + g.Style.FramePadding * 2.0f);
852 ItemAdd(bb, id);
853 bool hovered, held;
854 bool pressed = ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_None);
855
856 // Render
857 ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
858 ImU32 text_col = GetColorU32(ImGuiCol_Text);
859 if (hovered || held)
860 window->DrawList->AddCircleFilled(bb.GetCenter()/*+ ImVec2(0.0f, -0.5f)*/, g.FontSize * 0.5f + 1.0f, bg_col, 12);
861 RenderArrow(window->DrawList, bb.Min + g.Style.FramePadding, text_col, window->Collapsed ? ImGuiDir_Right : ImGuiDir_Down, 1.0f);
862
863 // Switch to moving the window after mouse is moved beyond the initial drag threshold
864 if (IsItemActive() && IsMouseDragging(0))
865 StartMouseMovingWindow(window);
866
867 return pressed;
868}
869
870ImGuiID ImGui::GetWindowScrollbarID(ImGuiWindow* window, ImGuiAxis axis)
871{

Callers

nothing calls this directly

Calls 3

ImVec2Function · 0.85
AddCircleFilledMethod · 0.80
GetCenterMethod · 0.80

Tested by

no test coverage detected