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

Method DebugBreakButton

imgui_tiny_app/imgui/imgui.cpp:23003–23036  ·  view source on GitHub ↗

Special button that doesn't take focus, doesn't take input owner, and can be activated without a click etc. In order to reduce interferences with the contents we are trying to debug into.

Source from the content-addressed store, hash-verified

23001// Special button that doesn't take focus, doesn't take input owner, and can be activated without a click etc.
23002// In order to reduce interferences with the contents we are trying to debug into.
23003bool ImGui::DebugBreakButton(const char* label, const char* description_of_location)
23004{
23005 ImGuiWindow* window = GetCurrentWindow();
23006 if (window->SkipItems)
23007 return false;
23008
23009 ImGuiContext& g = *GImGui;
23010 const ImGuiID id = window->GetID(label);
23011 const ImVec2 label_size = CalcTextSize(label, NULL, true);
23012 ImVec2 pos = window->DC.CursorPos + ImVec2(0.0f, window->DC.CurrLineTextBaseOffset);
23013 ImVec2 size = ImVec2(label_size.x + g.Style.FramePadding.x * 2.0f, label_size.y);
23014
23015 const ImRect bb(pos, pos + size);
23016 ItemSize(size, 0.0f);
23017 if (!ItemAdd(bb, id))
23018 return false;
23019
23020 // WE DO NOT USE ButtonEx() or ButtonBehavior() in order to reduce our side-effects.
23021 bool hovered = ItemHoverable(bb, id, g.CurrentItemFlags);
23022 bool pressed = hovered && (IsKeyChordPressed(g.DebugBreakKeyChord) || IsMouseClicked(0) || g.NavActivateId == id);
23023 DebugBreakButtonTooltip(false, description_of_location);
23024
23025 ImVec4 col4f = GetStyleColorVec4(hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
23026 ImVec4 hsv;
23027 ColorConvertRGBtoHSV(col4f.x, col4f.y, col4f.z, hsv.x, hsv.y, hsv.z);
23028 ColorConvertHSVtoRGB(hsv.x + 0.20f, hsv.y, hsv.z, col4f.x, col4f.y, col4f.z);
23029
23030 RenderNavCursor(bb, id);
23031 RenderFrame(bb.Min, bb.Max, GetColorU32(col4f), true, g.Style.FrameRounding);
23032 RenderTextClipped(bb.Min, bb.Max, label, NULL, &label_size, g.Style.ButtonTextAlign, &bb);
23033
23034 IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags);
23035 return pressed;
23036}
23037
23038// [DEBUG] Display contents of Columns
23039void ImGui::DebugNodeColumns(ImGuiOldColumns* columns)

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