Added Footer and API for it and the welcome screen

This commit is contained in:
WerWolv
2021-02-18 12:09:19 +01:00
parent a251c7325a
commit 0e00555703
7 changed files with 87 additions and 23 deletions

View File

@@ -37,6 +37,7 @@ namespace hex::plugin::builtin {
{ "hex.welcome.learn.plugins.title", "Plugins API\"" },
{ "hex.welcome.learn.plugins.desc", "Extend ImHex with additional features using plugins" },
{ "hex.welcome.learn.plugins.link", "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide" },
{ "hex.welcome.header.various", "Various" },
{ "hex.common.little_endian", "Little Endian" },
{ "hex.common.big_endian", "Big Endian" },

View File

@@ -183,6 +183,16 @@ namespace hex {
static std::map<std::string, std::string>& getLanguages();
static std::map<std::string, std::vector<LanguageDefinition>>& getLanguageDefinitions();
};
struct Interface {
using DrawCallback = std::function<void()>;
static void addWelcomeScreenEntry(const DrawCallback &function);
static void addFooterItem(const DrawCallback &function);
static std::vector<DrawCallback>& getWelcomeScreenEntries();
static std::vector<DrawCallback>& getFooterItems();
};
};
}

View File

@@ -68,6 +68,9 @@ namespace hex {
static std::map<std::string, std::vector<LanguageDefinition>> languageDefinitions;
static std::map<std::string, std::string> loadedLanguageStrings;
static std::vector<ContentRegistry::Interface::DrawCallback> welcomeScreenEntries;
static std::vector<ContentRegistry::Interface::DrawCallback> footerItems;
static imgui_addons::ImGuiFileBrowser fileBrowser;
static imgui_addons::ImGuiFileBrowser::DialogMode fileBrowserDialogMode;
static std::string fileBrowserTitle;

View File

@@ -225,4 +225,21 @@ namespace hex {
std::map<std::string, std::vector<LanguageDefinition>>& ContentRegistry::Language::getLanguageDefinitions() {
return SharedData::languageDefinitions;
}
void ContentRegistry::Interface::addWelcomeScreenEntry(const ContentRegistry::Interface::DrawCallback &function) {
getWelcomeScreenEntries().push_back(function);
}
void ContentRegistry::Interface::addFooterItem(const ContentRegistry::Interface::DrawCallback &function){
getFooterItems().push_back(function);
}
std::vector<ContentRegistry::Interface::DrawCallback>& ContentRegistry::Interface::getWelcomeScreenEntries() {
return SharedData::welcomeScreenEntries;
}
std::vector<ContentRegistry::Interface::DrawCallback>& ContentRegistry::Interface::getFooterItems() {
return SharedData::footerItems;
}
}

View File

@@ -22,6 +22,9 @@ namespace hex {
std::map<std::string, std::vector<LanguageDefinition>> SharedData::languageDefinitions;
std::map<std::string, std::string> SharedData::loadedLanguageStrings;
std::vector<ContentRegistry::Interface::DrawCallback> SharedData::welcomeScreenEntries;
std::vector<ContentRegistry::Interface::DrawCallback> SharedData::footerItems;
imgui_addons::ImGuiFileBrowser SharedData::fileBrowser;
imgui_addons::ImGuiFileBrowser::DialogMode SharedData::fileBrowserDialogMode;
std::string SharedData::fileBrowserTitle;