#ifndef MENU_H #define MENU_H #include #include "UIWidgets.hpp" #include "MenuTypes.h" #include #include #include namespace Ship { uint32_t GetVectorIndexOf(std::vector& vector, std::string value); class Menu : public GuiWindow { public: using GuiWindow::GuiWindow; Menu(const std::string& cVar, const std::string& name, uint8_t searchSidebarIndex_ = 0, UIWidgets::Colors menuThemeIndex_ = UIWidgets::Colors::LightBlue); void InitElement() override; void DrawElement() override; void UpdateElement() override; void Draw() override; void InsertSidebarSearch(); void RemoveSidebarSearch(); void UpdateWindowBackendObjects(); bool IsMenuPopped(); UIWidgets::Colors GetMenuThemeColor(); void MenuDrawItem(WidgetInfo& widget, uint32_t width, UIWidgets::Colors menuThemeIndex); void AddMenuEntry(std::string entryName, const char* entryCvar); void AddSearchWidget(SearchWidget widget); std::unordered_map& GetDisabledMap(); protected: ImVec2 mOriginalSize; std::string mName; uint32_t mWindowFlags; std::unordered_map menuEntries; std::vector menuOrder; uint32_t DrawSearchResults(std::string& menuSearchText); ImGuiTextFilter menuSearch; uint8_t searchSidebarIndex; UIWidgets::Colors defaultThemeIndex; std::shared_ptr> availableWindowBackends; std::unordered_map availableWindowBackendsMap; int32_t configWindowBackend; std::unordered_map disabledMap; std::vector disabledVector; const SidebarEntry searchSidebarEntry = { .columnCount = 1, .columnWidgets = { { { .name = "Sidebar Search", .type = WIDGET_SEARCH, .options = std::make_shared(UIWidgets::WidgetOptions{}.Tooltip( "Searches all menus for the given text, including tooltips.")) } } } }; private: bool allowPopout = true; // PortNote: should be set to false on small screen ports bool popped; ImVec2 poppedSize; ImVec2 poppedPos; float windowHeight; float windowWidth; UIWidgets::Colors menuThemeIndex; }; } // namespace Ship #endif // MENU_H