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

Method SetWindowPos

include/imgui/imgui.cpp:8534–8555  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8532}
8533
8534void ImGui::SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond)
8535{
8536 // Test condition (NB: bit 0 is always true) and clear flags for next time
8537 if (cond && (window->SetWindowPosAllowFlags & cond) == 0)
8538 return;
8539
8540 IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags.
8541 window->SetWindowPosAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing);
8542 window->SetWindowPosVal = ImVec2(FLT_MAX, FLT_MAX);
8543
8544 // Set
8545 const ImVec2 old_pos = window->Pos;
8546 window->Pos = ImTrunc(pos);
8547 ImVec2 offset = window->Pos - old_pos;
8548 if (offset.x == 0.0f && offset.y == 0.0f)
8549 return;
8550 MarkIniSettingsDirty(window);
8551 window->DC.CursorPos += offset; // As we happen to move the window while it is being appended to (which is a bad idea - will smear) let's at least offset the cursor
8552 window->DC.CursorMaxPos += offset; // And more importantly we need to offset CursorMaxPos/CursorStartPos this so ContentSize calculation doesn't get affected.
8553 window->DC.IdealMaxPos += offset;
8554 window->DC.CursorStartPos += offset;
8555}
8556
8557void ImGui::SetWindowPos(const ImVec2& pos, ImGuiCond cond)
8558{

Callers

nothing calls this directly

Calls 4

ImIsPowerOfTwoFunction · 0.85
ImVec2Function · 0.85
ImTruncFunction · 0.85
GetCurrentWindowReadFunction · 0.85

Tested by

no test coverage detected