mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
feat: Added layout manager to save and restore custom layouts
This commit is contained in:
38
lib/libimhex/include/hex/api/layout_manager.hpp
Normal file
38
lib/libimhex/include/hex/api/layout_manager.hpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#include <hex.hpp>
|
||||
#include <hex/helpers/fs.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <variant>
|
||||
|
||||
#include <nlohmann/json_fwd.hpp>
|
||||
#include <imgui.h>
|
||||
|
||||
namespace hex {
|
||||
|
||||
class LayoutManager {
|
||||
public:
|
||||
struct Layout {
|
||||
std::string name;
|
||||
std::fs::path path;
|
||||
};
|
||||
|
||||
static void save(const std::string &name);
|
||||
static void load(const std::fs::path &path);
|
||||
static void loadString(const std::string &content);
|
||||
|
||||
static std::vector<Layout> getLayouts();
|
||||
|
||||
static void process();
|
||||
static void reload();
|
||||
|
||||
private:
|
||||
LayoutManager() = default;
|
||||
|
||||
static std::optional<std::fs::path> s_layoutPathToLoad;
|
||||
static std::optional<std::string> s_layoutStringToLoad;
|
||||
static std::vector<Layout> s_layouts;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -40,6 +40,7 @@ namespace hex::fs {
|
||||
Themes,
|
||||
Libraries,
|
||||
Nodes,
|
||||
Layouts,
|
||||
|
||||
END
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user