#include "window.hpp" #include "aurora/lib/window.hpp" #include "aurora/rmlui.hpp" #include "fmt/format.h" #include "magic_enum.hpp" #include "pane.hpp" #include "ui.hpp" #include "Z2AudioLib/Z2SeMgr.h" #include "m_Do/m_Do_audio.h" #include #include namespace dusk::ui { namespace { float base_body_padding(Rml::Context* context) noexcept { const float dpRatio = context->GetDensityIndependentPixelRatio(); const float heightDp = static_cast(context->GetDimensions().y) / dpRatio; if (heightDp <= 640.0f) { return 16.0f * dpRatio; } return 64.0f * dpRatio; } Rml::String window_document_source(const std::vector& styleSheets) { Rml::String links; for (const auto& sheet : styleSheets) { links += fmt::format(" \n", sheet); } return fmt::format(R"RML( {} )RML", links); } const Rml::String kDocumentSourceSmall = R"RML(
)RML"; } // namespace Window::Window(Props props) : Document(window_document_source(props.styleSheets)), mRoot(mDocument->GetElementById("window")) { if (props.tabBar) { mTabBar = std::make_unique(mRoot, TabBar::Props{ .onClose = [this] { request_close(); }, .selectedTabIndex = 0, .autoSelect = true, }); } else { mCloseButton = std::make_unique