#include "ui_mod_menu.h" #include "ui_utils.h" #include "recomp_ui.h" #include "banjo_support.h" #include "banjo_render.h" #include "librecomp/mods.hpp" #include #ifdef WIN32 #include #endif // TODO: // - Set up navigation. // - Add hover and active state for mod entries. namespace recompui { static std::string generate_thumbnail_src_for_mod(const std::string &mod_id) { return "?/mods/" + mod_id + "/thumb"; } static bool is_mod_enabled_or_auto(const std::string &mod_id) { return recomp::mods::is_mod_enabled(mod_id) || recomp::mods::is_mod_auto_enabled(mod_id); } // ModEntryView constexpr float modEntryHeight = 120.0f; constexpr float modEntryPadding = 4.0f; extern const std::string mod_tab_id; const std::string mod_tab_id = "#tab_mods"; ModEntryView::ModEntryView(Element *parent) : Element(parent, Events(EventType::Update)) { ContextId context = get_current_context(); set_display(Display::Flex); set_flex_direction(FlexDirection::Row); set_width(100.0f, Unit::Percent); set_height_auto(); set_padding(modEntryPadding); set_border_left_width(2.0f); set_border_color(theme::color::BorderSoft); set_background_color(theme::color::BorderSoft); set_cursor(Cursor::Pointer); set_color(theme::color::Text); checked_style.set_border_color(theme::color::BorderSolid); checked_style.set_color(theme::color::White); checked_style.set_background_color(recompui::theme::color::Background3); hover_style.set_border_color(theme::color::BorderHard); checked_hover_style.set_border_color(theme::color::Text); pulsing_style.set_border_color(theme::color::SecondaryA80); { thumbnail_image = context.create_element(this, ""); thumbnail_image->set_width(modEntryHeight); thumbnail_image->set_height(modEntryHeight); thumbnail_image->set_min_width(modEntryHeight); thumbnail_image->set_min_height(modEntryHeight); thumbnail_image->set_background_color(theme::color::BGOverlay); body_container = context.create_element(this); body_container->set_width_auto(); body_container->set_margin_left(16.0f); body_container->set_padding_top(8.0f); body_container->set_padding_bottom(8.0f); body_container->set_max_height(modEntryHeight); body_container->set_overflow_y(Overflow::Hidden); { name_label = context.create_element