MCPcopy Create free account
hub / github.com/clementgallet/libTAS / CollapseButton

Method CollapseButton

src/external/imgui/imgui_widgets.cpp:838–862  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

ImVec2Function · 0.85
AddCircleFilledMethod · 0.80
GetCenterMethod · 0.80

Tested by

no test coverage detected