1
0
mirror of synced 2024-12-15 01:01:15 +01:00
ImHex/lib/libimhex/include/hex/api/layout_manager.hpp

78 lines
1.8 KiB
C++
Raw Normal View History

#pragma once
#include <hex/helpers/fs.hpp>
#include <string>
namespace hex {
class LayoutManager {
public:
struct Layout {
std::string name;
std::fs::path path;
};
2023-08-26 12:54:52 +02:00
/**
* @brief Save the current layout
* @param name Name of the layout
*/
static void save(const std::string &name);
2023-08-26 12:54:52 +02:00
/**
* @brief Load a layout from a file
* @param path Path to the layout file
*/
static void load(const std::fs::path &path);
2023-08-26 12:54:52 +02:00
2023-12-11 15:54:22 +01:00
/**
* @brief Saves the current layout to a string
* @return String containing the layout
*/
static std::string saveToString();
2023-08-26 12:54:52 +02:00
/**
* @brief Load a layout from a string
* @param content Layout string
*/
2023-12-11 15:54:22 +01:00
static void loadFromString(const std::string &content);
2023-08-26 12:54:52 +02:00
/**
* @brief Get a list of all layouts
* @return List of all added layouts
*/
static std::vector<Layout> getLayouts();
2023-08-26 12:54:52 +02:00
/**
* @brief Handles loading of layouts if needed
* @note This function should only be called by ImHex
*/
static void process();
2023-08-26 12:54:52 +02:00
/**
* @brief Reload all layouts
*/
static void reload();
2023-08-26 12:54:52 +02:00
/**
* @brief Reset the layout manager
*/
2023-05-11 23:21:52 +02:00
static void reset();
2023-12-06 13:49:58 +01:00
/**
* @brief Checks is the current layout is locked
*/
static bool isLayoutLocked();
/**
* @brief Locks or unlocks the current layout
* @note If the layout is locked, it cannot be modified by the user anymore
* @param locked True to lock the layout, false to unlock it
*/
static void lockLayout(bool locked);
private:
LayoutManager() = default;
};
}