ui: Added toolbar

This commit is contained in:
WerWolv
2021-08-21 00:52:11 +02:00
parent 0f45bef980
commit 37d2d58d2f
13 changed files with 133 additions and 79 deletions

View File

@@ -191,9 +191,11 @@ namespace hex {
static void addWelcomeScreenEntry(const DrawCallback &function);
static void addFooterItem(const DrawCallback &function);
static void addToolbarItem(const DrawCallback &function);
static std::vector<DrawCallback>& getWelcomeScreenEntries();
static std::vector<DrawCallback>& getFooterItems();
static std::vector<DrawCallback>& getToolbarItems();
};
};

View File

@@ -72,6 +72,7 @@ namespace hex {
static std::vector<ContentRegistry::Interface::DrawCallback> welcomeScreenEntries;
static std::vector<ContentRegistry::Interface::DrawCallback> footerItems;
static std::vector<ContentRegistry::Interface::DrawCallback> toolbarItems;
static std::vector<ContentRegistry::DataProcessorNode::Entry> dataProcessorNodes;
static u32 dataProcessorNodeIdCounter;

View File

@@ -2,6 +2,7 @@
#include <glad/glad.h>
#include <imgui.h>
#include <imgui_internal.h>
#include <hex.hpp>
#include <hex/api/imhex_api.hpp>
@@ -20,5 +21,6 @@
[[gnu::visibility("default")]] const char* getPluginName() { return name; } \
[[gnu::visibility("default")]] const char* getPluginAuthor() { return author; } \
[[gnu::visibility("default")]] const char* getPluginDescription() { return description; } \
[[gnu::visibility("default")]] void setImGuiContext(ImGuiContext *ctx) { ImGui::SetCurrentContext(ctx); GImGui = ctx; } \
} \
void hex::plugin::namespaceName::internal::initializePlugin()

View File

@@ -233,6 +233,10 @@ namespace hex {
getFooterItems().push_back(function);
}
void ContentRegistry::Interface::addToolbarItem(const ContentRegistry::Interface::DrawCallback &function){
getToolbarItems().push_back(function);
}
std::vector<ContentRegistry::Interface::DrawCallback>& ContentRegistry::Interface::getWelcomeScreenEntries() {
return SharedData::welcomeScreenEntries;
@@ -240,4 +244,7 @@ namespace hex {
std::vector<ContentRegistry::Interface::DrawCallback>& ContentRegistry::Interface::getFooterItems() {
return SharedData::footerItems;
}
std::vector<ContentRegistry::Interface::DrawCallback>& ContentRegistry::Interface::getToolbarItems() {
return SharedData::toolbarItems;
}
}

View File

@@ -22,6 +22,7 @@ namespace hex {
std::vector<ContentRegistry::Interface::DrawCallback> SharedData::welcomeScreenEntries;
std::vector<ContentRegistry::Interface::DrawCallback> SharedData::footerItems;
std::vector<ContentRegistry::Interface::DrawCallback> SharedData::toolbarItems;
std::vector<ContentRegistry::DataProcessorNode::Entry> SharedData::dataProcessorNodes;
u32 SharedData::dataProcessorNodeIdCounter = 1;