MCPcopy Create free account
hub / github.com/Wemino/MarkerPatch / CollapseButton

Method CollapseButton

include/imgui/imgui_widgets.cpp:940–965  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

938}
939
940bool ImGui::CollapseButton(ImGuiID id, const ImVec2& pos)
941{
942 ImGuiContext& g = *GImGui;
943 ImGuiWindow* window = g.CurrentWindow;
944
945 ImRect bb(pos, pos + ImVec2(g.FontSize, g.FontSize));
946 bool is_clipped = !ItemAdd(bb, id);
947 bool hovered, held;
948 bool pressed = ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_None);
949 if (is_clipped)
950 return pressed;
951
952 // Render
953 ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
954 ImU32 text_col = GetColorU32(ImGuiCol_Text);
955 if (hovered || held)
956 window->DrawList->AddRectFilled(bb.Min, bb.Max, bg_col);
957 RenderNavCursor(bb, id, ImGuiNavRenderCursorFlags_Compact);
958 RenderArrow(window->DrawList, bb.Min, text_col, window->Collapsed ? ImGuiDir_Right : ImGuiDir_Down, 1.0f);
959
960 // Switch to moving the window after mouse is moved beyond the initial drag threshold
961 if (IsItemActive() && IsMouseDragging(0))
962 StartMouseMovingWindow(window);
963
964 return pressed;
965}
966
967ImGuiID ImGui::GetWindowScrollbarID(ImGuiWindow* window, ImGuiAxis axis)
968{

Callers

nothing calls this directly

Calls 2

ImVec2Function · 0.85
AddRectFilledMethod · 0.80

Tested by

no test coverage detected