MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / CollapseButton

Method CollapseButton

KBotExt/imgui/imgui_widgets.cpp:836–860  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

ImVec2Function · 0.85
AddCircleFilledMethod · 0.80
GetCenterMethod · 0.80

Tested by

no test coverage detected