api: Refactored providers to allow for loading interfaces and config views

This commit is contained in:
WerWolv
2021-12-12 00:41:44 +01:00
parent 2e90abd2c5
commit 3e736b36b6
23 changed files with 272 additions and 145 deletions

View File

@@ -68,6 +68,8 @@ namespace hex {
void ImHexApi::Provider::add(prv::Provider *provider) {
SharedData::providers.push_back(provider);
SharedData::currentProvider = SharedData::providers.size() - 1;
EventManager::post<EventProviderCreated>(provider);
}
void ImHexApi::Provider::remove(prv::Provider *provider) {

View File

@@ -1,6 +1,7 @@
#include <hex/providers/provider.hpp>
#include <hex.hpp>
#include <hex/api/event.hpp>
#include <cmath>
#include <cstring>
@@ -12,6 +13,9 @@ namespace hex::prv {
Provider::Provider() {
this->m_patches.emplace_back();
if (this->hasLoadInterface())
EventManager::post<RequestOpenPopup>(View::toWindowName("hex.builtin.view.provider_settings.load_popup"));
}
Provider::~Provider() {
@@ -142,4 +146,21 @@ namespace hex::prv {
return this->m_patchTreeOffset > 0;
}
bool Provider::hasLoadInterface() const {
return false;
}
bool Provider::hasInterface() const {
return false;
}
void Provider::drawLoadInterface() {
}
void Provider::drawInterface() {
}
}