feat: Added support for view-specific menu items and main menus

This commit is contained in:
WerWolv
2025-07-22 22:32:45 +02:00
parent 737d71ee13
commit aa6e461340
28 changed files with 283 additions and 149 deletions

View File

@@ -6,6 +6,8 @@
namespace hex {
static View* s_lastFocusedView = nullptr;
View::View(UnlocalizedString unlocalizedName, const char *icon) : m_unlocalizedViewName(std::move(unlocalizedName)), m_icon(icon) { }
bool View::shouldDraw() const {
@@ -74,4 +76,19 @@ namespace hex {
return fmt::format("{}###{}", Lang(unlocalizedName), unlocalizedName.get());
}
void View::setFocused(bool focused) {
m_focused = focused;
if (focused)
s_lastFocusedView = this;
}
const View* View::getLastFocusedView() {
if (!ImHexApi::Provider::isValid())
return nullptr;
return s_lastFocusedView;
}
}