mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
feat: Added support for view-specific menu items and main menus
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user