Make File Dialogs less hacky

This commit is contained in:
WerWolv
2021-01-27 00:44:10 +01:00
parent ab2458bdf4
commit 8990fad85a
8 changed files with 119 additions and 97 deletions

View File

@@ -12,6 +12,8 @@
#include <hex/views/view.hpp>
#include <imgui.h>
#include <ImGuiFileBrowser.h>
#include <nlohmann/json.hpp>
namespace hex { class SharedData; }
@@ -59,6 +61,12 @@ namespace hex {
static std::string errorPopupMessage;
static std::list<ImHexApi::Bookmarks::Entry> bookmarkEntries;
static imgui_addons::ImGuiFileBrowser fileBrowser;
static imgui_addons::ImGuiFileBrowser::DialogMode fileBrowserDialogMode;
static std::string fileBrowserTitle;
static std::string fileBrowserValidExtensions;
static std::function<void(std::string)> fileBrowserCallback;
static int mainArgc;
static char **mainArgv;

View File

@@ -3,6 +3,7 @@
#include <hex.hpp>
#include <imgui.h>
#include <ImGuiFileBrowser.h>
#include <hex/api/event.hpp>
@@ -22,6 +23,7 @@ namespace hex {
virtual void drawMenu();
virtual bool handleShortcut(int key, int mods);
static void openFileBrowser(std::string title, imgui_addons::ImGuiFileBrowser::DialogMode mode, std::string validExtensions, const std::function<void(std::string)> &callback);
static void doLater(std::function<void()> &&function);
static std::vector<std::function<void()>>& getDeferedCalls();