/*
 * Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved.
 */

#include <studio/imguiutil.hpp>
#include <studio/popup.hpp>

namespace studio {

void Popup::drawWindow(turbine::Context&, bool &open, std::function<void()> const &drawContents) {
	ig::centerNextWindow();
	ImGui::SetNextWindowSize(static_cast<ImVec2>(m_size * ig::dpiScale()));
	constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize;
	if (ImGui::BeginPopupModal(m_title.c_str(), &open, modalFlags)) {
		drawContents();
		ImGui::EndPopup();
	}
}

}